1 / 14

Implementation Model: Mapping Designs To Code

Implementation Model: Mapping Designs To Code. Objectives. Map design artifacts to code in an object-oriented language With the completion of interaction diagrams and DCDs for the POS application, there is sufficient detail to generate code for the domain layer of objects.

xuan
Download Presentation

Implementation Model: Mapping Designs To Code

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Implementation Model: Mapping Designs To Code

  2. Objectives • Map design artifacts to code in an object-oriented language • With the completion of interaction diagrams and DCDs for the POS application, there is sufficient detail to generate code for the domain layer of objects

  3. Programming and the Development Process Suggestions: • For a two-week iteration, consider spending at least a half-day doing some visual modeling design work, before programming. Use simple "tools", such as a whiteboard. • Rational Rose is a fast, easy, and convenient, excellent tool to use • A strength of OOA/D and OO programming is that they provide an end-to-end roadmap from requirements through to code. • The various artifacts feed into later artifacts in a traceable and useful manner, ultimately culminating in a running application

  4. Creativity and Change During Implementation • Realistically, the design is an incomplete first step; during programming and testing, changes will be made and detailed problems will be uncovered and resolved • Done well, the design artifacts will provide a resilient core that scales up with elegance and robustness to meet the new problems encountered during programming

  5. Case Study: Map the POS Design to Java Creating Class Definitions from DCDs • DCDs describe the class or interface name, superclasses, method signatures, and simple attributes of a class. Use them to create a basic class definition in an object-oriented programming language

  6. Continue - Add Reference Attributes • A reference attribute is an attribute that refers to another complex object, not to a primitive type such as a String, Number. • The reference attributes of a class are suggested by the associations and navigability in a class diagram

  7. Continue - Create Methods from Interaction Diagrams • An interaction diagram shows the messages that are sent in response to a method invocation

  8. Continue

  9. Continue

  10. Continue

  11. Container/Collection Classes in Code • The choice of collection class is of course influenced by the requirements; key-based lookup requires the use of a Map, a growing ordered list requires a List, and so on

  12. Exceptions and Error Handling • Exception handling has been ignored so far in the development of a solution. This was intentional to focus on the basic questions of responsibility assignment and object design

  13. Order of Implementation • Classes need to be implemented from least-coupled to most-coupled • Ie. from those having least dependencies to having most dependencies

  14. Case Study: Writing the Unit Test Stub for Sale • Beforeprogramming the Saleclass, write a unit testing method in a SaleTestclass that does the following: • 1. Set up a new sale • 2. Add some line items to it • 3. Ask for the total, and verify it is the expected value • Code: public class SaleTest extends TestCase { // ... public void testTotal() { // set up the test Money total = new Money( 7 . 5 ); Money price = new Money( 2 . 5 ); ItemID id = new ItemID( 1 ); ProductSpecification spec; spec = new ProductSpecification( id, price, "product 1" ); Sale sale = new SaleO; // add the items sale.makeLineltern( spec, 1 ); sale.makeLineltern( spec, 2 ); // verify the total is 7 . 5 assertEquals( sale.getTotal(), total); } }

More Related