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
Maw
Feb 18, 2013

Mere minutes after discovering the new technology, it was used to send me a crude ASCII dong.


Part of the codebase at work was all last changed by someone who worked here before me, and every single if statement looks like this:

code:
if (list == null ? false : list.Count > 0 ? true : false) {
    //stuff
}
I don't know if they had just learnt about the ternary operator or didn't know about the existence of &&. || etc, but it's much more awkward to read than it needs to be.

Adbot
ADBOT LOVES YOU

Spatial
Nov 15, 2007

Student or developer with 4+ years of experience? You decide.
code:
typedef struct {
	command_t com;
	error_t   err;
	uint32_t  arg0;
	uint32_t  arg1;
	uint32_t  arg2;
	uint32_t  arg3;
	uint32_t  arg4;
	uint32_t  arg5;
	uint32_t  arg6;
	uint32_t  arg7;
	uint32_t  arg8;
	uint32_t  arg9;
	uint32_t  arg10;
	uint32_t  arg11;
	uint32_t  arg12;
	uint32_t  arg13;
	uint32_t  arg14;
	uint32_t  arg15;
} core_data_t;

uint32_t read_Arg( uint32_t i ) {
    return * (uint32_t*) (((char*) &core_data.arg0) + i * 4);
}

dougdrums
Feb 25, 2005
CLIENT REQUESTED ELECTRONIC FUNDING RECEIPT (FUNDS NOW)
I'm guessing a very weird assembly programmer? Like he's trying to do mov eax, dword ptr [ptr + ecx * 4]. I do stupid type stuff like that sometimes after working in assembly a lot, but not quite to that degree. Also parenthesis ...

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.
Well ok it's Monday, let me take a look at that other project boss man wants me to clean up.

code:

$ grep -R private *|wc -l
0

$ grep -R public *|wc -l
1934

:stonklol:

VikingofRock
Aug 24, 2008




leper khan posted:

Well ok it's Monday, let me take a look at that other project boss man wants me to clean up.

code:

$ grep -R private *|wc -l
0

$ grep -R public *|wc -l
1934

:stonklol:

Yikes, piping to wc -l instead of using grep's -c option definitely qualifies as a horror.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

VikingofRock posted:

Yikes, piping to wc -l instead of using grep's -c option definitely qualifies as a horror.

More or less of a horror than going through the effort to memorize every flag for every marginally useful Unix utility?

Edward_Tohr
Aug 11, 2012

In lieu of meaningful text, I'm just going to mention I've been exploding all day and now it hurts to breathe, so I'm sure you all understand.

leper khan posted:

More or less of a horror than going through the effort to memorize every flag for every marginally useful Unix utility?

Really, the only flag you need to know is --help. The rest takes care of itself from there. :v:

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

VikingofRock posted:

Yikes, piping to wc -l instead of using grep's -c option definitely qualifies as a horror.

cat -v considered harmful

JawnV6
Jul 4, 2004

So hot ...

Edward_Tohr posted:

Really, the only flag you need to know is --help. The rest takes care of itself from there. :v:
code:
$ echo --help
--help
$

Volguus
Mar 3, 2009
Which brings us to the second "flag" you need to know: "man echo" . For more detailed information, you can always check the info pages as well.

VikingofRock
Aug 24, 2008




leper khan posted:

More or less of a horror than going through the effort to memorize every flag for every marginally useful Unix utility?

Touché, although I was just being snarky there. Lack of encapsulation is obviously a much bigger horror (in what I'm assuming is a Java or C++ context).

fritz
Jul 26, 2003

Suspicious Dish posted:

cat -v considered harmful

cat-v.org considered tiresome.

Edison was a dick
Apr 3, 2010

direct current :roboluv: only

Volguus posted:

Which brings us to the second "flag" you need to know: "man echo" . For more detailed information, you can always check the info pages as well.

Except echo is also a built-in, so you need "help echo".

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

leper khan posted:

More or less of a horror than going through the effort to memorize every flag for every marginally useful Unix utility?

Plus, piping together a "text finder" utility and a "word count" utility seems more in line with ~~~~~THE UNIX PHILOSOPHY~~~~~ than using a flag which tells the text finder to do a word count.

Soricidus
Oct 21, 2010
freedom-hating statist shill
code:
val object = reallyExpensiveCreationMethod()
if (objectIsNeeded) {
    useObject(object);
}

easiest optimisation opportunity ever, but gently caress the guy who made me have to find it

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
The expense is mentioned right in the function name, it's your own drat fault.

Kazinsal
Dec 13, 2011

fritz posted:

cat-v.org considered tiresome.

I always felt like the Peoples Front of Cat-V seemed like it was a spin-off of SA. I could be entirely wrong though.

JawnV6
Jul 4, 2004

So hot ...

VikingofRock posted:

Yikes, piping to wc -l instead of using grep's -c option definitely qualifies as a horror.

No, -Rc is useless garbage. I don't care how many frickin' object files have :0 and polluting my output with every single one of them obscures the .cpp's which might actually have :1 or :2. -Rc also doesn't sum across the files and give you the total across all of them, which piping to wc -l does.

Basically, I don't think you thought his offhand joke all the way through.

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?

leper khan posted:

Well ok it's Monday, let me take a look at that other project boss man wants me to clean up.

code:
$ grep -R private *|wc -l
0

$ grep -R public *|wc -l
1934
:stonklol:

What language is this? C++ class members are private by default so there could be lots of private stuff without actually using the keyword?

Ralith
Jan 12, 2011

I see a ship in the harbor
I can and shall obey
But if it wasn't for your misfortune
I'd be a heavenly person today

vOv posted:

It's perfectly legal to overload operator== in C++ to return whatever type you want, though I don't know why you'd want to.
Expression templates!

JawnV6 posted:

No, -Rc is useless garbage. I don't care how many frickin' object files have :0 and polluting my output with every single one of them obscures the .cpp's which might actually have :1 or :2. -Rc also doesn't sum across the files and give you the total across all of them, which piping to wc -l does.

Basically, I don't think you thought his offhand joke all the way through.
The real horror is not using out-of-source builds.

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?

Maw posted:

Part of the codebase at work was all last changed by someone who worked here before me, and every single if statement looks like this:

code:
if (list == null ? false : list.Count > 0 ? true : false) {
    //stuff
}
I don't know if they had just learnt about the ternary operator or didn't know about the existence of &&. || etc, but it's much more awkward to read than it needs to be.

The first one is unorthodox but not completely insane, but (condition) ? true : false is completely inexcusable.

fritz
Jul 26, 2003

HappyHippo posted:

What language is this? C++ class members are private by default so there could be lots of private stuff without actually using the keyword?

Hopefully something like java.

Klades
Sep 8, 2011

HappyHippo posted:

What language is this? C++ class members are private by default so there could be lots of private stuff without actually using the keyword?

Now you have me imagining a Java programmer trying to code in C++ without bothering to understand the differences, just slapping down java code and changing it until it compiles.

code:
class Foo {
  public: Foo (void);
  public: int get_bar (void);
  public: void set_bar (int);
};
etc

VikingofRock
Aug 24, 2008




JawnV6 posted:

No, -Rc is useless garbage. I don't care how many frickin' object files have :0 and polluting my output with every single one of them obscures the .cpp's which might actually have :1 or :2. -Rc also doesn't sum across the files and give you the total across all of them, which piping to wc -l does.

Basically, I don't think you thought his offhand joke all the way through.

Wow, I never thought about that stuff--I thought they were totally equivalent. Interesting.

...I knew my offhand joke should have been about using ag instead.

EssOEss
Oct 23, 2006
128-bit approved

HappyHippo posted:

The first one is unorthodox but not completely insane, but (condition) ? true : false is completely inexcusable.

Well now... which one is the first one there? :smuggo:

Spatial
Nov 15, 2007

dougdrums posted:

I'm guessing a very weird assembly programmer? Like he's trying to do mov eax, dword ptr [ptr + ecx * 4]. I do stupid type stuff like that sometimes after working in assembly a lot, but not quite to that degree. Also parenthesis ...
Not an assembly programmer but they do have a background in digital design, which is even worse.

The guy's real problem is that he's always in a big hurry to get nowhere. He sacrifices quality in horrible ways to save a couple of hours writing the code, even though the negative effect of those shortcuts compounds into days or weeks of extra work later down the line.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

HappyHippo posted:

What language is this? C++ class members are private by default so there could be lots of private stuff without actually using the keyword?

Java, which defaults to package visibility.

Also it's Java, which is not generally pleasant for myriad reasons. This project is a special kind of bad though.

csammis
Aug 26, 2003

Mental Institution

Klades posted:

Now you have me imagining a Java programmer trying to code in C++ without bothering to understand the differences, just slapping down java code and changing it until it compiles.

code:
class Foo {
  public: Foo (void);
  public: int get_bar (void);
  public: void set_bar (int);
};
etc

This programmer is not imaginary :smith:

krystal.lynn
Mar 8, 2007

Good n' Goomy

csammis posted:

This programmer is not imaginary :smith:

Or one of a kind.

ChickenWing
Jul 22, 2010

:v:

leper khan posted:

Also it's Java, which is not generally pleasant for myriad reasons. This project is a special kind of bad though.

I hear this a lot, but I've never heard why.

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

ChickenWing posted:

I hear this a lot, but I've never heard why.

Java's big problem is with verbosity. Everything is a class, which means that any time you want to have custom behaviors, you have to define a new class to attach the behaviors to. Thus for example (prior to Java 8) if you wanted to declare some logic to execute when a button is clicked on, you would do something like this:
code:
button.addActionListener(new ActionListener() {
  @Override
  public void actionPerformed(ActionEvent event) {
    ...actually do something...
  }
});
Whereas in Python the equivalent would look like this:
code:
button.onClick(lambda event: actually do something)
Java works, it's just not very much fun to write stuff in.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

ChickenWing posted:

I hear this a lot, but I've never heard why.

Hey man, I like C++, and Java is missing a bunch of niceties I have there.

Also a nonzero number of our Java projects must be checked out in the root of a drive on windows due to path length limitations. I am thankfully not on any of them. :froggonk:

Eela6
May 25, 2007
Shredded Hen

TooMuchAbstraction posted:

Java's big problem is with verbosity.

I find Java code very hard to read for this reason. Everything is such a mess of classes, qualifiers and methods that is difficult to separate the boilerplate from the 'meat' of the code. You then have to extensively comment it, which makes the code even more verbose...

In my opinion, Java is:
- difficult to write and read
- easy to screw up
- slow

But I have only worked with Java at a very basic level and am not really qualified to criticize it on more than a surface level.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Java isn't really notably slow (depends on what/how you're comparing, of course), but even though I spent at least a year doing Java exclusively on top of here and there over time...I still find it hard to visually parse quickly.

However I tend to think this is some path-dependence issue wherein my brain got used to looking at python code in my formative years and is now stuck with looking at code in one way.

Xarn
Jun 26, 2015

Thermopyle posted:

Java isn't really notably slow (depends on what/how you're comparing, of course), but even though I spent at least a year doing Java exclusively on top of here and there over time...I still find it hard to visually parse quickly.

However I tend to think this is some path-dependence issue wherein my brain got used to looking at python code in my formative years and is now stuck with looking at code in one way.

Eh, I started with Python and Java at the same time and currently the language I like to write and read the most is C++ :science:, followed by Python, C# and Java can gently caress right off. :v:

Volguus
Mar 3, 2009
There are, yes, numerous verbosity complaints about Java, but the IDEs have largely fixed all/most of them. Any half-decent IDE would automatically generate the ActionListener boilerplate, or the setters/getters or toString/hashCode/equals methods. Java 8's lambdas are, in my opinion, even more dependent on the IDE, since it is not clear from the code what type of argument the lambda gets.

As for reading it, that comes down only to practice. I find reading Python code quite the workout, for example. Is this line belonging to this block or the one above it? Is that a space or a tab or are my settings messed up? Did you mean to put that space in there or was it a mistake? What does this module do? Just like in Java 8: "lambda event: do something", what is that event? What members does it have and what can it do for me? Without an IDE I am completely lost.

Volte
Oct 4, 2004

woosh woosh
Java's no inherently worse than any other language, but it does seem to be the lingua franca of "coders" who see programming less as a creative expression of sound engineering principles, and more as glorified paperwork---the software counterpart to pencil-pushing-bureaucrat-types whose definition of "good idea" is "follows the established procedure". It's hard to find beauty in a joyless world. Scala must be what Java programmers see when they dream at night...

feedmegin
Jul 30, 2008

Volguus posted:

There are, yes, numerous verbosity complaints about Java, but the IDEs have largely fixed all/most of them. Any half-decent IDE would automatically generate the ActionListener boilerplate, or the setters/getters or toString/hashCode/equals methods.

Doesn't help with the complaint about reading the code though. Plus, to my mind a language that requires an IDE to generate massive chunks of code for you to be usable is not a very good language.

Space Whale
Nov 6, 2014
I'm trying to comb straight a pile of spaghetti so bad it's got looms making fabric out of it.

The "holy poo poo" of the day:

code:
var someStore = this.global.FUCKYOU['yesItsCalledArrysNotArrays'][0]['productSomeFoo'];

/*....*/

var SomeButt = {stuff};

for(var e = 0; e < someStore.length; e++)
{
	TotalFoo = this.createLineBar(SomeButt, moreParams, morebaz,);
}
/*....*/

createLimeBar : function (SomeButt, moreParams, morebaz,) {
var someStorenamedArrySAMEFUCKINGTHINGASABOVE \ this.global.FUCKYOU['yesItsCalledArrysNotArrays'];
for (var someIndex = 0; someIndex < someStorenamedArrysSAMEFUCKINGTHINGASABOVE.length; someIndex++) {
	//This is why we can't have nice things
}

}
:wtc:

globals everywhere, iterating over the same thing n^2 times (right?)

:aaaaa:

Adbot
ADBOT LOVES YOU

Volte
Oct 4, 2004

woosh woosh
"Easy to read" is pretty meaningless, since even something as simple as the reason for reading the code changes how easy it is to read. You've got some Java code that's covered in annotations and aspect-oriented programming techniques; is it easy to read? When you're checking out the structure of a database model class, it's easy to read. When you're running into mysterious performance problems and need to figure out where the issue is, but you can't even figure out why a particular method is executing before another method, then it's hard to read. The reverse is true when you're mired in boring, strictly non-magical boilerplate.

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