Click here to Skip to main content
15,891,033 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.

 
GeneralThe Whole Codebase I inherited [again] Pin
Keith Barrow21-Jun-11 1:46
professionalKeith Barrow21-Jun-11 1:46 
GeneralRe: The Whole Codebase I inherited [again] Pin
Nagy Vilmos21-Jun-11 2:25
professionalNagy Vilmos21-Jun-11 2:25 
GeneralRe: The Whole Codebase I inherited [again] Pin
Keith Barrow21-Jun-11 5:46
professionalKeith Barrow21-Jun-11 5:46 
GeneralRe: The Whole Codebase I inherited [again] Pin
BobJanova21-Jun-11 23:49
BobJanova21-Jun-11 23:49 
GeneralRe: The Whole Codebase I inherited [again] Pin
Pete O'Hanlon21-Jun-11 7:54
mvePete O'Hanlon21-Jun-11 7:54 
GeneralRe: The Whole Codebase I inherited [again] Pin
Keith Barrow21-Jun-11 9:06
professionalKeith Barrow21-Jun-11 9:06 
GeneralRe: The Whole Codebase I inherited [again] Pin
AspDotNetDev21-Jun-11 10:15
protectorAspDotNetDev21-Jun-11 10:15 
GeneralRe: The Whole Codebase I inherited [again] Pin
JV999921-Jun-11 20:31
professionalJV999921-Jun-11 20:31 
Keith Barrow wrote:
public class DeanCollection : List<FacultyDean>
{
}


That's actually not a really strange one. In certain languages you had to define your own lists if you wanted to have them typesafe. Eg; you did have a list of objects, but if you wanted a list of person you had to create your own class. Lots of those programmers who did that in the past took that way of working over in .NET.

Ofcourse with Generic this makes no sense, but those people tend to argue that using the "DeanCollection" abstracts away the "FacultyDean", so that you can always replace it with a different class. I do wonder why you would want that though...


Keith Barrow wrote:
public class NullFacultyDean : FacultyDean
{
public NullFacultyDean()
{
ID = -1;
}
}

I have done that in the past also, only then the other way around Smile | :) . I guess they needed something which represents an empty "FacultyDean" and created it this way instead of a more common:
C#
public FacultyDean Empty
{
get {
 return new FacultyDean() { ID = -1 };
}
}

Ofcourse this code example also doesn't work out of the box, unless you compare the ID's. A normal equal won't work :P

It's always something with code you inherit Wink | ;) I for once got the comments the code was to hard; It had to much inheritance. I could also just have copied the code in all the classes. Much easier to understand! ;x
GeneralRe: The Whole Codebase I inherited [again] Pin
Keith Barrow21-Jun-11 21:24
professionalKeith Barrow21-Jun-11 21:24 
GeneralRe: The Whole Codebase I inherited [again] Pin
JV999921-Jun-11 22:07
professionalJV999921-Jun-11 22:07 
GeneralRe: The Whole Codebase I inherited [again] Pin
Keith Barrow22-Jun-11 8:07
professionalKeith Barrow22-Jun-11 8:07 
GeneralRe: The Whole Codebase I inherited [again] Pin
CDP180222-Jun-11 2:12
CDP180222-Jun-11 2:12 
General(Long) For your enjoyment, legacy PHP web site hell [modified] PinPopular
DoctorOwl20-Jun-11 16:17
DoctorOwl20-Jun-11 16:17 
QuestionWhat do you think of my small game made in Windows API RAW? Pin
andyharglesis17-Jun-11 20:36
andyharglesis17-Jun-11 20:36 
AnswerRe: What do you think of my small game made in Windows API RAW? PinPopular
walterhevedeich17-Jun-11 21:38
professionalwalterhevedeich17-Jun-11 21:38 
GeneralRe: What do you think of my small game made in Windows API RAW? Pin
OriginalGriff17-Jun-11 22:33
mveOriginalGriff17-Jun-11 22:33 
AnswerRe: What do you think of my small game made in Windows API RAW? Pin
AspDotNetDev17-Jun-11 22:38
protectorAspDotNetDev17-Jun-11 22:38 
AnswerRe: What do you think of my small game made in Windows API RAW? Pin
H A Tanner18-Jun-11 9:50
H A Tanner18-Jun-11 9:50 
AnswerRe: What do you think of my small game made in Windows API RAW? PinPopular
RobCroll19-Jun-11 21:29
RobCroll19-Jun-11 21:29 
GeneralRe: What do you think of my small game made in Windows API RAW? Pin
Firo Atrum Ventus19-Jun-11 22:07
Firo Atrum Ventus19-Jun-11 22:07 
AnswerRe: What do you think of my small game made in Windows API RAW? Pin
Ravi Sant19-Jun-11 22:26
Ravi Sant19-Jun-11 22:26 
AnswerRe: What do you think of my small game made in Windows API RAW? Pin
0bx20-Jun-11 0:11
0bx20-Jun-11 0:11 
AnswerRe: What do you think of my small game made in Windows API RAW? Pin
Pete O'Hanlon20-Jun-11 0:53
mvePete O'Hanlon20-Jun-11 0:53 
QuestionRe: What do you think of my small game made in Windows API RAW? Pin
Dimitrios Kalemis22-Jun-11 3:10
Dimitrios Kalemis22-Jun-11 3:10 
AnswerRe: What do you think of my small game made in Windows API RAW? Pin
Mark Bunds4-Aug-11 10:46
Mark Bunds4-Aug-11 10:46 

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.