Review Questions
- What is an algorithm?
A. An algorithm is an organized statement of a how a specific problem or questions will be solved. A well-designed algorithm presents a step-by-step process that leads to the solution to the problem.
- What are the five programming steps?
A. The five programming steps are Initialization, Input, Processing, Output, and Cleanup.
- What does sideways refinement mean?
A. Each of the five programming steps represents a macro view of a program. For example, the Input step might require getting data from the keyboard, and then reading a setup table from a database, and finally reading more information from a different database. A sideways refinement is the process in which you take a programming step, such as the Input step, and add more and more detail as you move from the macro view of the step to the micro details that get the job done. For example:
Input Step->ReadKeyboard()
ReadSetupTable()->ReadTable1()->(Code)
ReadTable2()
ReadTable3()
Each movement toward the right adds more and more detail to the task at hand. Ultimately, the sideways refinement stops when the actual code for a function is written for the task at hand.
-
What is UML and why is it beneficial?
A. UML stands for Unified Modeling Language. The benefit of UML is that it forces you to think about programming problems in an organize fashion using OOP techniques. The basic building blocks of UML are the class, its attributes, and its methods. UML class diagrams bring all three of these OOP elements into one convenient diagram.
-
In terms of OOP, what does it mean when we say that some object's attribute is either Public or Private?
A. The terms Public and Private in OOP refer to the access that is afforded to the object's attribute. If an attribute is Private, it can be changed only using the means provided by the class to which it belongs. If the attribute is Public, any other object has full access to the attribute, including the capability to change its value. The idea behind encapsulation is to make all data as private as possible to prevent contamination by outside agents.