300 likes | 428 Views
Some Principles of Software Development . Chapter 2. Intellectual control. Maintaining control of the concept in one’s mind. Complexity makes it difficult. Use of natural language makes it difficult. Complexity and control.
E N D
Some Principles of Software Development Chapter 2
Intellectual control • Maintaining control of the concept in one’s mind. • Complexity makes it difficult. • Use of natural language makes it difficult.
Complexity and control • There is a maximum amount of complexity the mind can handle before it loses the ability to grasp the situation. • Organization along several lines can help the mind build a “model” of the concept or problem that helps maintain control. • “Abstraction” can be a necessary by-product of this process.
Language betrays us • Natural language is very good at expressing concepts at a high level of abstraction (fuzziness). • Natural language serves the mind by “lumping” concepts together in “fuzzy” categories. • However, “fuzzy” categories do not serve the process of problem definition, so natural language makes things ambiguous…and that tendency works against our efforts to create a clear description of the problem!
Divide and conquer • Defining categories that provide clear and definite boundaries between problem elements can help us categorize the problem. • So, we can divide the problem into a set of smaller, loosely related problems which we can solve.
Independent parts • In order to divide the problem set into parts, we need to minimize the dependencies between the “smaller” problems. • Although the smaller problems are still really dependent on each other, the objective is to minimize dependency so they can be treated “as if” they were independent…with reasonable comfort.
7 ± 2 rule Early studies by the phone companies showed that the human mind was able to grasp seven (plus or minus two) concepts at once. Hence, phone numbers became seven digits long. But even then, they were divided into additional groups of three and four (such as 682-3572), and area codes were later tacked on as an additional group of three.
7 ± 2 rule (cont’d) The upshot of this principle is that any elements of a problem (or solution) should be organized in such a way that the mind can easily grasp it, implying that groups of five to nine elements are the best way to decompose (or compose) things.
Hierarchies Since the 7 ± 2 rule implies that large groups of things are a problem for intellectual control, we can create subgroups of the larger group to hold them. This notion of “subgroups” provides a conceptual hierarchy, which makes it easier for the mind to process. This notion can be modeled using a “tree” structure.
Know when to stop • Since we can divide groups into subgroups, and subgroups into sub-subgroups, and sub-subgroups into sub-sub-subgroups, it’s important to know when to stop. • If we add too much detail, more than is needed to grasp the problem or solution, we have needlessly taxed the mind, and created additional maintenance tasks that pose a risk later on in the process. It’s important to go just far enough and no farther!
Identify the “customers” • One of the best ways to gauge if we’ve gone far enough is to understand who will be using the work that we are doing, and what they will be using it for. • If the work product is targeted to make the “customer’s” job easier, then it’s easier to have an idea of what information is needed, and what is not. For instance, design documents need to be targeted towards giving implementers (and other designers) what they need to do their jobs.
Fuzzy into focus • During the process of software engineering, the engineer is taking a “fuzzy”, poorly defined product, and bringing it into focus. • Each step of the software engineering process should systematically add a level of detail to what is known, bringing a fuzzy notion into sharp focus over time.
Document it! • Information and decisions are important elements in the software engineering process. As information is obtained, it should be recorded! • Even when engineers discover that they don’t know something, they record it as something that is undecided, usually by annotating an entry as “TBD” (to be decided)! • Engineers can use “TBDs” to manage the unknown as equally well as the known.
Record it or it's lost • Since engineers are adding information and detail (“focus”), and since the 7 ± 2 rule shows us there’s a limit to what can be retained, engineers must document what is learned and decided!
Know what you've assumed • Many things that seem intuitive or obvious actually are not. As a result, it is very important to list the obvious assumptions along with other information. • Assumptions are important parts of any solution, but they should be ‘called out’.
Traceability • Information is often “derived”. For instance, the design is derived from the specifications. • If some of this “derived” information is called into question, it’s important to know what it was derived from. • Also, if a requirement changes, it’s important to know what was derived from that requirement so it can be checked! • Traceability “tags” information to show it’s “heritage”
A place for everything and everything in its place • Information should (when possible) be stored in a single, appropriate place. • Information can be stored in the proper place regardless of the phase: if important design details are discovered during the requirements phase it should be stored in an appropriate place in the design documents!
Documentation isn't a novel • The purpose of software engineering documentation is to communicate facts. • Documentation, regardless of how seemingly tedious, should communicate facts simply and directly.
Input/output is the essence of software • Software transforms a set of inputs into a set of outputs. • The definition of what outputs should be expected for a set of inputs is essentially the requirements. • The definition of the transform particulars (how it operates) is essentially the design.
Too much engineering is not a good thing • It is possible to “engineer a product to death”: time and quality are both essential! • Engineering something to perfection can require so much time that it becomes obsolete before it is completed. • Quality is essential! However, know what quality is! To use an idiom: “Don’t build a solid-gold hammer!”
If it ain't broke don't fix it • Defects should be fixed, but addition of a function that is not required can introduce complexity. • Complexity in turn, can introduce defects. • Strive for simplicity, or “elegance”.
The “creeping feature creature” • Often, features are “invented” by enthusiastic engineers. • More often, features are added at a late date by enthusiastic marketers. • New features should be added when needed, but accepting new features late can open a floodgate of new feature requests! • Each new feature may seem small, but engineers can end up being “nibbled to death by ducks.”
Expect to deal with change • New features are a fact of life. Competitors introduce new features during development cycles that can change cash customer’s expectations of the products under development. • Ignoring the cash customer’s expectations is not a good idea: no one buys the product, regardless of how well-engineered it is.
Plan for it • Since feature ‘creep’ is a fact of life, software engineering should be prepared to deal with late additions and changes. • The process used to build software should accommodate a reasonable level of change without “breaking.”
Fix it now • When problems are discovered, it is best to fix them ASAP (as soon as possible). • The reason? As more and more “derived” information is developed from the “incorrect” information, there becomes much more to fix!
Re-use past work • Past work has (hopefully) already been analyzed, documented, discussed and even debugged! • As a result, when building specifications, designs, tests or code, it is prudent to keep in mind how it might be used in the future.
Previous work well done is golden • Previous work is an asset, if it has been done well. • Re-usable work saves effort, therefore, it saves time. • Time is money.
Create software so that reuse is possible • If specifications, design, tests or code is to be reused, then it should have a tendency toward being “generic”. • It should also be well documented so that it is easy for other engineers to use it, since we aren’t the only ones that could benefit from re-using our engineering products!
Don't reinvent the wheel • If other engineers could be re-using our code and specifications, why shouldn’t we use theirs? • Don’t fall victim to the “Not invented here” syndrome: often other teams code or ideas are quite usable. Don’t be a code bigot! • “Don’t build what you can buy.”
Take responsibility • The quality of the product and the safety of the customer is ultimately the responsibility of every engineer on the project. • If you discover a problem, even if it is not in your assigned area, take responsibility for seeing that it gets corrected!