Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
wrok
Mar 24, 2006

by angerbotSD

Janin posted:

They wrap every "cryptic" function with a "properly named" one, usually without bothering to figure out the exact behavior of the function being wrapped:

unlink -> TryToRemoveFile
rand -> GenerateRandomNumber, GenerateRandomNumberEx
stat -> ReadFileInfo, ReadFileInfoW

etc

Okay, so 'TryToRemoveFile' is pretty bad. As is Ex and W.

Verbose names though? Sorry my IDE autocompletes and I can name things descriptively :ohdear:

Adbot
ADBOT LOVES YOU

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

wrok posted:

Verbose names though? Sorry my IDE autocompletes and I can name things descriptively :ohdear:

Goondolences about your small vocabulary.

Captain Capacitor
Jan 21, 2008

The code you say?

Avenging Dentist posted:

Goondolences about your small vocabulary.

Suppose it could be worse, PHP devs seems to like the complete opposite of the spectrum, i.e. T_PAAMAYIM_NEKUDOTAYIM.

(Yes, I'm well aware of the etymological reasons behind this name)

Ogive
Dec 22, 2002

by Lowtax

Avenging Dentist posted:

Goondolences about your small vocabulary.

I was going to complain, but then I typed "Goondo" about your small vocabulary.

Scaevolus
Apr 16, 2007

Captain Capacitor posted:

(Yes, I'm well aware of the etymological reasons behind this name)

It doesn't make it any less of a horror.

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
615 Line switch statement to parse "I can't believe it's not HTML" badly

(from the source code of pidgin, in gtkimhtml.c)

BigRedDot
Mar 6, 2008

Otto Skorzeny posted:

(from the source code of pidgin, in gtkimhtml.c)
from here, there are naught but coding horrors.

Also, the pidgin devs are arrogant dicks.

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
Also Pidgin is terrible and I was really psyched when I found out that Gnome got rid of it as the default IM client until I found out they replaced it with Empathy.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Avenging Dentist posted:

Also Pidgin is terrible and I was really psyched when I found out that Gnome got rid of it as the default IM client until I found out they replaced it with Empathy.

You are the coding horror. You should never be psyched for any IM that runs on Linux.

BigRedDot
Mar 6, 2008

:goonsay:

hurp durp durp

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"
code:
                case 23:    /* TITLE */
                    /* FIXME: what was this supposed to do anyway? */
                    title++;
                    break;
                case 24:    /* /TITLE */
                    /* FIXME: make this undo whatever 23 was supposed to do */
:allears:

Captain Capacitor
Jan 21, 2008

The code you say?
code:
if (font->face && (atoi(font->face) > 100))
 {
                            /* WTF is this? */
                            /* Maybe it sets a max size on the font face?  I seem to
                             * remember bad things happening if the font size was
                             * 2 billion */
                            g_free(font->face);
                            font->face = g_strdup("100");
}
:psyduck:

Shumagorath
Jun 6, 2001

Otto Skorzeny posted:

615 Line switch statement to parse "I can't believe it's not HTML" badly

(from the source code of pidgin, in gtkimhtml.c)
Ahahaha, pidgin. I can't believe I put up with that program just to have three people I didn't actually know on AIM. I'm so glad I switched to MSN + A-Patch right around when they started having a code fork feud over allowing Shift+Enter to send.

floWenoL
Oct 23, 2002

BigRedDot posted:

from here, there are naught but coding horrors.

A gtk horror, from the Chromium valgrind suppressions file:

code:
{
   gtk developers don't like cleaning up one-time leaks.  See [url]http://mail.gnome.org/archives/gtk-devel-list/2004-April/msg00230.html[/url]
   Memcheck:Leak
   ...
   fun:gtk_init_check
}

NotShadowStar
Sep 20, 2000

Otto Skorzeny posted:

615 Line switch statement to parse "I can't believe it's not HTML" badly

(from the source code of pidgin, in gtkimhtml.c)

It's really true, a state machine lexical parser is too :psyduck: for the average coder. The person who wrote this needs to be chained in a basement with nothing but Ragel and water for a week.

HFX
Nov 29, 2004
I thought my coworkers were the only ones who coded like that.

Also, the next person who tells me Object Orientation sucks because V-Pointers make everything slow, I think I'm going to shove that case statement in their face.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
What do objects and that switch statement have in common? Or why would that shut them up in that debate?

HFX
Nov 29, 2004

pokeyman posted:

What do objects and that switch statement have in common? Or why would that shut them up in that debate?

The people who have complained that they hate object orientation because it is slow tend to write their code like the linked switch statement. Or more appropriately, they will try to write something using a switch to avoid using object v-pointers. Overtime however, the switch statement dissolves into similar statements as above.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Oh, ok. Carry on with the unmasking of the incompetent coworkers!

Crazy RRRussian
Mar 5, 2010

by Fistgrrl

HFX posted:

The people who have complained that they hate object orientation because it is slow tend to write their code like the linked switch statement. Or more appropriately, they will try to write something using a switch to avoid using object v-pointers. Overtime however, the switch statement dissolves into similar statements as above.

By this, do you mean using polymorphism and passing a pointer of super class type and calling virtual functions on it?

HFX
Nov 29, 2004

LockeNess Monster posted:

By this, do you mean using polymorphism and passing a pointer of super class type and calling virtual functions on it?

This is what I usually see:

code:

int somefunction (struct/object whatever) {
switch (whatever->specialcode) {
case 1: 
     someline;
     someline2;
     someline3;
     break;
case 2:
     someline;
     someline2;
     someline3;
     someotherline;
     break;
case 3:
     someline;
     someline2;
     someline3;
     someotherline2;
     break;
...
case 50something: 
     someline;
     someline2;
     someline3;
     someotherline51;
     break;
}
That pretty much sums up most of the switch statements I see. Occasionally one will get creative and wrap a few cases together with a fall through to some common code. I've yet to see one bind to a struct a function pointer to avoid the switch statement. I tried showing one how when creating the struct, since he always knew what code he wanted to call he could use a function pointer in the struct to call it. He then tried to use it in a switch statement. :psyduck:

So yes, it seems many of them while "knowing" Java, C++, whatever else, don't understand polymorphism, inheritance, etc. Every datastructure usually ends up being an array or if I'm lucky a containerized array. I might get a hashmap if the language has good support for it. Linked lists, trees, etc can be a total crap shoot.

I shouldn't say all my coworkers are that way. Some are very good and have good practices. Unfortunately, most of them leave after a year or two.

HFX fucked around with this message at 16:01 on Apr 12, 2010

Zombywuf
Mar 29, 2008

HFX posted:

This is what I usually see:
code:
int somefunction (struct/object whatever) {
switch (whatever->specialcode) {
case 1: 
     someline;
     someline2;
     someline3;
     break;
case 2:
     someline;
     someline2;
     someline3;
     someotherline;
     break;
case 3:
     someline;
     someline2;
     someline3;
     someotherline2;
     break;
...
case 50something: 
     someline;
     someline2;
     someline3;
     someotherline51;
     break;
}
This has nothing to do with the switch statement from pidgin's HTML parser.

Gashroom
Jul 13, 2005

floWenoL posted:

A gtk horror, from the Chromium valgrind suppressions file:

code:
{
   gtk developers don't like cleaning up one-time leaks.  See [url]http://mail.gnome.org/archives/gtk-devel-list/2004-April/msg00230.html[/url]
   Memcheck:Leak
   ...
   fun:gtk_init_check
}
Even the simplest Qt application has a bazillion leak reports as GTK, Fontconfig etc. don't bother fixing their trivial leaks.

ehnus
Apr 16, 2003

Now you're thinking with portals!
Encountered today:

code:
public:
//private:
It's not as elaborately and stupid as most of these other coding horrors but it still makes me wonder what the intent was, why this was done, and if I can change it back without breaking people who may be depending on these private members now being public.

ehnus fucked around with this message at 04:32 on Apr 14, 2010

Mustach
Mar 2, 2003

In this long line, there's been some real strange genes. You've got 'em all, with some extras thrown in.
Do it.

A A 2 3 5 8 K
Nov 24, 2003
Illiteracy... what does that word even mean?

ehnus posted:

code:
public:
//private:
It's not as elaborately and stupid as most of these other coding horrors but it still makes me wonder what the intent was, why this was done, and can I change it back without breaking people who may be depending on these private members now being public.

Always make backward-incompatible changes after consulting a group of strangers on the internet but before consulting your team.

Shavnir
Apr 5, 2005

A MAN'S DREAM CAN NEVER DIE

ehnus posted:

Encountered today:

code:
public:
//private:
It's not as elaborately and stupid as most of these other coding horrors but it still makes me wonder what the intent was, why this was done, and can I change it back without breaking people who may be depending on these private members now being public.

Ask them loudly in front of the non-technical staff to stop exposing their privates. :v:

ToxicFrog
Apr 26, 2008


ehnus posted:

Encountered today:

code:
public:
//private:
It's not as elaborately and stupid as most of these other coding horrors but it still makes me wonder what the intent was, why this was done, and can I change it back without breaking people who may be depending on these private members now being public.

If this were any other thread, I would say "check the version control logs".

ehnus
Apr 16, 2003

Now you're thinking with portals!

A A 2 3 5 8 K posted:

Always make backward-incompatible changes after consulting a group of strangers on the internet but before consulting your team.

That wasn't a question for this thread, I guess my original wording wasn't clear enough.

I know who made this change but they are no longer with my company.

Mr.Radar
Nov 5, 2005

You guys aren't going to believe this, but that guy is our games teacher.

ehnus posted:

Encountered today:

code:
public:
//private:
It's not as elaborately and stupid as most of these other coding horrors but it still makes me wonder what the intent was, why this was done, and if I can change it back without breaking people who may be depending on these private members now being public.
code:
#define private public
Yes, this is actually out there...

Crazy RRRussian
Mar 5, 2010

by Fistgrrl
Probably its because someone is too lazy to make accessor/modifier methods?

The1ManMoshPit
Apr 17, 2005

Mr.Radar posted:

code:
#define private public
Yes, this is actually out there...

code:
#define private public
#define protected public
#define class struct
Accept no substitutes.

Shumagorath
Jun 6, 2001
That reminds me of an article a friend showed me where some guy was claiming he could duplicate all the functionality of C++ with < 500 lines of C.

HFX
Nov 29, 2004

Shumagorath posted:

That reminds me of an article a friend showed me where some guy was claiming he could duplicate all the functionality of C++ with < 500 lines of C.

You probably could. It just wouldn't be pretty and would take the approach of don't know don't care

zero knowledge
Apr 27, 2008

HFX posted:

You probably could. It just wouldn't be pretty and would take the approach of don't know don't care

You absolutely could. They call it Objective-C, although I think it took a little more than 500 lines.

ErIog
Jul 11, 2001

:nsacloud:

Shumagorath posted:

That reminds me of an article a friend showed me where some guy was claiming he could duplicate all the functionality of C++ with < 500 lines of C.

I love the mentality required to write something like this. "Guys..this C++ thing is just a tool of the man that we don't need."

Toady
Jan 12, 2009

ErIog posted:

I love the mentality required to write something like this. "Guys..this C++ thing is just a tool of the man that we don't need."

On a somewhat related note, why are many new coders full of distrust and want to roll things on their own? No matter how much you tell them it's a bad idea, they will not listen to you. They'll even be polite about it, but you'll never convince them otherwise.

It's surprising how many people show up to #macdev:
  • Insisting on setting up controls programmatically because using IBOutlets is too magical.
  • Doing their own SQLite3 layer instead of using Core Data.
  • Subclassing everything. If a cell needs to display a sheet when double-clicked, they want to create a whole new table view.

Doing these things doesn't help them learn how things work. It just frustrates them and fills the channel with questions that are usually answered with, "Why are you doing that? Just use so-and-so API."

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

ErIog posted:

I love the mentality required to write something like this. "Guys..this C++ thing is just a tool of the man that we don't need."

The problem with C++ is that something like 90% of it is actively harmful to writing working code. Sure, it works fine if you take away exceptions, overloading, templates, multiple inheritance, <iostream>, and write your own string type. But at that point, it's easier to just use C so you don't have to deal with the generally low quality of C++ compilers.

Mustach
Mar 2, 2003

In this long line, there's been some real strange genes. You've got 'em all, with some extras thrown in.
Finally, a troll post.

Adbot
ADBOT LOVES YOU

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"

Toady posted:

It's surprising how many people show up to #macdev:
  • Insisting on setting up controls programmatically because using IBOutlets is too magical.
  • Doing their own SQLite3 layer instead of using Core Data.
  • Subclassing everything. If a cell needs to display a sheet when double-clicked, they want to create a whole new table view.

The second one is just foolish, but I can understand the first and the third points. When I made the switch to OS X a few years ago, coming from a Windows development background it took me a little bit of time to really understand how Interface Builder worked differently from, say, the Windows dialog resource editor (:gonk:) or the Windows Forms editor.

The third point might come from that same mindset, where on Windows, almost everything is customized by subclassing and overriding methods. The delegation pattern that OS X makes so much use of is almost nonexistent there, so it's a big mental shift when you first get started.

Now if these are programmers with years of OS X experience wanting to do these things, gently caress 'em.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply