Debugging with OpenEdge Architect An introduction to the IDE s integrated debugger This talk is about debugging techniques Not about good coding practices! Mike Fechner, Consultingwerk Ltd. PUG Challenge, Friday, 13th 2009, Rotterdam
Consultingwerk Ltd. Independent IT consulting organisation Focussing on OpenEdge and.net Progress Consulting Partner, long running cooperation with PSC Located in Cologne, Germany Consulting, conception, coaching, development, training, mentoring, review Customers located in Germany, Europe (EU, CH), USA Vendor of tools and consulting packages Debugging with OpenEdge Architect 2
Consultingwerk Ltd. 20 years of Progress experience (V5 V10) Progress, OpenEdge, ADM2, Dynamics, OERA, Sonic MQ/ESB OpenEdge GUI for.net early adaptor (hands on since 10/2006) Debugging with OpenEdge Architect 3
Solutions for the OpenEdge GUI for.net WinKit SmartComponent Library Dynamics4.NET Tools can be used together or separately Share some common code base Debugging with OpenEdge Architect 4
Why do you need a debugger? You aren t putting bugs into your code in the first place! However, if someone else has been putting bugs into your code, you may have considered using the OpenEdge Architect debugger. Debugging with OpenEdge Architect 5
First computer bug (moth) The First "Computer Bug" Moth found trapped between points at Relay # 70, Panel F, of the Mark II Aiken Relay Calculator while it was being tested at Harvard University, 9 September 1945. The operators affixed the moth to the computer log, with the entry: "First actual case of bug being found". (en.wikipedia.org) Debugging with OpenEdge Architect 6
Debugging (en.wikipedia.org) Debugging is a methodical process of finding and reducing the number of bugs, or defects, in a computer program or a piece of electronic hardware thus making it behave as expected. Debugging tends to be harder when various subsystems are tightly coupled, as changes in one may cause bugs to emerge in another. Technical aspect (tools) Organizational aspect (improving quality) Architectural aspect (loosely coupled easier to maintain) This talk focusses on the tools available in OEA 10.2A Debugging with OpenEdge Architect 7
Debugging with OpenEdge Architect Debugging features in OpenEdge Architect Test cases and run configurations Using the Integrated Debugger Debugging with OpenEdge Architect 8
Debugging features in OpenEdge Architect Preprocessor view Editor Macros Error Filters SCM Tools, Team provider Plugin-Infrastructure Tail, Logfile viewer Mylyn Debugging with OpenEdge Architect 9
Preprocessor view Creates preprocessed source code on the fly Right click, Editor, Show In -> Preprocessor Check the Link with Editor Button Customizable (Peter van Dam, PSDN Thread) http://communities.progress.com/pcom/message/71869#71869 Limitations: Works only for code that compiles Positioning works from source to preprocessor only, and only for compilable statements, no preprocessor, not include file references Debugging with OpenEdge Architect 10
Preprocessor view Debugging with OpenEdge Architect 11
Editor macros Editor macros provide an easy and straight forward way to insert reusable code blocks Ability to expand variables (date, time, text selection) Editor macros can be set up for comments containing default sections (who, what, when, why, project reference, customer reference) Can be exported and shared across team members for consistency Debugging with OpenEdge Architect 12
Error Filter By default OpenEdge Architect shows all compile errors and warnings in all opened projects Too many errors reduce visibility Can t see the forest because of those many trees Debugging with OpenEdge Architect 13
Error Filter Debugging with OpenEdge Architect 14
Error Filter Use item type to include or exclude case warning Use element selection to filter by ressource any element any element in selected project selected element only working set (can also be used for file search) Backend Frontend Product modules Debugging with OpenEdge Architect 15
SCM Tools / Team provider Common SCM tools integrate with Eclipse SVN, CVS, Roundtable, Perforce, MS TFS, Automatic or integrated check-in and check-out operations Debugging with OpenEdge Architect 16
SCM Tools / Team provider Review what has changed in the context of a certain task Ability to review changes prior to submit no more left over MESSAGE statements (in theory ) Access to source code at the time that caused an issue or the last time it was o.k. Who is to blame information Historic information, review versions Debugging with OpenEdge Architect 17
Eclipse Plugins: NTail http://www.certiv.net/downloads/ntaildownload.html Unix tail style log file tracing Stores opened log files in workspace config and reopens them at next launch of OEA Debugging with OpenEdge Architect 18
Eclipse Plugins: Mylyn http://www.eclipse.org/mylyn Task focussed extensions to Eclipse UI Tested / developed at IBM Integrates common bug tracking systems as task providers Task based time tracking Ability to pass task context (i.e. opened files, views) to another developer / reviewer / QA staff Debugging with OpenEdge Architect 19
MyLyn Debugging with OpenEdge Architect 20
Debugging with OpenEdge Architect Debugging features in OpenEdge Architect Test cases and run configurations Using the Integrated Debugger Debugging with OpenEdge Architect 21
Test cases Testing loosely coupled systems easier Very often a procedure or a class can t be executed directly from the OpenEdge Architect set up preconditions login, clicking thru menu system time consuming parameters / parameter combinations / extremes normal UI might prevent them but you should test the service for reliability as well force error conditions (test error behavior) static methods Debugging with OpenEdge Architect 22
Test cases OpenEdge Architect does not support scratch files Make that a feature, not an issue! Store test cases in a dedicated location UnitTest folder UnitTest project Document where they are located (bugtracking) so that others can see how seriously YOU have tested your work usually they shouldn t get deployed to the user (but potentially to QA) Debugging with OpenEdge Architect 23
Test cases In theory a feature request should come with documented test cases anyway Test driven development (TDD) starts with the test case and an empty class / procedure and continues development from there Debugging with OpenEdge Architect 24
Demo Test cases VatCalculator test cases Log-File in NTail Debugging with OpenEdge Architect 25
Run configurations Run configurations define AVM configuration used to launch programs and classes from OpenEdge Architect Run configurations will be (can be) created automatically when you run a file from the editor Can share settings of OpenEdge project definition (compiler settings) Settings may vary from project definition Pre-defined test-environment(s) within OEA project / workspace Debugging with OpenEdge Architect 26
Run configurations AVM Type (version, UI, batch, project runtime) Program to launch (or selected resource) Startup parameter PROPATH LOG-MANAGER settings Culture (-E, -d, code pages) Performance relevant settings Environment variables Debugging with OpenEdge Architect 27
Run configurations Database connections small / personal test database large / shared database archived databases from previous releases customer database(s) no database at all, AppServer client Debugging with OpenEdge Architect 28
Run configurations Can be stored locally (workspace) Can be stored in a shared file (.launch) Can be distributed via (SCM tool) Project name must match on remote system can be annoying when passing run config to another system.launch file easy to read XML file, so project name can be tweaked if required Debugging with OpenEdge Architect 29
Run configurations Debugging with OpenEdge Architect 30
Debugging with OpenEdge Architect Debugging features in OpenEdge Architect Test cases and run configurations Using the Integrated Debugger Debugging with OpenEdge Architect 31
The Integrated Debugger See and change variables, parameters Runtime object inspection Pseudo-objects too Stack trace Break points Line Error Watchpoint (when variable changes value) Expression watches Debugging with OpenEdge Architect 32
The Integrated Debugger Leverages Eclipse Debug Framework Allows non-modal debugging Multiple concurrent debug sessions Persists breakpoints and settings Invoke using run configurations Needs r-code, but Compiler debug listings not required Can add missing source code Simplified inspection of complex objects Debugging with OpenEdge Architect 33
The Integrated Debugger Does not support remote debugging No invocation from MESSAGE box (unless already debugging the application) DEBUGGER System Handle DEBUGGER:SET-BREAK() good for conditional break point Need for source code can be disturbing when executing external code add external source code to workspace / project good practice anyway (i.e. ADM2 source code) Debugging with OpenEdge Architect 34
Debugger property evaluation Can be time intensive May lead to issues when property GETter contains logic May impact the order in which code is executed Debugging with OpenEdge Architect 35
Debugger perspective Designed for large screen resolution! Many views Debug Variables (ability to change values) Break points Expressions Dynamic objects Invoked automatically when debugging (A feature desirable for the other OEA perspectives as well) Debugging with OpenEdge Architect 36
Debugger: Demo VatManager Error break point Simple DO i loop Watchpoint, Change value Dynamic Query Memory Leak Tracing OO ABL Class, Property evaluation Debugging with OpenEdge Architect 37
Questions? Debugging with OpenEdge Architect 38
Dank U wel! Debugging with OpenEdge Architect 39