The Ghetto Mini-Pattern

May 28, 2003 11:14 PM

Name: The Ghetto

Context:

You are in some way subject to architectural, framework or language constraints that force you to write ugly code. For example, your UI framework requires one kind of object, your persistence framework requires another, and you keep having to convert between the two.

Forces:

  • You will not always be in a position to remove the root cause of the ugliness.
  • Ugly code is usually boiler-plate, and not very interesting.
  • It is better not to have ugly, boiler-plate code obscuring code that actually does something interesting.
  • Of course, [insert-your-favourite-language-or-framework-here] is immune to this problem. Obviously this pattern does not apply to you.

Therefore

Hide your ugly code inside a Ghetto. The ghetto is a single file or class where issues of code cleanliness do not apply. It is entered by reputable developers with no small amount of trepidation, and left as quickly as possible. On the other hand, it does the job, and it keeps the bad elements away from more cultured code.

If the constraints that caused you to build a Ghetto are widespread, though, it may end up being the biggest single file in your application.

Examples of use:

None that this author is willing to admit to.

1 TrackBacks

Listed below are links to blogs that reference this entry: The Ghetto Mini-Pattern.

TrackBack URL for this entry: http://fishbowl.pastiche.org/mt-tb.cgi/250

TITLE: The Ghetto Design Pattern URL: http://www.strayneuron.com/mt/archives/000016.html IP: 209.126.199.120 BLOG NAME: Stray Blog DATE: 06/19/2003 06:55:14 PM TITLE: The Ghetto Design Pattern URL: http://www.strayneuron.com/mt/archives/000016.html IP: 209.126.199.120 BLOG NAME: Stray Blog DATE: 06/19/2003 06:55:14 PM Read More

5 Comments

Hah! I love it.

Hah! Indeed. From what I've learned so far, programming with middleware engines tends to be... Ghetto-riffic.

Why is it that I always inherit Ghettos from folks "moving on" to another part of the project?

LOL...great work

At last! The one pattern that was missing the will allow me to migrate VB apps! ;)

Comments are no longer being accepted for this blog entry. If you really want to make your voice heard, you can always email me.

Previously: This one is Alan's fault

Next: Impossible Performance Art