700 likes | 827 Vues
Don Denoncourt dondenoncourt@gmail.com. Approaches to Application Modernization. Outline. What is App Modernization and Why Bother? Modernizing Coders Code Moves to Data, Modernizing the Database Gradational versus Global Approach Fear Factor Grokking RPG
E N D
Don Denoncourt dondenoncourt@gmail.com Approaches to Application Modernization
Outline • What is App Modernization and Why Bother? • Modernizing Coders • Code Moves to Data, Modernizing the Database • Gradational versus Global Approach • Fear Factor • Grokking RPG • Save the Program, Save the Platform
"Modernization is our jobs. It’s what IT does. We improve access to information for the businesses we work for." • Trevor Perry
Traits of a Modern App • It has maintainable and testable code • It is modular and component-based • It provides a rich user interface • It uses the Model-View-Controller (MVC) design pattern • Separate presentation, flow control, and business logic • It is responsive to new business requirements
Why Bother? • Modernizing applications is costly • Not modernizing is more costly • "60 to 80 percent of all software development is enhancements to or maintenance of existing projects." • Gartner Group report • Amounts to a 10% increase in legacy code per year
Escalating Costs • Effort required to enhance and maintain legacy apps escalates with time • Fact: • Code is read far more often than it is written. • So: • "What sense does it make to bloat unreadable code at a rate of 10 percent per year?" • Reducing maintenance costs may be the biggest reason to modernize
Modular Applications: • Allow you to quickly respond to business requirements • Improves interoperability: • Other applications • Languages • Technologies • Including SOA and REST
Three Contexts of Modernization • User Interface • Code • Coders
Modern UI • If you're not rewriting your entire app in a new language • Need to modularize RPG • before adding a Web front-end • What about… HATS and WebFacing? • WDHT is the Botox of UI modernization • Quick and easy • But behind that puffed-up face • There will always be the same old person
Application Make-over • To make over a person (or an application) • You need to start from the inside • That means • Attitude • Knowledge • Organization
Attitude, Knowledge, and Organization • Attitude should come from personal fulfillment • But it can also be coerced from effective management • Knowledge is acquired from experience or education • Organization • micro-level • when restructuring a program • macro-level • when planning an attack for modernization.
Training • Formal education • Most common strategy • But the best training is mentoring • Conferences and formal classes • are worthwhile • But mentoring virtually guarantees • New techniques can transform from knowledge to functioning business code
Mentor • If you don’t have internal expertise • Get a consultant • one with mentoring skills • To substantially decrease costs: • Consider: • WebEx, GoToMeeting, and alternative web conferencing tools • Consultant may be off-site and part-time • Maximize your training budget's ROI • With 2 hours mentoring a day
Master Programming Toolsets • Promote use of a modern development tools • WDSc/RDi • Eclipse, NetBeans, Visual Studio A good IDE provides tools that are necessary in the modernization process.
Modernize Your Database • 20-year-old RPG • Code manages what should be done with db • Table relationship management • Foreign key constraints. • Refactoring that code out • Reduces requirement for code
Does your database really need modernization? • If your files are defined with DDS • If you are not using constraints and triggers • If you are planning to implement Business Intelligence • If you are planning to provide a web front-end to your data • If new developers need to look at code to understand your database • Then. Yes. You really need to modernize your database.
Significant Performance Improvements • DDL-defined table page size much larger that DDS-defined files • DDL page size 64K • DDS page size 8-32K • Encoded Vector Indexes (EVI) • SQL query engine (SQE) runs below the MI • Versus the Classic Query Engine (CQE) http://systeminetwork.com/article/performance-comparison-dds-defined-files-and-sql-defined-files
New Column/Field Capabilities • BLOBs and CLOBs • Constraints • User-Defined Data types (UDT) • Formula columns • Encryption and decryption • Complex view definitions (logical files) • Expressions • Aggregation • Complex selection
New Column/Field Capabilities • Long table and view names • 128 characters • Identity and RowId columns • Sequences • Auto-increment of keys • Column-level triggers • Column-level privileges (authorities)
Object-relation Mapping Tools • Generators for ORM engines • Such as • Java Persistence API • Hibernate • OJB • Work best with a well-crafted database • And standard SQL DDL constructs
Object Traversal • Enabled with 1 database operation via joins • Versus a read for each row/record • Java: • event.getVenue().getAddress().getStreet(); • Grails: • event.venue.addresss.street
More reasons to modernize • SQL is a widely used standard. • Openness • more and better options for third-party tools • Books and training readily available • Performance: • IBM is investing money on improving database access through SQL, not elsewhere. • Availability of skills • Easier find Java and SQL skills over RPG and DDS knowledge. • Functionality • Some new functions require SQL.
“Code moves to data” • Business rules • As much as possible • belong in DDL • DDL-based Business Rules • Constraints • Primary and foreign keys • Column-level contraints • Triggers • Operations to perform on • Add, update, or delete operations.
Benefits of DDL Business Rules • Removes duplicate code • Decreasing complexity • Improving maintainability • Self-describing • Enforces database integrity • Rules are always followed • Whether .Net, PHP, or Java web front-end applications • Or other RPG
createtable item ( itemid varchar(10) notnull, productid varchar(10) notnull, listprice decimal(10,2) notnull, unitcost decimal(10,2) notnull, supplier intnotnull, status varchar(2) notnull, attr1 varchar(80) notnull, attr2 varchar(80) notnull, attr3 varchar(80) notnull, attr4 varchar(80) notnull, attr5 varchar(80) notnull, constraint pk_item primarykey (itemid), constraint fk_item_1 foreignkey (productid) references product (productid), constraint fk_item_2 foreignkey (supplier) references supplier (suppid) ); createindex itemProd on item (productid); • PetStore DB • Used in the ubiquitous sample web application
createtable product ( productid varchar(10) notnull, category varchar(10) notnull, name varchar(80) notnull, descn varchar(255) notnull, constraint pk_product primarykey (productid), constraint fk_product_1 foreignkey (category) references category (catid) ); createtable category ( catid varchar(10) notnull, name varchar(80) notnull, descn varchar(255) notnull, constraint pk_category primarykey (catid) ); createtable supplier ( suppid intnotnull, name varchar(80) notnull, status varchar(2) notnull, addr1 varchar(80) notnull, addr2 varchar(80) notnull, city varchar(80) notnull, state varchar(80) notnull, zip varchar(5) notnull, phone varchar(80) notnull, constraint pk_supplier primarykey (suppid) );
Field-level Constraints CREATETABLE orders ( CustNum CHAR(4), OrderNum CHAR(4), Quantity INTEGERCHECK (Quantity BETWEEN1AND50) );
On Delete and On Update CREATETABLE CORPDATA.EMPLOYEE (EMPNO CHAR(6) NOTNULLPRIMARYKEY, FIRSTNME VARCHAR(12) NOTNULL, MIDINIT CHAR(1) NOTNULL, LASTNAME VARCHAR(15) NOTNULL, WORKDEPT CHAR(3) CONSTRAINT WORKDEPT_EXISTS REFERENCES CORPDATA.DEPARTMENT (DEPTNO) ONDELETESETNULLONUPDATERESTRICT, PHONENO CHAR(4), HIREDATE DATE, JOB CHAR(8), EDLEVEL SMALLINTNOTNULL, SEX CHAR(1), BIRTHDATE DATE, SALARY DECIMAL(9,2), BONUS DECIMAL(9,2), COMM DECIMAL(9,2), CONSTRAINT UNIQUE_LNAME_IN_DEPT UNIQUE (WORKDEPT, LASTNAME) );
Database Reverse Engineering Tooling • Navigator • WDSc • System i System API • Third-party tools
Navigator has a suite of SQL tools Note: IBM is phasing out database development with Navigator
System i API • Generate Data Definition Language (QSQGNDDL) • Carsten Fleming wrote an iSeries command: GENSQLDDL DBOBJ(yourFile) + DBLIB(QSYS) + TYPE(*PF) + SRCFILE(QGPL/QDDLSRC) + MBR(yourFile) + MBROPT(*REPLACE)NAMING(*SQL) http://systeminetwork.com/article/apis-example-reverse-engineering-database-files-and-objects-sql-ddl-statements
Two Strategies: Globally or Gradually • Global modernization • Management backs the project with bucks • Bring in consultants • Purchase a modernization tool-set • such as Databorough’s X-Analysis. • Gradational modernization • Refactor code on an ongoing basis during normal business development
Global Realities • Management often will not back such a concentrated effort • Even though, in the long run, • It is the most cost effective • There are two alternatives to this • Do nothing • And let your code swell beyond recognition • Improve code with the gradational approach.
Gradational Philosophy "Regard every bug fix or enhancement as an opportunity to improve code."
Gradational Realities • Consider a change request • Estimated as a 10- to 20-hour project • Quick-and-dirty status-quo • Opportunity to modernize • First time realities • Potentially take 80–140 hours • Time will appreciably decrease on each new request
Gradational Benefits • Soon you will be more receptive change requests • Along with • Increased adaptability • Greater interoperability • Reduced code bloat