Software Engineering for Students A Programming Approach

Software Engineering for Students A Programming Approach Software Engineering for Students A Programming Approach

web.firat.edu.tr
from web.firat.edu.tr More from this publisher
21.08.2013 Views

Exercises 233 This has a number of advantages for the software engineer. The strong type checking ensures that all specifications stay in line with their implementations. Also, it means that once the specification for a class has been compiled, modules which use that class may also be compiled (even before the implementation of the class has been completed). C, C++, C# and Java are all (fairly) small languages and most of their functionality is provided by large and comprehensive libraries. These libraries are separately compiled. Summary It is often convenient to group the classes of a large program into packages. Each package is given a name. Classes within a package can be used by giving the full name of the package and class. A more convenient alternative is to use a statement such as the Java import statement. The classes can be placed in the appropriate package by employing the Java package statement. Scope rules mean that classes within the same package have special access rights to each other. Interfaces are used to describe the services provided by a class. Interfaces are useful for describing the structure of software. This description can be checked by the compiler. Interfaces can also be used to ensure that a class conforms to a particular interface. This supports interoperability. Most modern languages support multiple interfaces, but only support single inheritance. For large software, separate compilation is a vital facility. • Exercises 16.1 Assess the difficulties of developing large-scale software and suggest programming language features to help solve the problems that you have identified. 16.2 The facility to describe interfaces as seen in modern languages enables specification of the services provided by a class. Consider extending such a language so that it also describes: ■ the classes that each class uses ■ the classes that use each class. What would be the advantages and disadvantages of this notation? 16.3 Assess whether and how it would be possible to extend the interface notation to packages. 16.4 The design goals of Ada were readability, strong typing, programming in the large, exception handling data abstraction, and generic units. Explain the meanings of

234 Chapter 16 ■ Programming in the large these objectives and comment on their validity. Assess whether they are complementary or contradictory. If you are familiar with Ada, assess it against these aims. 16.5 Some of the stated design aims for Java are that it should be simple, object-oriented, network-savvy, interpreted, robust, secure, architecture neutral, portable, high-performance and dynamic. Explain the meanings of these objectives. Assess whether they are complementary or contradictory. If you are familiar with Java, assess it against these aims. 16.6 Take a language of your choice. Search out the design aims and explain their meaning. Assess how well the language matches the design aims. Assess the language against the criteria developed in this chapter. 16.7 What aims and what language features would you expect to find in a language designed for each of the following application domains? ■ information systems ■ scientific programming ■ systems programming ■ real-time embedded systems. 16.8 How suitable is your favorite language for each of these application domains? Compare and contrast Ada with C++. 16.9 Compare and contrast C++ with Java. 16.10 Cobol (or Fortran) is an outdated language. Discuss. Answers to self-test questions 16.1 To use class Friday put: import week.Friday; To create an object of the class Friday put: Friday friday = new Friday(); To use all the classes in the package put: import week.*; 16.2 package database; public class Backup

234 Chapter 16 ■ <strong>Programming</strong> in the large<br />

these objectives and comment on their validity. Assess whether they are complementary<br />

or contradictory. If you are familiar with Ada, assess it against these aims.<br />

16.5 Some of the stated design aims <strong>for</strong> Java are that it should be simple, object-oriented,<br />

network-savvy, interpreted, robust, secure, architecture neutral, portable, high-per<strong>for</strong>mance<br />

and dynamic.<br />

Explain the meanings of these objectives. Assess whether they are complementary<br />

or contradictory. If you are familiar with Java, assess it against these aims.<br />

16.6 Take a language of your choice. Search out the design aims and explain their meaning.<br />

Assess how well the language matches the design aims. Assess the language<br />

against the criteria developed in this chapter.<br />

16.7 What aims and what language features would you expect to find in a language<br />

designed <strong>for</strong> each of the following application domains?<br />

■ in<strong>for</strong>mation systems<br />

■ scientific programming<br />

■ systems programming<br />

■ real-time embedded systems.<br />

16.8<br />

How suitable is your favorite language <strong>for</strong> each of these application domains?<br />

Compare and contrast Ada with C++.<br />

16.9 Compare and contrast C++ with Java.<br />

16.10 Cobol (or Fortran) is an outdated language. Discuss.<br />

Answers to self-test questions<br />

16.1 To use class Friday put:<br />

import week.Friday;<br />

To create an object of the class Friday put:<br />

Friday friday = new Friday();<br />

To use all the classes in the package put:<br />

import week.*;<br />

16.2 package database;<br />

public class Backup

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!