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.
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! ;)