Modules

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Aside from open/closed modules, what are some other issues to consider for modularity?

- Public interface/private implementation - inter-module dependencies - naming conventions of imported entities - access control - relationship between modules and files

What is a module?

A module consists of a set of names, which can refer to values, types, routines, or other language-specific entities, and possibly other modules

How can a namespace be used?

A namespace is used to declare or define an entity in that usage context (either together, or separately)

What does each module have?

A public interface that defines entities exported by the module.

What is a signature in ML?

A signature specifies an interface for a module.

When does a structure implement a signature?

A structure implements a signature if it defines everything mentioned in the signature

Where are classes visible by default?

By default, all classes in a package are directly visible to each other.

How does Ada protect private portions of a package?

By placing everything public first, then declaring everything after private with a private keyword.

What is transparent signature ascription?

Denoted :, it exposes the identity of types beyond that conveyed in the signature.

What is opaque signature ascription?

Denoted :>, it hides the identity of types beyond that which is conveyed in the signature.

How are packages declared?

Each class explicitly declare the package in which it appears. Otherwise, it defaults to an anonymous package in the current directory.

How are classes organized in Java?

Each class is compiled into separate object files.

How many times can an extern entity be defined?

Each entity can only be defined once, and missing/multiple definitions cant be detected by compiler (link time errors).

What is a package in Java?

In Java, a package correlated to a directory.

What does the keyword Renames do in Ada?

It can be used to make the name of an entity more manageable. package T renames Text_IO;

What does a functor do in ML?

It creates a structure from another structure, allows us to parameterize the structure.

What does the package body do in Ada?

It holds the bodies of the subprogram implemented by that interface.

What is the extern keyword in C++?

It is an external declaration for a variable/function that indicates the the entity is defined elsewhere, either later in the file or in some other file.

What does the keyword Use do in Ada?

It makes the names within that package directly accessible.

What is a structure in ML?

It provides an implementation of a signature/

What is a closed module?

Names must be explicitly imported from the outside module.

In Ada, does the package always require a body?

No, for instance we can have a package that only defines new types.

What is an open module?

Outside names are accessible inside the module without explicit import.

What is the convention for shared interfaces in C++?

Place them in a header file, and simply include that in each file.

What does #include do in C++?

The #include directives means textual substitutions of one file for another.

What does the package structure in Java parallel?

The file system.

What else do we get when we overload the "=" operator in Ada?

There is an implicit definition of "/=" not equals as the negation of "="

How can we solve this problem? Queues ."="( Q1 , Q2 )

This happens hen we haven't made the names of the entity directly accessible. Either import all entities using use, or import only the operators with "use type Queues.Queue.

How do we declare dependencies in Java?

Using the import statement. Must use expanded names, may use a * to indicae importing everything in that package.

How can we shorten names in C++?

Using the namespace keyword: namespace pn = a::long::package::name

What is strong internal coupling?

When a module defines a set of logically related items.

What is weak external coupling?

When a module depends on the entities defined in the interface of another module.

What is the koenig lookup?

When an unqualified

What does the keyword with do in Ada

With tells us what package will be imported in.

What are the three entities related to models in ML?

signature: an interface structure: an implementation functor: parameterized structure

How can we set a default namespace for a file?

using namespace <namespace>; for everything or using <namespace::entity> for a single entity


Set pelajaran terkait

Special Senses Multiple Choice Questions

View Set

Circulation/Oxygenation Practice Quiz for N3

View Set

Placenta Previa and Placenta abruption

View Set

American History 2 Chapter 20 and 21

View Set