Click here to Skip to main content
15,902,198 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: Guess His Experience Level Pin
Thomas Weller2-Apr-09 0:57
Thomas Weller2-Apr-09 0:57 
JokeRe: Guess His Experience Level Pin
BadKarma2-Apr-09 22:14
BadKarma2-Apr-09 22:14 
JokeRe: Guess His Experience Level Pin
Thomas Weller3-Apr-09 2:49
Thomas Weller3-Apr-09 2:49 
GeneralRe: Guess His Experience Level Pin
akyriako782-Apr-09 1:51
akyriako782-Apr-09 1:51 
GeneralRe: Guess His Experience Level Pin
akyriako782-Apr-09 1:57
akyriako782-Apr-09 1:57 
GeneralRe: Guess His Experience Level Pin
EyeYamFedUp2-Apr-09 2:28
EyeYamFedUp2-Apr-09 2:28 
GeneralRe: Guess His Experience Level Pin
akyriako782-Apr-09 21:31
akyriako782-Apr-09 21:31 
GeneralRe: KISS and Structured Code [modified] Pin
Tristan Rhodes3-Apr-09 0:40
Tristan Rhodes3-Apr-09 0:40 
Looks like the kind of code my last boss would write.... bizzarely enough he seemed to recite "Keep it Simple Stupid" and "Structured Coding Practices" and swore by Code Complete.... like using them as some kind of protective mantra would do any good for the abomination created.

After opening his core business app to find most web pages with 750 line page load functions, dozens of nested conditions (Loop / If / Case anyone?) and all the variables declared at the page leve, which served up a range of pages based on seemingly arbitrary values... i asked for help. "It's in the code, read it."

I did take away some fantastic coding advice:

* Only one return per function (no short circuit conditions), leading to horrendous nesting.
* Don't use Data Access layers, they're a waste of time, just use inline SQL and bind to a DataReader.
* Don't create lots of objects, it's slow.
* Don't break things into sub functions, it's harder to read and slower.
* Don't use constants, it's hard to read the literal representation.
* Don't use Serialization (Xml or otherwise - My understanding of serialization is object state persistence so I'm not sure how to persist without it).
* Don't use wrappers, ever, as you will just end up with wrappers in wrappers.
* Don't use Inheritance, it's complicated.
* Don't use Interfaces, they're unescessary.
* Don't make custom controls
* Don't use design patterns, they just complicate things.
* Don't use code generators, they generate slow / too much code.
* Don't bother with resources until we need to globalize the app.
* Don't make unit tests, waste of time, we can just user test it.

Now, without any of the above application structures, and the functional requirement to add Multi Language support, change the database schema (slighltly), and add cross site functionality to each page....

Needless to say, the code debt was massive, and maintenance was a time sync of code + fix with no coherent strategy.

Did i mention he was the CTO? Big Grin | :-D

Regards

-------------------------------

Carrier Bags - 21st Century Tumbleweed.

modified on Friday, April 3, 2009 6:58 AM

GeneralRe: KISS and Structured Code Pin
Pete O'Hanlon3-Apr-09 2:02
mvePete O'Hanlon3-Apr-09 2:02 
GeneralRe: KISS and Structured Code Pin
Nagy Vilmos3-Apr-09 3:14
professionalNagy Vilmos3-Apr-09 3:14 
GeneralRe: KISS and Structured Code Pin
Pete O'Hanlon3-Apr-09 3:38
mvePete O'Hanlon3-Apr-09 3:38 
GeneralRe: KISS and Structured Code [modified] Pin
Tristan Rhodes3-Apr-09 6:24
Tristan Rhodes3-Apr-09 6:24 
GeneralRe: KISS and Structured Code Pin
jayart6-Apr-09 0:08
jayart6-Apr-09 0:08 
GeneralRe: KISS and Structured Code Pin
Dan Neely6-Apr-09 2:25
Dan Neely6-Apr-09 2:25 
JokeRe: KISS and Structured Code Pin
Luc Pattyn6-Apr-09 4:45
sitebuilderLuc Pattyn6-Apr-09 4:45 
GeneralRe: KISS and Structured Code Pin
Dan Neely6-Apr-09 5:18
Dan Neely6-Apr-09 5:18 
GeneralRe: KISS and Structured Code Pin
Tristan Rhodes7-Apr-09 2:22
Tristan Rhodes7-Apr-09 2:22 
GeneralRe: KISS and Structured Code Pin
Luc Pattyn7-Apr-09 3:09
sitebuilderLuc Pattyn7-Apr-09 3:09 
GeneralRe: KISS and Structured Code Pin
kfoster6-Apr-09 13:24
kfoster6-Apr-09 13:24 
GeneralRe: KISS and Structured Code Pin
Pete O'Hanlon12-Apr-09 10:40
mvePete O'Hanlon12-Apr-09 10:40 
GeneralRe: KISS and Structured Code Pin
OriginalGriff14-Apr-09 6:04
mveOriginalGriff14-Apr-09 6:04 
GeneralRe: Guess His Experience Level Pin
akyriako782-Apr-09 2:00
akyriako782-Apr-09 2:00 
JokeRe: Guess His Experience Level Pin
Pete O'Hanlon2-Apr-09 2:20
mvePete O'Hanlon2-Apr-09 2:20 
JokeRe: Guess His Experience Level Pin
Thomas Weller2-Apr-09 2:29
Thomas Weller2-Apr-09 2:29 
GeneralInitializing an array of structures PinPopular
Adrian Cole23-Mar-09 8:10
Adrian Cole23-Mar-09 8:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.