Click here to Skip to main content
15,923,006 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: Aaaarg....use the namespace Pin
PIEBALDconsult12-Jun-12 3:51
mvePIEBALDconsult12-Jun-12 3:51 
GeneralRe: Aaaarg....use the namespace Pin
Sentenryu12-Jun-12 4:41
Sentenryu12-Jun-12 4:41 
GeneralRe: Aaaarg....use the namespace Pin
PIEBALDconsult12-Jun-12 4:50
mvePIEBALDconsult12-Jun-12 4:50 
GeneralRe: Aaaarg....use the namespace Pin
Sentenryu12-Jun-12 5:12
Sentenryu12-Jun-12 5:12 
GeneralRe: Aaaarg....use the namespace Pin
PIEBALDconsult12-Jun-12 8:23
mvePIEBALDconsult12-Jun-12 8:23 
GeneralRe: Aaaarg....use the namespace Pin
Sentenryu12-Jun-12 8:55
Sentenryu12-Jun-12 8:55 
GeneralRe: Aaaarg....use the namespace Pin
thatraja14-Jun-12 23:00
professionalthatraja14-Jun-12 23:00 
GeneralRe: Aaaarg....use the namespace Pin
Sander Rossel15-Jun-12 13:04
professionalSander Rossel15-Jun-12 13:04 
Not that it's a good excuse, but it makes copy/pasting the code easier Smile | :)
If you'd import the System.Text Namespace and copy/pasted the entire thing to another file you'd get an error for every StringBuilder.

StringBuilder is a common class that should be known to all programmers, but for some of the more 'obscure' classes I prefer to use the entire namespace.
Something like: SomeCompany.ThirdPartyTool.Library.PartINeed.SubPart.TheActualClass.
At least now everyone who reads the code knows where this TheActualClass comes from, even if they didn't know the third party component.

What I find even more annoying than having System.Text.StringBuilder 100+ times in your code is having lots of imports/using statements at the top of every code file. Especially when half of them aren't used. In C# you can right-click and remove unused imports. VB (unfortunately) doesn't have this option (and please save me the C# vs. VB discussion).

I wouldn't call this a code horror, but in this case an import of System.Text does seem logical.
The real horror might be that you use 100+ StringBuilders instead of re-use one... But I'll leave that to you Smile | :)
It's an OO world.
C#
public class Naerling : Lazy<Person>{
    public void DoWork(){ throw new NotImplementedException(); }
}

GeneralRe: Aaaarg....use the namespace Pin
Edward Giles22-Jul-12 12:39
Edward Giles22-Jul-12 12:39 
GeneralRe: Aaaarg....use the namespace Pin
Sander Rossel22-Jul-12 20:10
professionalSander Rossel22-Jul-12 20:10 
GeneralWhat can you do when you have different timetable Pin
Mohibur Rashid10-Jun-12 20:52
professionalMohibur Rashid10-Jun-12 20:52 
GeneralRe: What can you do when you have different timetable Pin
RobCroll11-Jun-12 13:38
RobCroll11-Jun-12 13:38 
GeneralRe: What can you do when you have different timetable Pin
Ingo11-Jun-12 21:37
Ingo11-Jun-12 21:37 
GeneralRe: What can you do when you have different timetable Pin
Mohibur Rashid11-Jun-12 22:59
professionalMohibur Rashid11-Jun-12 22:59 
GeneralRe: What can you do when you have different timetable Pin
Ingo12-Jun-12 3:25
Ingo12-Jun-12 3:25 
GeneralBridging ObjectDataSource to Entity Framework with a Generic BusinessObject Pin
Woppelmann P9-Jun-12 2:32
Woppelmann P9-Jun-12 2:32 
GeneralRe: Bridging ObjectDataSource to Entity Framework with a Generic BusinessObject Pin
_Amy28-Jun-12 22:23
professional_Amy28-Jun-12 22:23 
GeneralThe lazy way to check if the file is present. Pin
Ammar_Ahmad8-Jun-12 11:11
Ammar_Ahmad8-Jun-12 11:11 
GeneralRe: The lazy way to check if the file is present. Pin
Pascal Ganaye8-Jun-12 11:23
Pascal Ganaye8-Jun-12 11:23 
GeneralRe: The lazy way to check if the file is present. Pin
Eddy Vluggen8-Jun-12 11:40
professionalEddy Vluggen8-Jun-12 11:40 
GeneralRe: The lazy way to check if the file is present. Pin
PIEBALDconsult9-Jun-12 6:00
mvePIEBALDconsult9-Jun-12 6:00 
GeneralRe: The lazy way to check if the file is present. Pin
Pascal Ganaye9-Jun-12 6:39
Pascal Ganaye9-Jun-12 6:39 
RantAttack of the stord proc Pin
virang_217-Jun-12 16:59
virang_217-Jun-12 16:59 
GeneralRe: Attack of the stord proc PinPopular
Manfred Rudolf Bihy7-Jun-12 22:11
professionalManfred Rudolf Bihy7-Jun-12 22:11 
GeneralRe: Attack of the stord proc Pin
virang_218-Jun-12 2:52
virang_218-Jun-12 2:52 

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.