OOPortal OOPortal


Structured Programming   «Prev  Next»
Lesson 10

Writing Java Programs Conclusion

In this module, you were introduced to writing programs using the Java programming language. You now have the skills and knowledge necessary to:
  1. Download and install the Java 2 Software Development Kit
  2. Compile a Java program
  3. Run a Java program
  4. Use comments and indentation in a Java program

In the next module you will explore variables, data types, and basic operations in Java.

Writing Programs Correctly

When a beginning programmer writes a program, there is one goal: the program must work correctly. However, correctness is only a part of what makes a program good. Another, equally important part is that the program be maintainable.
Perhaps you have experienced the frustration of installing a new version of some software, only to discover that its performance has degraded and one of the features you depend on no longer works. Such situations occur when a new feature changes the existing software in ways that other features did not expect. Good software is intentionally designed so that these unexpected interactions cannot occur. This module discussed the characteristics of well-designed software and introduces several rules that facilitate its development.

Designing for Change

Software development typically follows an iterative approach. You create a version, let users try it, and receive change requests to be addressed in the next version. These change requests may include bug fixes, revisions of misunderstandings of how the software should work, and feature enhancements.
There are two common development methodologies. In the waterfall methodology, you begin by creating a design for the program, iteratively revising the design until users are happy. Then you write the entire program, hoping that the first version will be satisfactory. It rarely is. Even if you manage to implement the design perfectly, users will undoubtedly discover new features that they hadn’t realized they wanted.

Agile Methodology

In the agile methodology, program design and implementation occur in tandem. You start by implementing a bare-bones version of the program. Each subsequent version implements a small number of additional features. The idea is that each version contains just enough code to make the chosen subset of features work.
Both methodologies have their own benefits. But regardless of which methodology is used, a program will go through several versions during its development. Waterfall development typically has fewer iterations, but the scope of each version change is unpredictable. Agile development plans for frequent iterations with small, predictable changes.
The bottom line is that programs always change. If a program does not work the way users expect then it will need to be fixed. If a program does work the way users expect then they will want it to be enhanced. It is therefore important to design your programs so that requested changes can be made easily, with minimal modification to the existing code. Suppose that you need to modify a line of code in a program. You will also need to modify the other lines of code that are impacted by this modification, then the lines that are impacted by those modifications, and so on. As this proliferation increases, the modification becomes more difficult, time-consuming, and error prone. Therefore, your goal should be to design the program such that a change to any part of it will affect only a small portion of the overall code.