440 likes | 452 Views
Learn how BCP used a combination of old and new OpenEdge features to create an Operationally Responsive Point of Service. Explore the tools and techniques used and discover the benefits of moving to an Object-Oriented world.
E N D
Developing a 21st Century Point of Service using the latest OpenEdge tools Brian Preece Business Computer Projects
Session Objectives • To describe how we used OpenEdge features both old and new to create an Operationally Responsive Point of Service Developing a 21st Century Point of Service using the latest OpenEdge tools
Who are BCP? • Major supplier in Europe of Food Wholesale, Retail and Cash and Carry systems • Users: Spar, NISA, Pets at Home, BWG, Musgrave, ADM, Morrisons, etc… • Area: currently UK and EU, keen to expand! • 1st “Extranet” - Late 1970s Telspar • 1st Scanning in convenience stores in UK • Early adopter of SonicMQ with our AIMS wholesale/ retail messaging hub • Continuous innovators Developing a 21st Century Point of Service using the latest OpenEdge tools
Agenda • Business Acceleration and Operational Responsiveness • The PoS Dilemma • Solving the dilemma using the latest OpenEdge tools • Demo • A closer look at the tools • Moving to an Object Oriented world • Conclusions Developing a 21st Century Point of Service using the latest OpenEdge tools
Agenda • Business Acceleration and Operational Responsiveness • The PoS Dilemma • Solving the dilemma using the latest OpenEdge tools • Demo • A closer look at the tools • Moving to an Object Oriented world • Conclusions Developing a 21st Century Point of Service using the latest OpenEdge tools
Business velocity is increasing same-day service Automated share trading 100 ms 20 ms Airline operations 20 min 30 sec Track financial position 1 day 5 min 1 day Supply chain updates 15 min Phone activation 3 days 1 min Refresh data warehouse 1 week 0.5 hour Source: Gartner, Inc. mail express fax e-mail real time Business Process Trade settlement 5 days 2 hrs. Typical Business SLAs106 105 104 103 100 10 1 0Seconds Developing a 21st Century Point of Service using the latest OpenEdge tools
Supply Chain Operational Responsiveness Developing a 21st Century Point of Service using the latest OpenEdge tools
Agenda • Business Acceleration and Operational Responsiveness • The PoS Dilemma • Solving the dilemma using the latest OpenEdge tools • Demo • A closer look at the tools • Moving to an Object Oriented world • Conclusions Developing a 21st Century Point of Service using the latest OpenEdge tools
The Retail Challenge • Many stores and no IT expertise in the stores • Fixes and new features need to be rolled out as fast as possible • But visiting each store is very expensive • This implies a thin client solution BUT • MUST BE RESILIENT - the store must continue to trade as long as one till still works • Even if: no back office no AppServer™ no comms Developing a 21st Century Point of Service using the latest OpenEdge tools
Changes to Business Model • Independent stores coalescing into chains • Wholesalers buying retail stores and running as multiple chain • Hence desire for • Centralised control • Centralised data management • Centralised data analysis Developing a 21st Century Point of Service using the latest OpenEdge tools
Agenda • Business Acceleration and Operational Responsiveness • The PoS Dilemma • Solving the dilemma using the latest OpenEdge tools • Demo • A closer look at the tools • Moving to an Object Oriented world • Conclusions Developing a 21st Century Point of Service using the latest OpenEdge tools
“Classic” WebClient Architecture Developing a 21st Century Point of Service using the latest OpenEdge tools
Semi-disconnected Architecture Developing a 21st Century Point of Service using the latest OpenEdge tools
Tools we used • 9.0 WebClient • 10.1 Sonic Integration features • 10.1 XML features • 10.2 GUI for .NET • 10.1/ 10.2 OO ABL Developing a 21st Century Point of Service using the latest OpenEdge tools
Agenda • Business Acceleration and Operational Responsiveness • The PoS Dilemma • Solving the dilemma using the latest OpenEdge tools • Demo • A closer look at the tools • Moving to an Object Oriented world • Conclusions Developing a 21st Century Point of Service using the latest OpenEdge tools
Demo Developing a 21st Century Point of Service using the latest OpenEdge tools
Demo setup Host laptop Software Download Site “PoS” laptop Central Management VM Back Office VM CM DB BO DB Sonic Broker Sonic Broker LAN Developing a 21st Century Point of Service using the latest OpenEdge tools
Agenda • Business Acceleration and Operational Responsiveness • The PoS Dilemma • Solving the dilemma using the latest OpenEdge tools • Demo • A closer look at the tools • Moving to an Object Oriented world • Conclusions Developing a 21st Century Point of Service using the latest OpenEdge tools
The Basics • WebClient for easy deployment • Use temp-tables to store product/ price data, deals, etc. • Sonic for real time messaging • Transactions are sent to the AppServer in real time • Sonic Local Persistence to handle disconnection • Connection/ Disconnection handled in the background • XML to ProDataSet/ Temp-table • Very fast transformation to and fro • Also give loose coupling between PoS and Back Office Developing a 21st Century Point of Service using the latest OpenEdge tools
Old PoS Developing a 21st Century Point of Service using the latest OpenEdge tools
GUI for .NET Transformation Much cleaner overall look Bitmap embedded within button object Object Oriented GUI Style sheets Dynamically coloured buttons Gradient fill spans across group of objects DEV-32: Using the Advanced GUI, Structured Error Handling and SonicMQ to build a Semi-Disconnected Point of Sale Developing a 21st Century Point of Service using the latest OpenEdge tools
OO ABL • Can use UML to design • More robust since more checking is done at compile time • Easier to unit test because of small objects with well defined interfaces • Easier to customise • Defined API • Facilitates continuous integration and other Agile techniques Developing a 21st Century Point of Service using the latest OpenEdge tools
Agenda • Business Acceleration and Operational Responsiveness • The PoS Dilemma • Solving the dilemma using the latest OpenEdge tools • Demo • A closer look at the tools • Moving to an Object Oriented world • Conclusions Developing a 21st Century Point of Service using the latest OpenEdge tools
Three approaches • Total rewrite from the ground up • Thin OO wrapper round existing procedural code • In between solution We chose the latter on a case by case basis • Only possible because Progress allow mixing of OO and procedural code! Developing a 21st Century Point of Service using the latest OpenEdge tools
OO Redesign • Essential where code interacts with GUI for .NET • Highly desirable for main program structure • Highly desirable for code that has either been badly written or much amended • New code needs to be audited against the original code • Our example: Scanning • Core part of the system • Existing logic must be reused in business entities Developing a 21st Century Point of Service using the latest OpenEdge tools
Scanning – Starting Point • LibPoSService.p • Structured procedure • Reads and Writes to the database • Contains code for locating product information, creating transaction records, adding items to a transaction, etc Developing a 21st Century Point of Service using the latest OpenEdge tools
Scanning – Class Model • First, the domain level classes are identified Developing a 21st Century Point of Service using the latest OpenEdge tools
Scanning – Code Refactoring • Next, internal procedures that can be moved to the domain level classes are selected • In LibPoSService.p we have: • GetItemDetails: • Finds a product based on a scanned code • Outputs product details as a temp-table parameter • AddItemToBasket: • Receives product details as a temp-table parameter • Adds scanned product details to the current basket Developing a 21st Century Point of Service using the latest OpenEdge tools
Scanning – Code Refactoring • Procedural code is changed to: • run from temp-tables instead of database tables • use data access objects to read / write data within the functional code • Procedures are transformed into class methods in associated domain level classes Developing a 21st Century Point of Service using the latest OpenEdge tools
Scanning – Code Refactoring = Developing a 21st Century Point of Service using the latest OpenEdge tools
Scanning – Plugging it together • Finally, any remaining “control” code is translated to use the domain level objects. • As our PoS uses MVC, scanning control code was added to the controller for the main scanning screen Developing a 21st Century Point of Service using the latest OpenEdge tools
Scanning – Plugging it together Developing a 21st Century Point of Service using the latest OpenEdge tools
Scanning – Plugging it together Developing a 21st Century Point of Service using the latest OpenEdge tools
Scanning – Code Auditing • Performed after recoding is complete • Each line of the old code is checked to ensure that it has been represented in the new code or is definitely not required Developing a 21st Century Point of Service using the latest OpenEdge tools
Scanning – Code Auditing Harvested for reuse in Product class a ... run GetItemDetails in hLibPoSService (input dProductID, output table ttItemDetails). ... run AddItemToBasket in hLibPoSService (input table ttItemDetails, input iQuantity). ... /* Refresh transaction display */ {&OPEN-QUERY-br_saleline} apply“ENTRY”to code-entry inframe f-main. apply “END” tobrowse br_saleline. ... /* Recalculate total due and number of items */ dTotal = 0. iNumItems = 0. for each saleline where saleline.trans-id=iTransID no-lock: dTotal = dTotal + saleline.sales-value. iNumItems = iNumItems + saleline.quantity. end. for each b-tendtran where b-tendtran.trans-id = iTransID no-lock: dTotal = dTotal - b-tendtran.amount. end. Harvested for reuse in Transaction class a Functional equivalent exists as a method in the ScanningForm class a These global variables are now properties of the Transaction class. a Developing a 21st Century Point of Service using the latest OpenEdge tools
Re-using Procedural code • Requires well-structured code • Relies on interworking between OO and procedural code • Normally achieved by wrapping procedural code within an OO wrapper • Our example: Deals engine • Self-contained • Stateless • Well defined interface Developing a 21st Century Point of Service using the latest OpenEdge tools
Deals Engine – The problem • 720 possible combinations! – which is best? • 4 Cokes for £1 • 4 Soft drinks for £1.25 • Meal deal: drink, sandwich and snack for £2.50 • World Cup deal: 4 beers and 4 crisps for £3 • Bulk buy beer deal: 4 beers for £2.50, 8 beers for £4.50, 16 beers for £8.50 • Customer buys 4 Cokes, 2 Fantas, 6 packets of crisps, 2 sandwiches and 12 beers • 5000 lines of stateless ABL code! • Must recalculate in real time when an item is scanned! • Development cost £200k 2 years ago Developing a 21st Century Point of Service using the latest OpenEdge tools
Deals Engine – Starting Point • DealsEngine.p • Structured procedure with a single entry point • Reads “static” data from the database • e.g. the items that make up each deal • Does not write to the database • No functional changes required • But the PoS has no database access Developing a 21st Century Point of Service using the latest OpenEdge tools
Deals Engine – Code Changes /*------------------------------------------------------------------------ File : DealsEngine.p Purpose : Deals Procedure Library Syntax : Description : Author(s) : BCP Created : 15/12/2006 Notes : ---------------------------------------------------------------------*/ /* This .W file was created with the Progress AppBuilder. */ /*----------------------------------------------------------------------*/ {dsParameters.i} {dsDeal.i} define buffer stparamforttParameters. define buffer DealLiveMainforttDealLiveMain. define buffer DealLiveListforttDealLiveList. define buffer DealLiveItemforttDealLiveItem. define buffer LinkedDealsforttLinkedDeals. DAParameters:Instance:FetchWhere("", output dataset dsParameters). DADeal:Instance:FetchWhere("", output dataset dsDeal). ... Define the temp-tables and datasets that will be used in place of the database tables These buffers have the same name as the database tables in the old procedure Data access objects are used to populate the temp-tables Developing a 21st Century Point of Service using the latest OpenEdge tools
Deals Engine – OOABL Wrapper classDealsEngine final: defineprivatevariablehDealsEngine ashandleno-undo. constructorpublic DealsEngine (): super (). runDealsEngine.ppersistentsethDealsEngine. endconstructor. destructorpublicDealsEngine ( ): if valid-handle(hDealsEngine)then deleteprocedurehDealsEngine. enddestructor. methodpubliccharacterApplyDealsToBasket(input-outputtabletBasket, inputiLineNumberasinteger): runApplyDealsToBasketinhDealsEngine(input-outputtabletBasket, inputiLineNumberasinteger). endmethod. endclass. Private handle for referencing the structured procedure Constructor loads the procedure persistenly Destructor deletes the procedure instance Methods expose entry points to the structured procedure Developing a 21st Century Point of Service using the latest OpenEdge tools
Agenda • Business Acceleration and Operational Responsiveness • The PoS Dilemma • Solving the dilemma using the latest OpenEdge tools • Demo • A closer look at the tools • Moving to an Object Oriented world • Conclusions Developing a 21st Century Point of Service using the latest OpenEdge tools
Conclusions • Business logic is very hard-won – don’t throw it away • By allowing OO and procedural code to co-exist, Progress have given us choices denied by other vendors when they introduced OO • Strike a balance between retaining code and rewriting in OO • Audit the code you rewrite Developing a 21st Century Point of Service using the latest OpenEdge tools
Questions Developing a 21st Century Point of Service using the latest OpenEdge tools
Thank you for your time! brian@bcpsoftware.com www.bcpsoftware.com See our Expo booth! Developing a 21st Century Point of Service using the latest OpenEdge tools