0% found this document useful (0 votes)
6 views11 pages

Chapter 4 Implementation

The document outlines the implementation phase of a programming project, focusing on mapping design to code, creating class definitions, and handling exceptions. It emphasizes the importance of translating object-oriented designs into executable code using various programming languages. Additionally, it discusses the structure of method signatures and the role of attributes in class relationships.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views11 pages

Chapter 4 Implementation

The document outlines the implementation phase of a programming project, focusing on mapping design to code, creating class definitions, and handling exceptions. It emphasizes the importance of translating object-oriented designs into executable code using various programming languages. Additionally, it discusses the structure of method signatures and the role of attributes in class relationships.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Implementation

Chapter 4
Overview
• Programming and Development phase
• Mapping Design to code
• Creating Class Definitions from Design Class Diagrams
• Creating Methods from Collaboration Diagram
• Updating Class Definitions
• Classes in codes
• Exception and Error Handling

2/25/2026 PRESENTATION TITLE 2


Implementation
• The system can be implemented through codes.

• The output of the object oriented design can be mapped into


code for its implementation.

2/25/2026 PRESENTATION TITLE 3


Mapping Designs to Code
• Implementation artifacts include the source code, database
definitions, JSP/XML/HTML pages, and so on which can be
termed as implementation model.
• Language samples: Java, Python, C#,etc.
• Mapping Design to code:
• Class and Interface Definition
• Method Definition

4
1. (Class with Method Signatures and Attributes)

2/25/2026 PRESENTATION TITLE 5


• A method signature is the name of the method and
its parameters (the type and number of inputs it
takes).

• It does NOT include the method body (the code


inside)

2/25/2026 PRESENTATION TITLE 6


2. Reference Attribute and Role Names
• Role names may be used to generate instance variable names.

2/25/2026 PRESENTATION TITLE 7


Example:
•Main class: SalesLineItem
•Related class: ProductSpecification
Here, A SalesLineItem uses or refers to a
ProductSpecification.
• ProductSpecification is the related class because it helps
SalesLineItem.

If You buy 3 chocolates.


•The chocolate details (price, description) are stored in
ProductSpecification.
•The quantity (3) is stored in SalesLineItem.
Subtotal = quantity × price
8
“Role names may be used to generate instance
variable names.”
• SalesLineItem —— Described-by ——>
ProductSpecification
• Here, Described-by is the role name.

• private ProductSpecification Describedby;


As hyphen (-) is NOT used in Java class names,
function names, or variable names. So Described-by is
written as Describedby.

OR, private ProductSpecification productSpecification; 9


2/25/2026 10
Exceptions And Error Handling
• Using try, catch, throw and finally exceptions.
• The "normal" code is put in try block
• If the system succeeds to run the code, everything is fine.
• If something goes wrong, throws an exception object and stops
executing the code of try block further.
• Make necessary actions needed in that error situation.
Execution continues with the next statement following the
catch blocks
• The exception object can contain information about the
exception, so that the error handling part of the program can
examine the reason and make appropriate actions.
2/25/2026 11

You might also like