Please Dont Do That! Common Programming Mistakes Tammy
Lonsberry Sr. Programmer/Analyst Sungate Solutions, Inc.
Slide 2
About me Tailoring and customizing Progress code for QAD users
since 1995 Most versions (Mfg/Pro 7.3 QAD EA 2013 SE) All User
Interfaces (CHUI, GUI, Desktop,.NetUI) Progress and Oracle dbs
Active PEG member Long time consultant with exposure to many
different environments, processes, protocols and many lessons
learned, too often the hard way
Slide 3
Agenda Environment Setup Programming Tips Code Installation
Support and Maintenance Summary Questions
Slide 4
Environment Setup
Slide 5
Environment Setup Basics The basics include a minimum of 3
databases and 3 code environments Databases: Production User
Testing Development Code Environments: Production Test
Development
Slide 6
Directory Layout Do: Keep custom code separate from QAD Do:
Keep 3 rd -party code separate from QAD Do: Keep layers of
directories for the separate code environments Prod = top layer
Test = middle layer Dev = lowest layer Provide an easy way to peel
away the customizations and 3 rd -party apps Can run standard QAD
with simple Propath change Can run any code environment against any
database Better ability to isolate root cause of code issues
Slide 7
Propath Tips Keep Propath consistent across all environments,
UIs, users .NetUI Propath should match non-.NetUI Propath All
end-users should use the same Propath No source Prod users = only
Prod.rs Test users = Test then Prod All developers should use the
same Propath Includes all source Same directories in the same order
Eliminate guesswork; use, to get correct version of code Watch for
stale copies in your start-up directory; in Test
Slide 8
Propath Examples Production (no source) PROPATH=. Startup
directory /apps/qad/mods Prod Mods (in-house custom code)
/apps/qad/trm Trade Management (TrM) /apps/qad QAD /apps/qad/bbi
Test PROPATH=. /apps/qad/test Test Mods /apps/qad/mods Prod Mods
/apps/qad/trm /apps/qad /apps/qad/bbi
Slide 9
Propath Examples Development (full source) PROPATH=. Startup
directory /apps/qad/test Test compiled.rs /apps/qad/test/src Test
source code /apps/qad/mods Prod compiled.rs /apps/qad/mods/src Prod
source code /apps/qad/trm TrM compiled.rs /apps/qad/trm/src TrM
source /apps/qad/trm/xrc TrM encrypted source /apps/qad QAD
compiled.rs /apps/qad/src QAD source /apps/qad/xrc QAD encrypted
source /apps/qad/bbi QAD (misc. include files)
Slide 10
Programming Tips
Slide 11
Goal: Make code easier to read, understand Leads to faster
investigation, troubleshooting, problem resolution Faster response
time = happy users & management Do: Add code comments Messages
Place message text within comment to assist with code readability
/*ITEM NUMBER DOES NOT EXIST*/ {pxmsg.i &MSGNUM=16
&ERRORLEVEL=3} Use brief code comments to explain why The what
is obvious; the why is not Explain business reasons; these change
over time Explain why this logic/algorithm/method was used
Slide 12
Programming Tips Dont: Abbreviate field or variable names
Prohibits ease & effectiveness of text searches Ex: Never use
code_fld for code_fldname Do: Recycle & Reuse Recognize
reusable code segments Eliminate redundant code No minimum number
of lines; 2 lines repeated is too many Gets out of sync too easily
Makes code unnecessarily lengthy, harder to read, harder to
maintain Use internal procedures, include.i files, external
programs
Slide 13
Programming Tips Do: Use QAD variables to gain bonus features
Example: Use part/part1, site/site1 Freebies include: Field Labels
(and their multi-language translations) Field Lookup browses Field
Help
Slide 14
Bonus: Free Labels
Slide 15
Bonus: Free Lookups
Slide 16
Programming Tips Custom copies Think beyond the code When
creating a copy of a standard QAD program in order to rename it and
customize it, also check for: Lookup browses Field labels On screen
On output
Slide 17
Custom Copy Example
Slide 18
Programming Tips: Data Code development often includes data,
too Examples of developers data: When creating data: Always add to
Dev database first Avoid: Collisions with other developers
Mismatches Out-of-sync scenarios Browses Drill-downs Field lookups
Generalized Codes Labels Menu options Messages Program
Information
Slide 19
Code Installation
Slide 20
Code Installation Dos: Do: Put source programs (.i,.p) in /src
directory Do: Put compiled code (.r) in applicable 2- letter
subdirectories Ex: /us/xx Do: Keep all related.is,.ps,.rs in sync
Always installed together, into the same environment, at the same
time Follow this for all code, including: ECOs (patches) Add-on
modules 3 rd -party apps
Slide 21
Code Installation Donts: Dont: Put source programs in a
2-letter subdirectories Or in any directory except /src Dont:
Install.r without corresponding source Dont: Keep duplicate copies
in multiple directories Development directory should contain only
code in active development When complete, move it to Test Test
directory should contain only code waiting to be tested When
complete and approved, move it to Prod
Slide 22
Code Installation Do: Devise and follow an installation process
Methods include: Can use 3 rd party apps Can develop your own
scripts, programs Can be completely manual List the steps, then
step the list Self-documenting Becomes an easy checklist Assists
with code version control Increases overall environment
stability
Slide 23
Code Installation Do: Use code check out process Ensures that
only one person is working on a program at a time Avoids coding
conflicts Avoids lost work, accidental overwrites Sample check out
method Use a designated folder (ex: /src/checkout) Place a simple
text file into this folder File name = program name (ex:
xxabc.p.txt) Contents include: Developer name or initials Date
Reason (ex: ECO #, project ID, case #, etc.)
Slide 24
Code Installation Do: Keep source code history Can do immediate
roll-backs Can do diffs to determine version changes Sample code
history method Use a designated folder (ex: /src/history) Copy
current Prod version to this folder Add a date extension (ex:
xxabc.p.20140324)
Slide 25
Installation Includes Data, Too Manage data in the same manner
as code Data and code move through the installation steps together;
same place, same time Dev Test Test Prod Data can be dumped and
loaded Dont retype it into each database Develop simple tailored
versions of QADs dump/load procedures Browses With.NetUI, can use
Browse Import/Export Without.NetUI, dump/load applicable
tables
Slide 26
Installation Example 1. Diff it Compare your modified code to
the existing version Ensure the only changes are yours -- no more,
no less Do this for any environment (Test, Prod, etc.) 2. Keep
history (Prod only) Copy production code; add date extension 3.
Install code & data Includes source (.i,.p) and.r Move, dont
copy Load data into target database(s) 4. Remove check out file
(Prod only)
Slide 27
Support and Maintenance
Slide 28
No program is ever 100% final Always keep in mind future
modifications, enhancements, testing & troubleshooting Dont:
Develop a report without any selection criteria Develop data
exports, imports or interfaces without any selection criteria
Develop a program that executes fully by simply selecting it from
the menu
Slide 29
Support and Maintenance Do: Add more selection criteria than
required Reports, data exports, imports Do: Provide a way to do
quick & simple testing with a small number of records Do:
Provide a way to run every program and process outside of
production Especially useful for interfaces, data loads, automated
jobs, processes requiring scripting or OS commands (such as FTP),
etc. Provide a way to test individual steps of a larger
process
Slide 30
Support and Maintenance Provide intuitive menu titles Make it
clearly obvious what type of program it is Maintenance Report
Browse Utility Provide enhanced descriptions Add details about a
programs function as informative screen text Especially helpful for
utility programs, data exports and imports Ensure text is visible
in.NetUI
Slide 31
Support and Maintenance Always change Company Address after a
database refresh Make it clear to users (and developers) what
database they are logged into Ensure that report titles always
indicate the source database Use 2.12 Company Address Maintenance
Change address for: ~reports ~screens ~taxes
Slide 32
Company Address Maintenance
Slide 33
Company Address: ~reports adctryrp.p 2+ 2.14.3 Country Code
Report Date: 03/13/14 Page: 1 Your Company Name **TEST** Time:
11:20:59 Alt Ctry Name EC NAFTA DEA GATT Group Type Code ----
---------------------------- --- ----- --- ---- -------- --------
---- UAE UAE No No No No UKR Ukraine No No No No URY Uruguay No No
No No USA United States of America No No No No US VEN Venezuela No
No No No VIR Virgin Islands (U.S.) No No No No VNM Viet Nam No No
No No WIN West Indies No No No No ZAF South Africa No No No No End
of Report
Slide 34
Company Address: ~screens
Slide 35
.NetUI Shows db:domain
Slide 36
Summary
Slide 37
Standards, policies and procedures these are not your enemy!
Following best practices leads to: Faster response time Happier
end-users Lower IT support costs Less stress, less headaches
Slide 38
Questions?
Slide 39
Contact information For further information or a copy of this
presentation: Tammy Lonsberry (847) 628-4796
[email protected]