When electrical engineers design new printed circuit boards, they go to a catalog of available integrated circuits to select the most appropriate components. When architects design homes, they go to catalogs of prefabricated doors, windows, moldings, and other components. All this is called "engineering." Software engineers usually reinvent components over and over again; they rarely salvage existing software components. It is interesting that the software industry calls this rare practice "reuse" rather than "engineering."
Jerry Yoakum's thoughts on software engineering and architecture from experience working with code, computer science, python, java, APIs, NASA, data mining, math, etc.
Tuesday, April 25, 2017
Don't Reinvent the Wheel
When electrical engineers design new printed circuit boards, they go to a catalog of available integrated circuits to select the most appropriate components. When architects design homes, they go to catalogs of prefabricated doors, windows, moldings, and other components. All this is called "engineering." Software engineers usually reinvent components over and over again; they rarely salvage existing software components. It is interesting that the software industry calls this rare practice "reuse" rather than "engineering."
Labels:
architecture,
design,
Seattle,
software-engineering
Location:
Seattle, WA, USA
Sunday, January 15, 2017
Magic Square Corollary
The following definition for a Magic Square series is from the EDU-BLOG:
In recreational mathematics, a magic square of order ‘n’ is an arrangement of n2 numbers, usually distinct integers, in a square, such that the n numbers in all rows, all columns, and both diagonals sum to the same constant. A normal magic square contains the integers from 1 to n2. The term “magic square” is also sometimes used to refer to any of various types of word square.
The constant sum in every row, column and diagonal is called the magic constant or magic sum, M. The magic constant of a normal magic square depends only on n and has the value
Thus the magic square series is like this: 1, 5, 15, 34, 65, 111, 175, 260…
Often when I want to practice programing I'll write some code to calculate some interesting mathematical number or series. Recently I picked the magic square series. When I finished I noticed that for each order of magnitude beyond n = 20 there was a pattern.
Magic Square Corollary
for y = 0 to ∞
n
|
M(n)
|
20 | 4,010 |
200 | 4,000,100 |
2,000 | 4,000,001,000 |
20,000 | 4,000,000,010,000 |
... | ... |
This was done solely for the enjoyment of playing around with some numbers. I used Roger's Online Equation Editor to make the above equation image. Very handy tool.
Next I noticed that any value of n = 10, 20, 30, ..., 90 can have the above equation applied to it. For example, n = 10:
M(10) = 505
Split 505 at the two least significant digits. Maintain the order of the left half to get 500 and 5. Then apply those values on the left and right of the plus sign, as so:
M(n) = M(10 * 10^y) = 500*10^(3y)+5*10^y
M(100) = 500,050
M(1,000) = 500,000,500
...
M(90) = 364,545
M(n) = M(90 * 10^y) = 3,645*10^(3y)+45*10^y
M(900) = 364,500,450
M(9,000) = 364,500,004,500
...
Saturday, January 07, 2017
Avoid Numerous Special Cases
There are often exceptional situations to an algorithm's design. Exceptional situations cause special cases to be added to the algorithm. Every special case makes it more difficult to debug, modify, maintain, and enhance an algorithm.
If you find too many special cases, you probably have an inappropriate algorithm. Rethink and redesign the algorithm.
Labels:
architecture,
design,
software-engineering
Location:
Springfield, MO, USA
Wednesday, December 14, 2016
Minimize Intellectual Distance
Edsger Dijkstra defined intellectual distance as the distance between the real-world problem and the computerized solution to that problem. Richard Fairley argues that the smaller the intellectual distance, the easier it will be to maintain the software.
To do this, the structure of the software should as closely as possible mimic the structure of the real world. You can minimize intellectual distance using any design approach. Be aware that the structure of the real-world is not unique. As pointed out so well by Jawed Siddiqi in his March 1994 article in IEEE Software, entitled "Challenging Universal Truths of Requirements Engineering," different people often perceive different structures when examining the same thing and thus construct quite diverse constructed realities.
Labels:
architecture,
design,
software-engineering
Location:
Springfield, MO, USA
Keep Design Under Intellectual Control
A design is under intellectual control if it has been created and documented in a manner that enables its creators and maintainers to fully understand it.
An essential attribute of such a design is that it is constructed hierarchically and with multiple views. Hierarchies enable readers to comprehend the entire system abstractly, and then comprehend finer and finer levels of details as they move down the hierarchy. At each level the component should be described from an external point of view only. Furthermore, any single component (at any level in the hierarchy) should exhibit simplicity and elegance.
Labels:
architecture,
design,
software-engineering
Location:
Springfield, MO, USA
Wednesday, November 23, 2016
Maintain Conceptual Integrity
Conceptual integrity is an attribute of a quality design. It implies that a limited number of design "forms" are used and that they are used uniformly. Design forms include the way components inform their callers of error conditions, how the software informs users of error conditions, how data structures are organized, mechanisms for component communication, documentation standards, and so on.
When a design is complete, it should look as if one person created it all, even though it is the product of many devoted people. During the design process, there are often temptations to diverge from accepted forms. It is okay to give in to such temptations if the justification is for additional integrity, elegance, simplicity, or performance of the system. It is not okay to give in solely to ensure the designer x has left his mark on the design. Ego satisfaction is not as important as conceptual integrity.
Labels:
architecture,
design,
software-engineering
Location:
Springfield, MO, USA
Saturday, November 19, 2016
Conceptual Errors Are More Significant Than Syntactic Errors
When creating software, whether writing requirements specifications, design specifications, code, or tests, considerable effort is made to remove syntactic errors. This is laudable. However, the real difficulty in constructing software comes from conceptual errors. Syntactic errors often look like silly mistakes that can be laughed off. In contrast, developers often feel flawed, or incompetent, when a conceptual error is located. No matter how good you are, you will make conceptual errors. Look for them.
Ask yourself key questions throughout the development process.
- When you read the requirements ask yourself, "Is this what the customer really wants?"
- While you are designing a solution, "Will this architecture behave appropriately under stress?" or "Does this algorithm really work in all situations?"
- During coding, "Does this code do what I think it does?" or "Does this code correctly implement the algorithm?"
- During test, "Does the execution of this test convince me of anything?"
Reference:
Brooks, F., "No Silver Bullet: Essence and Accidents of Software Engineering," IEEE Computer, April 1987.
Labels:
architecture,
design,
software-engineering
Location:
Springfield, MO, USA
Friday, November 18, 2016
Use Coupling and Cohesion
Coupling and cohesion were defined in the 1970s by Larry Constantine and Edward Yourdon. They are the best ways we know of measuring the inherent maintainability and adaptability of a software system. In short, coupling is a measure of how interrelated two software components are. Cohesion is a measure of how related the functions performed by a software component are. We want to strive for low coupling and high cohesion. High coupling implies that, when we change a component, changes to other components are likely. Low cohesion implies difficulty in isolating the causes of errors or places to adapt to meet new requirements. Constantine and Yourdon even provided a simple-to-use way to measure the two concepts. Learn it. Use the measure to guide your design decisions.
You want:
- low coupling
- high cohesion
The image above is a special forces team that gives an alternative example of low coupling with high cohesion. The sniper team is another such example.
Labels:
architecture,
design,
software-engineering
Location:
Springfield, MO, USA
Thursday, November 17, 2016
Design for Change
During software development, we regularly uncover errors, new requirements, or the results of earlier miscommunications. All these cause the design to change even before it is baselined. Which should be expected - change during development is inevitable. Bersoff, Henderson, and Siegel defined the first law of system engineering as,
No matter where you are in the system life cycle, the system will change, and the desire to change it will persist throughout the life cycle.Furthermore, after baselining the design and delivering the product, even more new requirements will appear. All this means that you must select architectures, components, and specification techniques to accommodate major and incessant change.
To accommodate change, the design should be:
- Modular - composed of independent parts that can be easily upgraded or replaced with a minimum of impact on other parts.
- Portable - easily altered to accommodate new host machines and operating systems.
- Malleable - flexible to accommodate new requirements that had not been anticipated.
- Of minimal intellectual distance.
- Edsger Dijkstra defined intellectual distance as the distance between the real-world problem and the computerized solution to that problem. Richard Fairley argues that the smaller the intellectual distance, the easier it will be to maintain the software.
- Under intellectual control.
- A design is under intellectual control if it has been created and documented in a manner that enables its creators and maintainers to fully understand it.
- Such that it exhibits conceptual integrity.
- Conceptual integrity is an attribute of a quality design. It implies that a limited number of design "forms" are used and that they are used uniformly. When a design is complete, it should look as if one person created it all, even though it is the product of many devoted people.
* Image taken from http://www.greenville-home-remodeling.com/010-greenville-home-remodel-rare-design-before-and-after-kupersmith-front-elevation/. If you like it, check out the cool remodels they do.
Labels:
architecture,
design,
software-engineering
Location:
Springfield, MO, USA
Wednesday, November 16, 2016
Design for Maintenance
The largest post-design cost risk for non-software products is manufacturing. This makes design for manufacturability is a major design driver.
The largest post-design cost risk for software products is maintenance. Unfortunately, design for maintainability is not the standard for software. People often ask what software maintenance is and they'll joke that you don't have to grease code. Well, you don't have to literally grease code but figuratively greasing code to ensure that it is easy and quick to change does need to happen.
For example, at my workplace Apache Ant was a primary build tool. It has been replaced with Gradle and as a consequence when development teams have to work on a service that is built with Ant they complain. The maintenance work here would be to change the build code from ANT to Gradle to ensure that work is easy and quick. Of course, whether to make that change depends on whether that service is getting modified often enough to justify the cost. The architectural question is was this service designed in such a way that changing the build code to use a different build tool easy. We approached this by ensuring that the service's build code was loosely coupled to the service source code.
A designer has the responsibility to select an optimal software architecture to satisfy the requirements. Obviously, the appropriateness of this architecture will have a profound effect on system performance. However, the selection of this architecture also has a profound effect on the maintainability of the final product. Specifically, architecture selection is more significant than algorithms or code as far as its effect on maintainability.
Labels:
architecture,
design,
software-engineering
Location:
Springfield, MO, USA
Subscribe to:
Posts (Atom)