Structure:
We've discussed software size and dependencies as motivation for studying architecture. So is defining a software architecture something that someone else does?
Something that channels what we do as developers?
No! Every time you develop a program you define an architecture, either consiously :-) or unconsiously :-(. That's determined by the way you
build code in source files, the way you define classes and their relationships inside those files, the way you package the files as executables and dynamic link libraries.
You can build an architecture that is:
-
Spaghetti:
Stuff everything into one huge file with intricate dependencies like spaghetti in a bowl.
-
Baroque:
So ornate and complicated that it is hard to understand how it functions.
-
Fragile:
Uses no error handling, uses full path names welded to the development environment, attempts to open files without checking to see if they exist, uses
fixed arrays to hold collected data so the storage is almost always used wastefully or insufficient causing exceptions to be thrown.
-
Well Crafted:
- Avoids the defects listed above.
-
Has packages that are cohesive - do only one thing, but do it well - and are named to reflect their function.
-
Has an Executive that directs program flow without attempting to participate in processing.
-
Has a beginning, where processing inputs are gathered and stored, a middle where inputs are processed, and an end where data is converted to information
for the user.
You build a well crafted architecture by thinking about needs of users, the size and form of program inputs and outputs,
deciding the tasks that are required, providing at least one package for each task, then building the task packages, avoiding
spaghetti coding, using an editorial "red pencil" to simplify and remove baroque structure,
and thinking about errors that could happen and how to avoid or handle them.