0% found this document useful (2 votes)
3K views

Mapping Design To Code

This document discusses mapping design to code by: - Implementing classes and interfaces in an object-oriented language which requires writing source code definitions. - Adding reference attributes that refer to other complex objects based on associations and navigability in class diagrams. - Creating method definitions by translating the sequence of messages in interaction diagrams to statements. - Using container/collection classes like ArrayList to maintain relationships where a class has a multiplicity greater than one. - Implementing least-coupled classes first and moving to most-coupled. - Engaging in test-first development by writing unit tests before code.

Uploaded by

Sri Maan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (2 votes)
3K views

Mapping Design To Code

This document discusses mapping design to code by: - Implementing classes and interfaces in an object-oriented language which requires writing source code definitions. - Adding reference attributes that refer to other complex objects based on associations and navigability in class diagrams. - Creating method definitions by translating the sequence of messages in interaction diagrams to statements. - Using container/collection classes like ArrayList to maintain relationships where a class has a multiplicity greater than one. - Implementing least-coupled classes first and moving to most-coupled. - Engaging in test-first development by writing unit tests before code.

Uploaded by

Sri Maan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 22

Mapping design to code

-Programming and iterative,evolutionary development -creativity and change during implementation -Implementation in an object oriented language requires writing source code for Class and interface definitions,method definitions

Click to edit Master subtitle style

4/8/12

DCD-Design Class Diagram

4/8/12

4/8/12

4/8/12

Adding Reference Attributes

A reference attribute is an attribute that refers to another complex object, not to a primitive type such as a String, Number, and so on. The reference attributes of a class are suggested by the associations and navigability in a class diagram.
4/8/12

4/8/12

Creating Methods from Interaction Diagrams


An interaction diagram shows the messages that are sent in response to a method invocation. The sequence of these messages translates to a series of statements in the method definition. The enterltem interaction diagram in Figure 20.6 illustrates the Java definition of the enterltem method. In this example, the Register class will be used. A Java definition is shown in Figure 20.7.

4/8/12

4/8/12

4/8/12

4/8/12

Container/Collection Classes in Code


It is often necessary for an object to maintain visibility to a group of other objects; the need for this is usually evident from the multiplicity value in a classdiagram It may be greater than one. For example, a Sale must maintain visibility to a group of SalesLineltem instances.

In OO programming languages, these relationships are often implemented with the introduction of a intermediate container or collection.

The one-side class defines a reference attribute pointing to a For example, the Java libraries contain collection classes container/collection instance, which contains instances of the such as ArrayList and HashMap, which implement the List many-side class. and Map interfaces, respectively.

Using ArrayList, the Sale class can define an attribute that maintains an ordered list ofSalesLineltem instances.

4/8/12

4/8/12

Defining the Sale-makeLineltem Method

4/8/12

Order of Implementation
Classes need to be implemented (and ideally, fully unit tested) from least-coupled to mostcoupled .

For example, possible first classes to implement are either Payment or ProductSpecification; next are classes only dependent on the prior implementations ProductCatalog or SalesLineltem.

4/8/12

4/8/12

Test-First Development/Test Driven


In this practice, unit testing code is written before the code to be tested, and the developer writes unit testing code for all production code. actually get written The unit tests
Programmer satisfaction

Clarification of interface and behavior

Provable verification

The confidence to change things

4/8/12

Introduction to the Program SolutionNextGen POS

4/8/12

4/8/12

4/8/12

4/8/12

4/8/12

4/8/12

You might also like