Techniques - DevSource
DevSource: Microsoft Developer Resource DevSource Home Sponsored by Microsoft Home Add Ons Architecture Languages Techniques Using VS Forums
Home arrow Techniques arrow Getting Rid of Gobject Oriented Programming
Getting Rid of Gobject Oriented Programming
By Paul Kimmel

Rate This Article: Add This Article To:

Getting Rid of Gobject Oriented Programming
( Page 1 of 3 )

Why does your code stink? Oh, sorry: we mean the code that the guy in the next cube is writing. Paul Kimmel discusses the stench of bad code and what you can do about it -- and he will probably make you laugh out loud, too.

The basic idea behind new words is that one has to define them (and then get Webster to publish them). I have a new word and acronym that I'd like Webster to consider. GlOP is an acronym for Gobject Oriented Programming. A Gobject is a GUI-Object, or a disorganized, all-encompassing, monolithic pile of brain droppings packed into the GUI.

It doesn't matter whether you program for Windows, Linux, or the Web; it is possible to create gobjects in any of these environments with any tool. I talk about GlOP here in the context of .NET because I really like the .NET Framework, and really hate to see .NET GlOP. (Besides, those UNIX folks have had 35 years to get it right, and as far as I am concerned their time is up.)

ADVERTISEMENT

In this article, I will talk about ways to identify and eradicate GlOP and explain measures that enable you to prevent GlOP in the first place.

Warning: in this article "you" is employed as a pejorative. However, you is used because it is the shortest pronoun that is not "I," and I don't mean "you" you, rather I am referring to the person in the Dilbert cube next to you.

GlOP is Caused by a Disease of the Mind

Like mad cow disease, Gloppiness is a disease of the mind. However, its root cause is reading too few books, not eating red meat or associating with jittery cows.

I try to convince my children that the idea behind Harry Potter and all those trips to the Flourish and Blotts bookstore is that J.K. Rowling is trying to convince children that magic can be found in books, that there is true power in reading. Only my daughter is buying it. My sons aren't buying it. Neither, apparently, are most programmers. (My daughter takes pride in the knowing that the boys will be working for her one day.)

The only real way to be less gloppy is to read, read, read. Read code. Read books about code. Read magazine articles. Read white papers and request for comments (RFCs). Read everything you can get your hands on.

So Much GlOP and So Little Time

I have explained what the root cause of GlOP is—not reading—but have not adequately demonstrated GlOP. This is because GlOP is very hard to create once you have been cured. Or, perhaps, the real problem is that those creating GlOP don't recognize the mess for what it is.

There is so much GlOP and so little time, but here are some statements that will help you identify gloppy brain droppings. See how many of these you — er, the programmer in the next cube, I mean — are guilty of.

  • The code smells, or people look at the code and say it smells fishy
  • No one ever mentions the words refactoring, refactor, or refactored
  • No one in the office has a copy of copies of Design Patterns (by Erich Gamma, et. al.) or Refactoring: Improving the Design of Existing Code (by Martin Fowler)
  • Anti-Pattern? What's an Anti-Pattern?
  • The problem was decomposed by creating GUIs first and last
  • The only inspections and walkthroughs that happen are when OSHA shows up
  • You are the programmer and tester both
  • No one ever mentions the word pattern
  • Your application is comprised of one assembly (.DLL or .EXE)
  • Delegate? What's a delegate?
  • Event handlers are created by clicking on a control only
  • Your SQL code is mixed in with all of your other code
  • Stored procedure? What's a stored procedure?
  • The code has one class and one method named anything like go, doit, calc, calcall, run, or process
  • The only classes in your application are Forms or Web Pages
  • If creating an instance of a form is something the language does automatically
  • You think declaring a data type is optional
  • Random prefix notations, inconsistent abbreviations, or leaving vowels out of method, argument, field, class, interface, or event names seems like a good idea
  • You don't know what the things in the preceding statement are
  • You can take or leave exception handling
  • You use error codes or flags and think it's a good strategy
  • You still don't understand what an interface is for
  • You think VB6 is a good-object oriented language
  • Testing is the first thing cut from the schedule

Rather than try to provide examples of GlOP (it's too depressing), let's talk more about how to identify it, fix it, and then prevent its future reoccurrence.



 
 
>>> More Techniques Articles          >>> More By Paul Kimmel
 



Microsoft's Future: A Chat With Their CTO, Barry Briggs

Play Video >

All Videos >

Julia explores the Robotics Studio!

Read now >

Messages to Bill Gates!

Read now >

View Now
DevSource RSS FEEDS
XML Want an easy way to keep up with breaking tech news? And the Get DevSource headlines delivered to your desktop with RSS.