Download Sample

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Chapter Two
1.
A personal finance system might include an Account class, an Investment class, and a
Transaction class. The Account class would have a balance, an interest rate¸ a name,
and many instances of Transaction. There are two possibilities for an inheritance
hierarchy. The Transaction class could have several descendants, such as Charge,
Transfer, Withdrawal, Deposit, and Payment. The Account class could also have
several descendants, including CreditCard, Savings, Checking, and Loan. Instances of
these accounts could interact with each other through the Transfer class.
2.
A waterfall model that includes prototyping would consist of the following steps:
Requirements Analysis, Product Design, System Design, Prototyping, Evaluation by
End-users, Programming, Testing, and Maintenance.
3.
A software development process that uses prototyping as its main technique could
begin with a requirements analysis. From there, developers develop an initial
prototype, creating a very general (possibly only on paper) mock-up of the system for
the end-users to evaluate. Using the first prototype and the users’ evaluation of the
prototype as a basis, developers further analyze the requirements and begin product
and system design. As their knowledge of the system grows, they add detail to the
prototype. When the product and system design is complete and the developers have a
prototype that the end-users are happy with, the developers implement the system.
The process should also include testing and maintenance stages.
4.
Prototyping sparks a dialog between the end-user and the systems analyst. It allows
the analyst to alter the prototype in response the end-user’s comments and
suggestions.
5.
The iterative/incremental development approach is associated with the object-oriented
paradigm because, when used together, the two produce a modular, well-structured,
maintainable system. In an iterative approach, developers can implement a partial
system, present it to end-users, and get valuable feed-back. If the system was
designed with the object-oriented paradigm, the system can evolve smoothly with the
addition of classes, attributes, and methods to implement new functionality. The
developers can then present the evolving system to end-users, and the cycle begins
again.
6.
The use of single inheritance can introduce some redundancy in a class hierarchy. An
example might be a piece of software that keeps track of the operation of a pet store.
The program would have a Animals class and a Merchandise class. Not all animals
in the pet store are for sale, so the AnimalsForSale is a special subclass of the
Animals class, with added attributes like retailPrice, wholeSalePrice, and
salePrice. These are also attributes of the Merchandise class, creating redundancy
among classes.
7.
Well-structured, modular systems consist of modules that are:
a. Cohesive, with well-defined and well-focused functionality and classes with a
clear, easily expressed objective.
b. Loosely coupled, with minimal interconnections.
c. Encapsulated, with data hiding.
d. Reusable, with broad functionality.
8.
In creating reusable modules, designers must keep modules as general as possible,
encompassing extra methods and attributes that will satisfy all anticipated
applications. At the same time, designers must be aware that such a design adds a
great deal of overhead to the system and may not be practical. Designers must also
consider creating classes that operate on general data types, such as Java’s Object
class or the C++ template mechanism.
Maximizing reusability is advantageous because, in the long run, it will save
development time. If classes and operations are general enough to be used in a variety
of situations, then developers do not need to “reinvent the wheel” as they add
functionality to a system. They can reuse modules or extend their functionality
through an inheritance hierarchy without a great deal of effort. Reuse can increase
software maintainability and developer productivity.
9.
There are a number of differences in the object programming constructs for C++ and
Java. One of the major differences is that C++ supports multiple inheritance, while
Java does not. Each indicates inheritance differently – C++ uses the “:” operator to
signify inheritance, while Java uses the keyword extends. C++ allows for dynamic
or static object creation, and calls to the constructor may be implicit. In Java, all
object instantiation is dynamic, and there are no implicit constructor calls for userdefined types. C++ member functions are static by default, while Java methods are
virtual. C++ ?requires? programmers to prototype classes in header files, which
usually include a private section for variable declarations and private member
functions and a public section for public member function signatures. The member
functions are implemented in a separate file, with each function header prefaced by
the class name and the scope operator “::”. Java does not use header files, and all of
the information for the class is stored in a single file. Variable declarations and
function definitions include an access modifier (private, public, or protected)
instead of requiring the programmer to use separate access sections. C++ provides the
delete operator to clean up dynamically allocated objects, while Java has a behind
the scenes garbage collector that cleans up memory when objects go out of scope. To
avoid memory leaks, C++ programmers need to provide a destructor for a class if the
class dynamically allocates memory to objects, another function of Java’s garbage
collector.
Both Java and C++ support dynamic binding and data encapsulation. They also
provide mechanisms to allow the programmer to create very general methods.
C++ programmers may use the template mechanism to create parameterized classes.
Java provides a similar functionality through the Object class. Because all classes
implicitly derive from the Object class, a programmer may substitute an instance of
any class for the more generic Object. I’m sure there is more here, but I can’t think of
anything…
10.
In software development, models are used as a tool to represent a complex system. In
early stages of development, the models are abstract. As developers learn more about
the system, models become more detailed, representing the programmer’s knowledge
of the system.
11.
A unified software modeling notation is important because it is a clear, consistent,
language independent representation of the system to be developed. It enables
developers to easily exchange software models and supports collaborations,
frameworks. Patterns, and components. A unified modeling notation also encourages
the use of object-oriented tools and software engineering practices.
12.
The main feature that distinguishes the object-oriented design process from processoriented design is the object-oriented process’s emphasis on the ability of a software
project to evolve smoothly over each release. While both design processes
incorporate creating modular code, the object-oriented approach focuses on the
extensibility of the modules, while the process-oriented approach is more concerned
with maintenance.
13.
Answers will vary.