Designing applications 6.0. 2 Main concepts to be covered Discovering classes CRC cards Designing interfaces Patterns © 2017 Pearson Education, Inc. Hoboken,

Slides:



Advertisements
Similar presentations
Comp1004: Object Oriented Design II Designing Applications Based on BlueJ Chapter 13.
Advertisements

COMP 121 Week 7: Object-Oriented Design and Efficiency of Algorithms.
Design Patterns Section 7.1 (JIA’s) Section (till page 259) (JIA’s) Section 7.2.2(JIA’s) Section (JIA’s)
OOAD Using the UML - Use-Case Analysis, v 4.2 Copyright  Rational Software, all rights reserved 1/18 Use Case Analysis – continued Control Classes.
Introduction To System Analysis and Design
Objects First With Java A Practical Introduction Using BlueJ Designing object-oriented programs How to write code in a way that is easily understandable,
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 5: Restaurant.
Designing applications Software Engineering from a Code Perspective.
Lecture 4 Class Responsibility Collaboration Cards
Spring 2010CS 2251 Design Patterns. Spring 2010CS 2252 What is a Design Pattern? "a general reusable solution to a commonly occurring problem in software.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Design Patterns.
Object-Orientated Design Unit 3: Objects and Classes Jin Sa.
Chapter 8 Object Design Reuse and Patterns. Finding Objects The hardest problems in object-oriented system development are: –Identifying objects –Decomposing.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Pattern Abstract Factory
Introduction To System Analysis and design
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 12 Object-Oriented Design.
Design Patterns.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 12 Object-Oriented.
Design patterns. What is a design pattern? Christopher Alexander: «The pattern describes a problem which again and again occurs in the work, as well as.
Designing applications Main concepts to be covered Discovering classes CRC cards Designing interfaces Patterns Objects First with Java - A Practical.
Big Java Chapter 12. Software Process - Waterfall Analysis Design Implementation Testing Deployment Does not work well when rigidly applied! established.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 4th Edition Copyright © 2012 John Wiley & Sons, Inc. All rights.
Objects First With Java A Practical Introduction Using BlueJ Designing applications 1.0.
Introduction To System Analysis and Design
CSC 211 Introduction to Design Patterns. Intro to the course Syllabus About the textbook – Read the introduction and Chapter 1 Good attendance is the.
Creational Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
11 Partnership for Performance How to hear this lecture Click on the icon: to hear the narration for each slide.
Review: Cohesion and Coupling, Mutable, Inheritance Screen Layouts Software methodologies – Extreme Programming Object-Oriented Design – CRC Cards - UML.
Slide 1 Structural Modeling Chapter 7. Slide 2 Key Ideas A structural or conceptual model describes the structure of the data that supports the business.
Approaching a Problem Where do we start? How do we proceed?
CS3773 Software Engineering Lecture 04 UML Class Diagram.
Design Patterns CSCI 5801: Software Engineering. Design Patterns.
Design Patterns Gang Qian Department of Computer Science University of Central Oklahoma.
Design Patterns CS 124 Reference: Gamma et al (“Gang-of-4”), Design Patterns.
1 What is OO Design? OO Design is a process of invention, where developers create the abstractions necessary to meet the system’s requirements OO Design.
Design Principle & Patterns by A.Surasit Samaisut Copyrights : All Rights Reserved.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved COS240 O-O Languages AUBG,
Design Patterns -- Omkar. Introduction  When do we use design patterns  Uses of design patterns  Classification of design patterns  Creational design.
Designing applications Main concepts to be covered Discovering classes CRC cards Designing interfaces Patterns Objects First with Java - A Practical.
SWE 316: Software Design and Architecture – Dr. Khalid Aljasser Objectives Lecture 13 Creational Design Pattern SWE 316: Software Design and Architecture.
Copyright © Active Frameworks Inc. - All Rights Reserved - V2.0Design Pattern Catalog - Page L3-1 PS95&96-MEF-L10-1 Dr. M.E. Fayad Creationa.
Sadegh Aliakbary. Copyright ©2014 JAVACUP.IRJAVACUP.IR All rights reserved. Redistribution of JAVACUP contents is not prohibited if JAVACUP.
Chapter 17 – Object- Oriented Design. Chapter Goals To learn about the software life cycle To learn about the software life cycle To learn how to discover.
Software Design Patterns Curtsy: Fahad Hassan (TxLabs)
Designing Classes CS239 – Jan 26, Key points from yesterday’s lab  Enumerated types are abstract data types that define a set of values.  They.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Internet and Intranet Protocols and Applications Lecture 5a: HTTP Client-Server Design and Implementation February 15, 2005 Arthur Goldberg Computer Science.
Design Reuse Earlier we have covered the re-usable Architectural Styles as design patterns for High-Level Design. At mid-level and low-level, design patterns.
Design Patterns Introduction
Software Engineering Principles Practical Advice and Steps for Managing Your Project.
CMSC 345 Fall 2000 OO Design. Characteristics of OOD Objects are abstractions of real-world or system entities and manage themselves Objects are independent.
Slide 1 Systems Analysis and Design with UML Version 2.0, Second Edition Alan Dennis, Barbara Haley Wixom, and David Tegarden Chapter 7: Structural Modeling.
CLASSIFICATION OF DESIGN PATTERNS Hladchuk Maksym.
A case study Whole-application development The case study A taxi company is considering expansion. –It operates taxis and shuttles. Will expansion.
1 Lecture Material Design Patterns Visitor Client-Server Factory Singleton.
Software Development Life Cycle. The Software Life Cycle  Encompasses all activities from initial analysis until end of work  Formal process for software.
An informal, team oriented, OO design system
Objects First with Java A Practical Introduction using BlueJ
Chapter 5: Structural Modeling
Chapter 10 Design Patterns.
MPCS – Advanced java Programming
Introduction to Design Patterns
Reference: COS240 Syllabus
Advanced Programming Behnam Hatami Fall 2017.
Slides by Steve Armstrong LeTourneau University Longview, TX
Design Patterns Imran Rashid CTO at ManiWeber Technologies.
Chapter 8, Design Patterns Introduction
Presentation transcript:

Designing applications 6.0

2 Main concepts to be covered Discovering classes CRC cards Designing interfaces Patterns © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved.

3 Analysis and design A large and complex area. The verb/noun method is suitable for relatively small problems. CRC cards support the design process. –Class –Responsibilities –Collaborators © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved.

4 The verb/noun method The nouns in a description refer to ‘things’. –A source of classes and objects. The verbs refer to actions. –A source of interactions between objects. –Actions are behavior, and hence methods. © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved.

5 A problem description (1) The cinema booking system should store seat bookings for multiple theaters. Each theater has seats arranged in rows. Customers can reserve seats and are given a row number and seat number. They may request bookings of several adjoining seats. © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved.

6 A problem description (2) Each booking is for a particular show (i.e., the screening of a given movie at a certain time). Shows are at an assigned date and time, and scheduled in a theater where they are screened. The system stores the customer’s phone number. © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved.

7 Nouns and verbs © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved. Cinema booking system Stores (seat bookings) Stores (phone number) Seat booking Theater Has (seats) Seat Row Customer Reserves (seats) Is given (row number, seat number) Requests (seat booking) Row number Seat numberShow Is scheduled (in theater) Movie DateTime Telephone number

8 Using CRC cards First described by Kent Beck and Ward Cunningham. Each index card records: –A class name. –The class’s responsibilities. –The class’s collaborators. © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved.

9 A CRC card © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved. Class name Collaborators Responsibilities

10 Scenarios An activity that the system has to carry out or support. –Sometimes known as use cases. Used to discover and record object interactions (collaborations). Can be performed as a group activity. © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved.

11 A partial example © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved. CinemaBookingSystem Collaborators Can find shows by title and Show day. Stores collection of shows. Collection Retrieves and displays show details....

12 Scenarios as analysis Scenarios serve to check the problem description is clear and complete. Sufficient time should be taken over the analysis. The analysis will lead into design. –Spotting errors or omissions here will save considerable wasted effort later. © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved.

13 Class design Scenario analysis helps to clarify application structure. –Each card maps to a class. –Collaborations reveal class cooperation/object interaction. Responsibilities reveal public methods. –And sometimes fields; e.g., “Stores collection...” © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved.

14 Designing class interfaces Replay the scenarios in terms of method calls, parameters and return values. Note down the resulting headers. Create outline classes with public- method stubs. Careful design is a key to successful implementation. © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved.

15 Documentation Write class comments. Write method comments. Describe the overall purpose of each. Documenting now ensures that: –The focus is on what rather than how. –That it doesn’t get forgotten! © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved.

16 Cooperation Team-working is likely to be the norm not the exception. Documentation is essential for team working. Clean O-O design, with loosely- coupled components, also supports cooperation. © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved.

17 Prototyping Supports early investigation of a system. –Early problem identification. Incomplete components can be simulated. –E.g., always returning a fixed result. –Avoid random behavior which is difficult to reproduce. © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved.

18 Software growth Waterfall model. –Analysis –Design –Implementation –Unit testing –Integration testing –Delivery No provision for iteration. © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved.

19 Iterative development Use early prototyping. Frequent client interaction. Iteration over: –Analysis –Design –Prototype –Client feedback A growth model is the most realistic. © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved.

20 Using design patterns Inter-class relationships are important, and can be complex. Some relationships recur in different applications. Design patterns help clarify relationships, and promote reuse. © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved.

21 Pattern structure A pattern name. The problem addressed by it. How it provides a solution: –Structures, participants, collaborations. Its consequences. –Results, trade-offs. © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved.

22 Decorator Augments the functionality of an object. Decorator object wraps another object. –The Decorator has a similar interface. –Calls are relayed to the wrapped object... –... but the Decorator can interpolate additional actions. Example: java.io.BufferedReader –Wraps and augments an unbuffered Reader object. © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved.

23 Singleton Ensures only a single instance of a class exists. –All clients use the same object. Constructor is private to prevent external instantiation. Single instance obtained via a static getInstance method. Example: Canvas in shapes project. Enums support the Singleton pattern. © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved.

24 Factory method A creational pattern. Clients require an object of a particular interface type or superclass type. A factory method is free to return an implementing-class object or subclass object. Exact type returned depends on context. Example: iterator methods of the collection classes. © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved.

25 Observer Supports separation of internal model from a view of that model. Observer defines a one-to-many relationship between objects. The object-observed notifies all Observers of any state change. Example SimulatorView in the foxes-and-rabbits project. © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved.

26 Observers © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved.

27 Review Class collaborations and object interactions must be identified. –CRC analysis supports this. An iterative approach to design, analysis and implementation can be beneficial. –Regard software systems as entities that will grow and evolve over time. © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved.

28 Review Work in a way that facilitates collaboration with others. Design flexible, extendible class structures. –Being aware of existing design patterns will help you to do this. Continue to learn from your own and others’ experiences. © 2017 Pearson Education, Inc. Hoboken, NJ. All rights reserved.