Object Oriented Implementation Notes

Programming and Development Process

  • Problem Definition

  • Program Design

  • Coding: Transforming program logic into computer language format.

  • Syntax error: Violates language rules.

    • Logic error: Results in incorrect behavior.

  • Debugging: Discovery and correction of programming errors.

  • Testing: Ensures program performs correctly; includes verification and validation.

    • White box testing

    • Black box testing

  • Documentation: Maintaining records for future reference.

    • Technical Documentation: For programmers, includes program analysis, design, verification, and logs.

    • User’s documentation: User manual for program operation.

  • Maintenance

Iterative Development Process

  • Breaks down software development into smaller chunks with repeated cycles of design, development, and testing.

  • Each iteration adds features until a fully functional application is ready.

  • Key practice in Agile methodologies.

  • Requirements are divided into builds, and each iteration includes requirements, design, implementation, and testing phases.

Object-Oriented Implementation

  • Involves generating code for the domain layer using interaction diagrams & Design Class Diagrams (DCDs).

  • UML artifacts serve as input to the code generation process.

  • Implementation Model contains source code, database definitions, JSP/XML/HTML pages, etc.

Mapping Design to Code

  • Specifies how to translate the design into an object-oriented language.

  • UML is used as input for code generation.

Object Mapping to Database

  • Classes are mapped to database tables, with attributes represented as fields.

  • Primary keys are assigned, and classes may be partitioned horizontally or vertically.

  • Example: CREATETABLECIRCLE(CIDVARCHAR2(4)PRIMARYKEY,XCOORDINTEGERNOTNULL,YCOORDINTEGERNOTNULL,ZCOORDINTEGERNOTNULL,COLOR);CREATE TABLE CIRCLE(CID VARCHAR2(4) PRIMARY KEY, X_COORD INTEGER NOT NULL, Y_COORD INTEGER NOT NULL, Z_COORD INTEGER NOT NULL, COLOR);

Mapping a Single Class to Code

  • Attributes: "id", "name", "color"

  • Operations: "setname(String)", "getname()", "bark()", "getid()", "setid (Integer)", "getcolor()", "setcolor(String)"

Characteristics of Object Design Activities

  • Objects are abstractions that manage themselves, are independent, and encapsulate state.

  • System functionality is expressed via object services.

  • Objects communicate through message passing and may be distributed.

Model-Based Software Engineering (MBSE)

  • Uses formal, composable models throughout the product lifecycle.

  • Modeling languages are domain-specific, offering concepts tailored to application domains.

  • MBSE supports requirements, design, analysis, verification, and validation of complex systems.

  • Components of Model: Conceptual, Logical, Operational, Physical

Transformations

  • Model transformation: Automated modification of models.

    • Principles: single criteria, local, isolation, validation.

  • Forward engineering: Building from high-level models to detailed implementations.

  • Reverse engineering: Extracting design information from code.

  • Refactoring: Improving internal code structure without changing external behavior.

    • Reasons: improves design, enhances understanding, helps find bugs, accelerates development.

Creating Class Definitions from Design Class Diagrams

  • Design Class Diagrams (DCDs) with class names, superclasses, operation signatures, and attributes are sufficient for creating basic class definitions.

  • UML tools can generate basic class definitions from diagrams.

Defining a class with method signatures and attributes

  • Method Signature is the combination of a method's name and its parameter list.

  • A class cannot have two methods with the same signature.

  • Method signature does not include the return type of a method.

Reference Attributes and Roles Names

  • Describes the structure and behavior of classes.

Exceptions and Error Handling

  • Exception: Notification of an interruption in normal program execution.

  • Categories include built-in, checked, unchecked, and user-defined exceptions.

Types of Exceptions

  • Checked Exception: Exceptions that are checked by compiler.

  • Unchecked Exception: Exception condition is not checked by compiler.

Exception Hierarchy

  • Exceptions are classes that can be inherited to build hierarchies.

  • Allows centralized error processing and handling of multiple errors in one place.

Exception Handling Model

  • try block (Detects and throws)

  • catch block (catches and handles)

  • throw Block an exception is thrown to a particular catch block using throw keyword.