IT/Software career thread: Invert binary trees for dollars.

moontayle

Golden Squire
4,302
165
Java is still clunky as hell and if I didn't have to write another "if (x != null) {}" statement in my life I would be happy as hell.
 

Cad

<Bronze Donator>
24,487
45,378
And if checking if something is null is the bane of your existence, you have it pretty easy. That sounds like a first world problem.
 

Tenks

Bronze Knight of the Realm
14,163
606
And if checking if something is null is the bane of your existence, you have it pretty easy. That sounds like a first world problem.
Its a valid concern with Java. Some languages disallow the use of null so it makes things a ton more elegant. Unfortuantely Java can't put that genie back in the bottle so now they can only recommend people construct their classes utilizing Optional instead of null (unlike Scala where it has to be Optional.)

Like

Is much easier to read/write than

 

Cad

<Bronze Donator>
24,487
45,378
Its a valid concern with Java. Some languages disallow the use of null so it makes things a ton more elegant. Unfortuantely Java can't put that genie back in the bottle so now they can only recommend people construct their classes utilizing Optional instead of null (unlike Scala where it has to be Optional.)

Like

Is much easier to read/write than

 

Tenks

Bronze Knight of the Realm
14,163
606
Try / Catch is extremely expensive and should never be used for something like null checking. If you do it for all your null checking in Java your program will crawl. You'll encounter some Java zealots who would claim you should never use Try / Catch due to the expense. I'm not in that camp but you should have a very good reason to be using it and lessening keystrokes is not a good reason.
 

Cad

<Bronze Donator>
24,487
45,378
Try / Catch is extremely expensive and should never be used for something like null checking. If you do it for all your null checking in Java your program will crawl.
You could also put your null checks in the getters to your member variables, and return a default/initialized value in the getter if the value is null.

However, that really defeats the point, because if the value is null you really want to know about it and probably do something different than you would do if it's not null. Usually shit gets nulled out because something was not found in the db so whatever you expected to be populated isn't, or the user didn't input what you thought, etc; these are things you SHOULD be checking for. The fact that they're usually null in java just makes the "java null check" kind of a meme where in C/C++ you'd be checking them as well anyway, just for an in-bounds value rather than null.

People cry about java way too much, there's some clunky shit but honestly I spent like 5% of my time actually writing code and most of my time writing requirements, bug squashing, testing, helping others... the relatively clunkiness of the language I was using didn't mean dick. And I developed professionally in C, Java, Rails, a bit of C++, mumps (have fun with that one)...
 

Tenks

Bronze Knight of the Realm
14,163
606
You could also put your null checks in the getters to your member variables, and return a default/initialized value in the getter if the value is null.
That is basically the point of Optional. The issue is Java never formally supported Optional beforehand so null often times meant the same as notPresent() but sometimes null also meant other things. That is why null is such a dangerous device.

However, that really defeats the point, because if the value is null you really want to know about it and probably do something different than you would do if it's not null. Usually shit gets nulled out because something was not found in the db so whatever you expected to be populated isn't, or the user didn't input what you thought, etc; these are things you SHOULD be checking for. The fact that they're usually null in java just makes the "java null check" kind of a meme where in C/C++ you'd be checking them as well anyway, just for an in-bounds value rather than null.
Sometimes null is valid for the reasons you described or like I said sometimes null is used to simply represent a default return. Like if I have some method and lets say for whatever reason if you supply an argument over 100 it returns null. It isn't that it failed and it isn't that you used it incorrectly it is just now it behaves. On the other hand lets say something goes wrong and you did in fact use the method incorrectly and it is coded up to return null in that case. Now you have received null from this API for two vastly different reasons. Again, it is why nulls suck in general but it is a common use of them even in well structured Java code.

People cry about java way too much, there's some clunky shit but honestly I spent like 5% of my time actually writing code and most of my time writing requirements, bug squashing, testing, helping others... the relatively clunkiness of the language I was using didn't mean dick. And I developed professionally in C, Java, Rails, a bit of C++, mumps (have fun with that one)...
Agreed. And modern IDEs will fill in much of the boilerplate for you anyways. Sometimes concise languages, IMO, are actually more difficult to read than verbose languages. You need to actually know the language to follow the syntax because there is so much sugar. With Java you generally can just read it logically and reason it out because it is so verbose -- which makes it very friendly for maintenance and onboarding.
 

Kharza-kzad_sl

shitlord
1,080
0
Talk to me when you guys gotta develop in assembly
I did some horizontal add and shufb action a few days ago!

Though I was using mono.simd, so not really assembly
biggrin.png
 

Noodleface

A Mod Real Quick
37,961
14,508
It's fine, I try to act all hard about assembly but no one feels cool writing it. Whenever I need to write/change the code I basically want to throw my laptop out the window of my 7th floor.
 

Tenks

Bronze Knight of the Realm
14,163
606
No one should feel cool writing assembly. Its like a hipster listening to a record. Everything is shittier about the experience they just want to say they're using something old.
 

Noodleface

A Mod Real Quick
37,961
14,508
My boss and other coworker from my last job had been doing BIOS for like 30 years, so they were writing it when it was just assembly (up to just a few years ago actually). They said it was a lot easier and a lot more powerful (obviously).

Whenever we had to work in the assembly stuff, they were fucking wizards. For me I have to sit there and think hard about it but they could just blow through it.

Also when we through an XDP debugger on an Intel processor we can do single step debugging on the C code and ASM at the same time. It's cool to see how the C code translates to assembly.
 

Voyce

Shit Lord Supreme
<Donor>
7,096
22,229
Everything on a standard computer has some type of instruction set, it's hardly hipster when it exists and will continue to exist for as long as current architecture holds. It is a pain in the ass to follow a long Assembly module though (as someone who only works in it now briefly from time to time.

COBOL LE, by the way, is in my opinion just ANSI C (having done the former for 3 years and using the latter in College) without standard Library support, like one of the crappier runner up's to the Willy's Jeep design.
 

Noodleface

A Mod Real Quick
37,961
14,508
Got offered a senior system engineer interview in Arizona to work on missiles but had to turn it down because I didn't want to relocate. Told them I'd be interested in anything more local do we will see if they throw me away or keep me in mind.

Would've required top secret clearance so sounded cool
 

Tenks

Bronze Knight of the Realm
14,163
606
My brother's friend works on top secret clearance at the air force base north of Cincinnati. It doesn't seem like what he does is terribly interesting outside of not being able to really talk about it. It seems like mostly radar work.

But you could have hung out with Onoes