![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Think
I recently saw an example of a "design pattern". This pattern used 151 lines of code (281, counting comments) to provide a class that could store or return one of the values, True, or False.
An example of invocation? YesNoFactory.getFactoryInstance().YES.getDescription().equals(array[0].toUpperCase()); I really think I could beat this with a bool or an int. Don't fall for BS; think for yourselves. Support it by learning, not by high-priestly worship of false, self-anointed gurus. You don't need to kiss the hem of their robe, much less their ass, if you just look around and think.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#2 |
|
Professional Programmer
![]() Join Date: Sep 2005
Posts: 419
Rep Power: 4
![]() |
Re: Think
That's an impressive WTF. Did you find it in real code, or is it a joke?
>I really think I could beat this with a bool or an int. How? It looks like that code is just a glorified no-op, if all it does is compare the string against "YES" and ignore the result. >Don't fall for BS; think for yourselves. That reminds me of the time that I laughed in a guy's face when he explained design patterns to me.
__________________
Even if the voices aren't real, they have some pretty good ideas. |
|
|
|
|
|
#3 |
|
12 years old
Join Date: Nov 2007
Posts: 104
Rep Power: 0
![]() |
Re: Think
He found it, it was in someone's sig.
|
|
|
|
|
|
#4 |
|
Troll
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4
![]() |
Re: Think
TextEncoding.getSystemDefault().createTextWriter(
EnvironmentManager.getDefaultInstance().
getStandardIOFactory().createOutputStream()).
write(LocalizationManager.getInstance().
getTranslatedStringForCurrentCulture("Hello World").
concat(EnvironmentManager.getSystemNewLine()));
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270 |
|
|
|
|
|
#5 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Re: Think
It wasn't in someone's sig. It was a blog post on a blog called something similar to "How ugly is this." It's nice to know you aren't really looking over my shoulder, or living in my head, null. I'm too young to commit suicide.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#6 |
|
Hobbyist Programmer
|
Re: Think
It was on The Daily WTF earlier this month. Great blog.
Edit: Oh, right, its called "Worse Than Failure" now. I liked the old name better. |
|
|
|
|
|
#7 |
|
Hobbyist Programmer
Join Date: May 2006
Location: West Jordan, Utah, United States
Posts: 176
Rep Power: 3
![]() |
Re: Think
Maybe that class parses values for yes and no, i.e
"yes" -> "Yes" "y" -> "Yes" "true" -> "Yes" "definitely" -> "Yes" In which case, 151 lines of code may not be bad. |
|
|
|
|
|
#8 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Re: Think
Well, son, whatever you think. I'm sure you can find a fool to cut your a check for a few cents on the dollar....
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#9 |
|
Hobbyist Programmer
|
Re: Think
If thats the case, its a solution to a problem that should not have existed in the first place. And if you did have to solve it, you could use a one line regex instead of some big ugly behemoth.
|
|
|
|
|
|
#10 |
|
Professional Programmer
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 380
Rep Power: 3
![]() |
Re: Think
If someone actually did that they would have to be mentally retarded, and even then it would not be acceptable.
__________________
I am Addicted to Linux! |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|