Click here to Skip to main content
11,485,965 members (74,017 online)

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, embarrasing 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.

 
AnswerRe: Which code you suggest? Pin
_Damian S_24-Jul-13 22:02
professional_Damian S_24-Jul-13 22:02 
AnswerRe: Which code you suggest? Pin
ihoecken25-Jul-13 4:42
memberihoecken25-Jul-13 4:42 
AnswerRe: Which code you suggest? Pin
ryanb3125-Jul-13 5:48
memberryanb3125-Jul-13 5:48 
GeneralRe: Which code you suggest? Pin
OriginalGriff25-Jul-13 6:04
protectorOriginalGriff25-Jul-13 6:04 
I think that's an unnecessary restriction - I prefer to do all my validation code / user notification en mass at the top of a method, and exit immediately.
if (!userGotHisNameRight)
   Report It
   return
if (!userManganagedHisAddressOK)
   Report It
   return
if (...)
   ...
Actual work the method is supposed to do
The alternataive being:
if (!userGotHisNameRight)
   Report It
else if (!userManganagedHisAddressOK)
   Report It
else if (...)
   ...
else
   {
   Actual work the method is supposed to do
   }
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)

GeneralRe: Which code you suggest? Pin
ryanb3125-Jul-13 6:11
memberryanb3125-Jul-13 6:11 
GeneralRe: Which code you suggest? Pin
Sentenryu25-Jul-13 8:15
memberSentenryu25-Jul-13 8:15 
GeneralRe: Which code you suggest? Pin
ryanb3125-Jul-13 8:32
memberryanb3125-Jul-13 8:32 
GeneralRe: Which code you suggest? Pin
OriginalGriff25-Jul-13 9:26
protectorOriginalGriff25-Jul-13 9:26 
GeneralRe: Which code you suggest? Pin
ryanb3125-Jul-13 9:28
memberryanb3125-Jul-13 9:28 
GeneralRe: Which code you suggest? Pin
OriginalGriff25-Jul-13 9:31
protectorOriginalGriff25-Jul-13 9:31 

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

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


Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 26 May 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid