ARCH-11: Building your Presentation with Classes John Sadd Fellow and OpenEdge Evangelist Sasha Kraljevic Principal TSE.

Slides:



Advertisements
Similar presentations
Welcome to CODE SPREAD Simple Concepts of Coding | Programming.
Advertisements

ARCH-01: Introduction to the OpenEdge™ Reference Architecture Don Sorcinelli Applied Technology Group.
ARCH-13 Developing WebSpeed  Applications Chris Skeldon Principal Consultant.
DEV-13: You've Got a Problem, Here’s How to Find It
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB JavaForum.
2 Object-Oriented Analysis and Design with the Unified Process Objectives  Explain how statecharts can be used to describe system behaviors  Use statecharts.
1 SWE Introduction to Software Engineering Lecture 23 – Architectural Design (Chapter 13)
Satzinger, Jackson, and Burd Object-Orieneted Analysis & Design
Software Architecture Patterns (2). what is architecture? (recap) o an overall blueprint/model describing the structures and properties of a "system"
Application Architectures Vijayan Sugumaran Department of DIS Oakland University.
Structure of a web application1 Dr Jim Briggs. MVC Structure of a web application2.
DEV-14: Understanding and Programming for the AppServer™
UNIT-V The MVC architecture and Struts Framework.
The Easiest Way to Write Web Applications Jordi Sastre IT Architect, PSC May 2012.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 18 Slide 1 Software Reuse 2.
Dependency Injection and Model-View-Controller. Overview Inversion of Control Model-View-Controller.
The Design Discipline.
Presenter - Donn Felker.  Senior Consultant for Microsoft Gold Certified Partner- Statêra.  8 years of experience in developing and architecting enterprise.
Lecture 8 Inheritance Richard Gesick. 2 OBJECTIVES How inheritance promotes software reusability. The concepts of base classes and derived classes. To.
What is Architecture  Architecture is a subjective thing, a shared understanding of a system’s design by the expert developers on a project  In the.
ARCH-1: It’s a Tall World After All Taking Application Architecture Seriously John Sadd Progress Fellow and OpenEdge Evangelist Mike Ormerod Technical.
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
Copyright © 2012 Accenture All Rights Reserved.Copyright © 2012 Accenture All Rights Reserved. Accenture, its logo, and High Performance Delivered are.
COMP 410 & Sky.NET May 2 nd, What is COMP 410? Forming an independent company The customer The planning Learning teamwork.
DEV-12: Object-oriented Programming in OpenEdge® ABL
Enterprise JavaBeans. What is EJB? l An EJB is a specialized, non-visual JavaBean that runs on a server. l EJB technology supports application development.
® IBM Software Group © 2007 IBM Corporation J2EE Web Component Introduction
ARCH-03: Implementing the OpenEdge™ Reference Architecture – Part 1 John Sadd Progress Fellow and OpenEdge Evangelist.
Object-Oriented Programming and the Progress ABL Tomáš Kučera Principal Solution Engineer / EMEA Power Team.
DEV-5: Introduction to WebSpeed ® Stephen Ferguson Sr. Training Program Manager.
ARCH-3: Context Management in the OpenEdge® Reference Architecture John Sadd Engineering Fellow and OpenEdge Evangelist.
ARCH-4: The Presentation Layer in the OpenEdge® Reference Architecture Frank Beusenberg Senior Technical Consultant.
DEV-36: Composite MVP – Building Blocks in Presentation Layer
SOA-26: Extending Your Application with OpenEdge ® Web Services John Sadd OpenEdge Evangelist.
Swing MVC Application Layering A Layer is a collection of components that Perform similar tasks. Perform similar tasks. Isolate implementation details.
ARCH-07: Implementing the OpenEdge™ Reference Architecture – Part 2
ARCH-7: A Class-Based Implementation of the OpenEdge® Reference Architecture John Sadd Fellow and OpenEdge Evangelist Applied Technology.
Summing Up Object Oriented Design. Four Major Components: Abstraction modeling real-life entities by essential information only Encapsulation clustering.
INT-9: Implementing ESB Processes with OpenEdge ® and Sonic ™ David Cleary Principal Software Engineer.
Review Class Inheritance, Abstract, Interfaces, Polymorphism, GUI (MVC)
DEV-6: Advanced Object-Oriented Programming in the ABL Evan Bleicher Senior Development Manager Shelley Chase
 Objects versus Class  Three main concepts of OOP ◦ Encapsulation ◦ Inheritance ◦ Polymorphism  Method ◦ Parameterized ◦ Value-Returning.
A New Object Model for WebSpeed and HTTP
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
1 Copyright © 2004, Oracle. All rights reserved. Oracle Application Development Framework.
A7: Architecting Your Application in OpenEdge ® 10 Mike Ormerod Applied Architect.
ARCH-7: Integrate this! SonicMQ® and the OpenEdge® Reference Architecture Christian Stiller Technical Architect.
DEV-5: Using ProDataSets™ in OpenEdge ® 10 Cheryl LaBarge Product Readiness.
DEV-8: AppServer ™ Mode Case Studies Simon Epps Solutions Engineer.
ARCH-5: Service Interfaces in Practice Christian Stiller Technical Architect.
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB Markus.
MOVE-15: Leveraging Business Entities, Data Access Objects and ProDataSets with a Progress Dynamics® or ADM2 GUI Peter Judge Principal Software Engineer.
DEV-9: Using the ProDataSet™ in OpenEdge® 10
Peter Judge A8: What’s New in Object-Oriented ABL Principal Software Engineer OpenEdge 10.1C and beyond.
Java Programming: Guided Learning with Early Objects Chapter 9 Inheritance and Polymorphism.
Introduction to .NET Florin Olariu
Structure of a web application
MPCS – Advanced java Programming
Distribution and components
Lecture 22 Inheritance Richard Gesick.
ARCH-1: Application Architecture made Simple
C6: Introducing Native Invocation with the OpenEdge® Adapter for Sonic™ ESB Chris James Senior Consultant.
Testing with OO OO has several key concepts:
– JukeBox – transparency, flexibility, speed and comfort!
DEV-08: Exploring Object-oriented Programming
– the JukeBox toolkit – transparency, flexibility, speed and comfort!
DEV-11: Architecting Your Application in OpenEdge® 10
ARCH-2: OpenEdge Reference Architecture (OERA) Latest Thinking
ARCH-14: Power Your Organisation with OpenEdge
Presentation transcript:

ARCH-11: Building your Presentation with Classes John Sadd Fellow and OpenEdge Evangelist Sasha Kraljevic Principal TSE

© 2007 Progress Software Corporation 2 ARCH-11: Building your Presentation with Classes Agenda  Presentation Layer in the OERA  Requirements  Design Patterns  Implementing the Model  Implementing the Presentation  Implementing the View  Integration with Common Infrastructure  Summary

© 2007 Progress Software Corporation 3 ARCH-11: Building your Presentation with Classes  Provides a high-level blueprint  Allows you to separate concerns  Helps you not to complicate your life  Facilitates agile design and development Presentation Layer in OERA OpenEdge ® Reference Architecture

© 2007 Progress Software Corporation 4 ARCH-11: Building your Presentation with Classes OpenEdge Reference Architecture Presentation Business Components Data Access Data Sources Common Infrastructure Enterprise Services

© 2007 Progress Software Corporation 5 ARCH-11: Building your Presentation with Classes OpenEdge Reference Architecture Presentation Business Components Data Access Data Sources Common Infrastructure Enterprise Services Presentation controls the user interface and requests data and other services

© 2007 Progress Software Corporation 6 ARCH-11: Building your Presentation with Classes Demo – What do we want to achieve?

© 2007 Progress Software Corporation 7 ARCH-11: Building your Presentation with Classes Agenda  Presentation Layer in OERA  Requirements  Design Patterns  Implementing the Model  Implementing the Presentation  Implementing the View  Integration with Common Infrastructure  Summary

© 2007 Progress Software Corporation 8 ARCH-11: Building your Presentation with Classes 1. Have a clearly defined interface to Business Components (BC) and Common Infrastructure (CI) 2. Be able to serve different UI client types 3. Allow reuse of common code shared by different UI client types 4. Lend itself to testing Presentation Layer - Requirements …must:

© 2007 Progress Software Corporation 9 ARCH-11: Building your Presentation with Classes  Able to locate required services in the BC & CI layers  Able to communicate with them  Able to handle dependencies on application state in a loosely coupled way Requirement 1: The Presentation has a clearly defined interface to BC & CI layers Components in the Presentation layer should be:

© 2007 Progress Software Corporation 10 ARCH-11: Building your Presentation with Classes  Should not be a single monolithic body of code  Should handle user actions in the same way regardless of the UI type  Should take into account the UI type and session state, for example: HTTP/*ML is ‘stateless’ Client/Server GUI may maintain state Requirement 2: The Presentation can serve different UI client types The Presentation layer:

© 2007 Progress Software Corporation 11 ARCH-11: Building your Presentation with Classes  Some code is responsible for handling information This should be UI independent  Some code is responsible for responding to user actions This will be UI type dependent  Some code is responsible for rendering the user interface This will be UI type dependent Requirement 3: The Presentation allows reuse of common code In the Presentation layer :

© 2007 Progress Software Corporation 12 ARCH-11: Building your Presentation with Classes  User interfaces are complicated to test User actions can be hard to capture Small changes to the UI disrupt saved tests  The Presentation architecture should facilitate automated testing Requirement 4: The Presentation lends itself to testing

© 2007 Progress Software Corporation 13 ARCH-11: Building your Presentation with Classes Agenda  Presentation Layer in OERA  Requirements  Design Patterns  Implementing the Model  Implementing the Presentation  Implementing the View  Integration with Common Infrastructure  Summary

© 2007 Progress Software Corporation 14 ARCH-11: Building your Presentation with Classes  A number of existing patterns can be used  Choose one or more that match best to the requirements  To list some: - MVC (Model View Controller) - MVP (Model View Presenter) and their derivatives… Design Patterns

© 2007 Progress Software Corporation 15 ARCH-11: Building your Presentation with Classes Model-View-Controller versus Model-View-Presenter Controller Model View Presenter Model View MVC – Model View Controller MVP – Model View Presenter

© 2007 Progress Software Corporation 16 ARCH-11: Building your Presentation with Classes Presenter versus Passive View Presenter Model View MVP – Model View Presenter Presenter Model View MVP – Passive View

© 2007 Progress Software Corporation 17 ARCH-11: Building your Presentation with Classes Design Patterns – Composite pattern for Views

© 2007 Progress Software Corporation 18 ARCH-11: Building your Presentation with Classes Design Patterns – Composite pattern for Presenters

© 2007 Progress Software Corporation 19 ARCH-11: Building your Presentation with Classes Example View

© 2007 Progress Software Corporation 20 ARCH-11: Building your Presentation with Classes The View with the Presenter and Model VIEW PRESENTER MODEL

© 2007 Progress Software Corporation 21 ARCH-11: Building your Presentation with Classes Design Patterns – Back to the OERA

© 2007 Progress Software Corporation 22 ARCH-11: Building your Presentation with Classes Agenda  Presentation Layer in OERA  Requirements  Design Patterns  Implementing the Model  Implementing the Presentation  Implementing the View  Integration with Common Infrastructure  Summary

© 2007 Progress Software Corporation 23 ARCH-11: Building your Presentation with Classes The Service Adapter and Service Interface Presentation Business Components Data Access Data Sources Common Infrastructure Enterprise Services Client session AppServer session Service Adapter Service Interface  Service Adapter sits outside the Model Connects the Presentation to Service Interface  Service Interface sits “above” the Business Components Routes each request to the right Business Component

© 2007 Progress Software Corporation 24 ARCH-11: Building your Presentation with Classes Support for a Business Component Type The Model The role of the Model in the Architecture Service Adapter Client Business Component Data Instance Client Business Component Data Instance Service Adapter Client Business Component Data Instance Client Business Component Data Instance Service Interface Business Component

© 2007 Progress Software Corporation 25 ARCH-11: Building your Presentation with Classes Implementing the Model with classes  The Model holds data on behalf of the View  There is a Client Business Component (CBC) type for each Business Component type Presentation layer Customer CBC type maps to a Customer Business Entity  There is one instance of a CBC for each View element that requests distinct data of the type

© 2007 Progress Software Corporation 26 ARCH-11: Building your Presentation with Classes Data instances  Data is not held persistently in the Business Components on the server  A Data Instance can represent a simple object (a row), a complex object (a DataSet or other form), a set of rows  A Data Instance can be held by a Client Business Component and bound to by the View  A Data Instance in the Model can be held as long as the data is needed  A Data Instance can be shared by multiple Views

© 2007 Progress Software Corporation 27 ARCH-11: Building your Presentation with Classes Presentation Business Component Data Access Data Sources Enterprise Services CBC SalesRep View1 SalesReps View2 Common Infrastructure Example: a data instance for SalesReps Presenter All SalesReps Svc Adapter SalesRep SalesRep BE All SalesReps SalesRep DAO BIND

© 2007 Progress Software Corporation 28 ARCH-11: Building your Presentation with Classes Data Instances on server and client  On the server: A single Business Component can be refreshed and reused for all requests The same Business Components can be used to supply data to Enterprise Services  On the client: A single Service Adapter can be used for all instances of a type in a session Distinct Views can have distinct CBC instances A single CBC instance can be reused to supply different data to a given View

© 2007 Progress Software Corporation 29 ARCH-11: Building your Presentation with Classes Order BE Presentation Business Component Data Access Data Sources Enterprise Services Order Order OrderLine Common Infrastructure CBC Order View1 Order View2 Order Presenter Order 1 Svc Adapter Orders Order 1 CBC Order 3 Order 5 Example: Sharing and reusing data instances Order DAO

© 2007 Progress Software Corporation 30 ARCH-11: Building your Presentation with Classes Service Adapters Common Infrastructure The Model Client-side code hierarchies componentbase.cls clientcomponent.cls beCustomer.cls serviceadapter.cls saCustomer.cls servicemanager.cls manager.cls factory.p INHERITS INVOKES

© 2007 Progress Software Corporation 31 ARCH-11: Building your Presentation with Classes Looking at class-based ABL code: clientcomponent super class  CLASS inherits behavior from a base class  PUBLIC property protects setting the value  PROTECTED VARIABLE protects access to the value Also defined as a specific class type CLASS pres.clientcomponent INHERITS base.componentbase: /* Handle for the default query on the top-level DataSet buffer */ DEFINE PUBLIC PROPERTY hTopRelQuery AS HANDLE NO-UNDO GET. PROTECTED SET. DEFINE PROTECTED VARIABLE AdapterRef AS pres.serviceadapter NO-UNDO. END CLASS.

© 2007 Progress Software Corporation 32 ARCH-11: Building your Presentation with Classes Client Business Component subclass  CLASS inherits behavior from the super class  CONSTRUCTOR executed on creation  PROTECTED variable can be set from this subclass  PROPERTY hTopRelQuery accessed just like a variable CLASS samples.pres.beCustomer INHERITS pres.clientcomponent: {samples/dsCustomer.i} CONSTRUCTOR beCustomer(): AdapterRef = CAST (servicemgr:startService ("samples.pres.saCustomer“, "sa"), samples.pres.saCustomer). CREATE QUERY hTopRelQuery. hTopRelQuery:ADD-BUFFER(DATASET dsCustomer:GET-BUFFER-HANDLE(1)). hTopRelQuery:QUERY-PREPARE ("FOR EACH " + DATASET dsCustomer:GET-BUFFER-HANDLE(1):NAME). END CONSTRUCTOR. DEFINE PROTECTED VARIABLE AdapterRef AS pres.serviceadapter NO-UNDO.

© 2007 Progress Software Corporation 33 ARCH-11: Building your Presentation with Classes Methods in the Client Business Component  Method is PUBLIC to allow access from Presenter VOID return type  fetchData reference in AdapterRef verified by compiler METHOD PUBLIC VOID fetchWhere (INPUT-OUTPUT DATASET-HANDLE phDSContext): DEFINE VARIABLE iBuffer AS INTEGER NO-UNDO. DEFINE VARIABLE hDataSet AS HANDLE NO-UNDO. AdapterRef:fetchData(OUTPUT DATASET dsCustomer, INPUT-OUTPUT DATASET-HANDLE phDSContext). hDataSet = DATASET dsCustomer:HANDLE. DO iBuffer = 1 TO hDataSet:NUM-BUFFERS: hDataSet:GET-BUFFER-HANDLE(iBuffer): TABLE-HANDLE:TRACKING-CHANGES = YES. END. END METHOD. DEFINE PROTECTED VARIABLE AdapterRef AS pres.serviceadapter NO-UNDO.

© 2007 Progress Software Corporation 34 ARCH-11: Building your Presentation with Classes Agenda  Presentation Layer in OERA  Requirements  Design Patterns  Implementing the Model  Implementing the Presentation  Implementing the View  Integration with Common Infrastructure  Summary

© 2007 Progress Software Corporation 35 ARCH-11: Building your Presentation with Classes CLASS presCustomerMaintenance INHERITS base.presenter: &Scoped-define REFERENCE-ONLY REFERENCE-ONLY {samples/dsCustomer.i {&REFERENCE-ONLY}} /* DEFINE DATASET dsCustomer REFERENCE-ONLY FOR eeCustomer. */ DEFINE VARIABLE clsCbcCustomer AS samples.cbcCustomerMaintenance NO- UNDO GET. PRIVATE SET. DEFINE PRIVATE VARIABLE hViewer AS HANDLE NO-UNDO. … END CLASS. Looking at class-based ABL code: presenter class  CLASS inherits behavior from a base presenter class  PRIVATE setter protects setting the value  PRIVATE VARIABLE protects access to the value Also defined as a specific class type where the view is realized using class type

© 2007 Progress Software Corporation 36 ARCH-11: Building your Presentation with Classes CLASS presCustomerMaintenance INHERITS base.presenter: … CONSTRUCTOR PUBLIC presCustomerMaintenance ( ): SUPER (). clsCbcCustomer = NEW samples.cbcCustomerMaintenance(). IF SESSION:CLIENT-TYPE = "4GLCLIENT" OR SESSION:CLIENT-TYPE = "WEBCLIENT" THEN DO: RUN CustomerMaintenance.w PERSISTENT SET hViewer. RUN setPresenter IN hViewer (INPUT THIS-OBJECT ) NO-ERROR. RUN populateData IN hViewer NO-ERROR. RUN enable_UI IN hViewer NO-ERROR. WAIT-FOR CLOSE OF hViewer. END. Looking at class-based ABL code: presenter constructor  SUPER() calls constructor in a base presenter class  Instantiate the Client Business Component  RUN the view, pass the reference to the presenter object, populate data and enable the UI The View can be realized as the specific class type instead of the ABL persistent procedure

© 2007 Progress Software Corporation 37 ARCH-11: Building your Presentation with Classes Agenda  Presentation Layer in OERA  Requirements  Design Patterns  Implementing the Model  Implementing the Presentation  Implementing the View  Integration with Common Infrastructure  Summary

© 2007 Progress Software Corporation 38 ARCH-11: Building your Presentation with Classes The View: /* ***********Included Temp-Table & Buffer definitions ******** */ {samples/eCustomer.i} /*Temp-table defined as REFERENCE-ONLY */ /* Local Variable Definitions ---*/ DEFINE DATASET dsCustomer REFERENCE-ONLY FOR eeCustomer. DEFINE VARIABLE clsPresenter AS presCustomerMaintenance NO-UNDO.... ON CHOOSE OF BtnDone IN FRAME DEFAULT-FRAME /* Done */ DO: clsPresenter:exitObject(). END. PROCEDURE populateData : clsPresenter:fetchData(OUTPUT TABLE eeCustomer BY-REFERENCE ). END PROCEDURE. PROCEDURE setPresenter : DEFINE INPUT PARAMETER clsObj AS presCustomerMaintenance. clsPresenter = clsObj. END PROCEDURE.

© 2007 Progress Software Corporation 39 ARCH-11: Building your Presentation with Classes Agenda  Presentation Layer in OERA  Requirements  Design Patterns  Implementing the Model  Implementing the Presentation  Implementing the View  Integration with Common Infrastructure  Summary

© 2007 Progress Software Corporation 40 ARCH-11: Building your Presentation with Classes Integration with Common Infrastructure Presenter class & procedures – Service Adapter to CI CLASS service.ServiceMgr INHERITS Base IMPLEMENTS IComponentFactory,IComponentRegistry USE-WIDGET- POOL : … END CLASS. Remember inheritance?  presCustomerMaintenance inherits base.presenter  Base.presenter inherits ‘base’ class  ‘base’ class defines class variable ‘clsServiceMgr’ Using Service Manager class methods, we now have access to all other services in CI !!!

© 2007 Progress Software Corporation 41 ARCH-11: Building your Presentation with Classes Agenda  Presentation Layer in OERA  Requirements  Design Patterns  Implementing the Model  Implementing the Presentation  Implementing the View  Integration with Common Infrastructure  Summary

© 2007 Progress Software Corporation 42 ARCH-11: Building your Presentation with Classes Demo – What have we achieved?

© 2007 Progress Software Corporation 43 ARCH-11: Building your Presentation with Classes In Summary  Separate concerns!  Use proven design patterns!  Follow OERA best practices!

© 2007 Progress Software Corporation 44 ARCH-11: Building your Presentation with Classes Relevant Exchange Sessions:  ARCH-1: Application Architecture Made Simple  ARCH-2: OERA Latest Thinking!  ARCH-7: A Class-based Implementation of the OERA  ARCH-12: Leveraging Design Patterns in ABL Applications For More Information, go to… PSDN: OpenEdge Principles: Implementing the OpenEdge Reference Architecture

© 2007 Progress Software Corporation 45 ARCH-11: Building your Presentation with Classes Questions?

© 2007 Progress Software Corporation 46 ARCH-11: Building your Presentation with Classes Thank you for your time

© 2007 Progress Software Corporation 47 ARCH-11: Building your Presentation with Classes