Helping Developers Master PowerBuilder Classic and .NET

Yakov Werde

Subscribe to Yakov Werde: eMailAlertsEmail Alerts
Get Yakov Werde via: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn

Blog Post

Refactoring: Best Thing Since Sliced Bread?

When is refactoring PowerBuilder client/server applications a good idea and when is it not

PBDJ Blog on Ulitzer

After watching my PowerBuilder refactoring eTutorial, you're getting a glimmer of the potential confidence, joy and power of refactoring in a test driven manner.  No doubt, you're already familiar with the uncomfortable feeling of slogging though ponderous legacy code.  Now you are beginning to know the benefits of refactoring; you know the smells, and you know the catalog of techniques. You can't wait get your hands on some legacy code. You know exactly what to do to whip it into shape. 

Legacy code, watch out, here I come!

But wait, is refactoring always the right thing to do?  Should we send every app out for an overhaul, face lift or tummy tuck by a special refactoring team for a before moving on?

At this moment the words of the song immortalized by Kenny Rogers echo in my brain:

You got to know when to hold 'em, know when to fold 'em.
Know when to walk away, know when to run
You never count your money, when you're sittin' at the table.
There'll be time enough for countin', when the dealin's done

In line with knowing when to hold ‘em and fold ‘em, here again, is my short list of reasons to refactor PB code with abandon.

If you're getting ready to migrate to .NET then

  1. Thin the GUI: Classic Client Server GUIs suffer from code bloat.  ‘Lean and mean' is the mantra for new GUI. Move that business logic out the GUI.  Extract Method, Extract Class and Replace Temp with Query.  Get your GUI event handlers down to slim, clean, readable code
  2. Open up the enterprise: Eliminate obvious duplication and free logic for sharing. Extract Class, Replace Data Value with Object, Duplicate Observed Data until your logic is properly encapsulated within portable classes

If you're not getting ready to migrate then

    AS NEEDED, when you're working in monster sections of code, judiciously apply some of the refactorings from the catalog to make the code a better place for yourself and the developers who will surely follow you.

More Stories By Yakov Werde

Yakov Werde, a 25 year IT industry veteran, is a member of TeamSybase and the newly formed Sybase Customer Evangelist Team. Yakov is a recognized author, speaker and trainer who has been designing and delivering PowerBuilder, .NET, EaServer, Web App Development, and Java training for over 14 years to corporate, military and government developers. Prior to discovering his aptitude as an educator, Yakov worked as an architect, project manager and application coder in the trenches of application software development. Yakov holds a Masters in Education with a specialty in instructional design for online learning from Capella University and a BS in math and computer science from Florida International University. Yakov, managing partner of eLearnIT LLC (www.elearnitonline.com), authors and delivers workshops and web based eLearning tutorials to guide professional developers toward PowerBuilder Classic and .NET mastery. Follow Yakov on Twitter as @eLearnPB

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.