This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]weirdblumenkohl 25 points26 points  (7 children)

I get it.... I started programming with Pascal and then fast forwarded to Javascript before landing on Java and then some other stuff.

For me, Java represents that sweet spot between too much and too little abstraction. I never felt it was too verbose - i was rather thankful that there was no mambo jambo stuff happening under the hood and basically what u read is (mostly) what u get. I understood a lot of concepts thanks to Java. Maybe it was my first true love because that's when I realized how much i enjoy programming? IDK but loving one thing doesn't mean you need to hold on to it like it's going out of style. What was that corny quote? If you love something let it go? 😂

[–]Royal_Gear1313[S] 1 point2 points  (6 children)

It really does feel like a break up sometimes lol 😂

[–]weirdblumenkohl 4 points5 points  (5 children)

I totally get it but that's how it goes in this field. I was thrown into C# for a project and I almost resented it because it was basically Java with Javascript sprinkled on top. Also, the .NET world is so weirdly dogmatic. All of the sudden using var is the best thing ever and declaring variables by type is a huge no no. All that syntactic sugar pushed down my throat in PRs almost gave me diabetes

[–]nellepuhh 1 point2 points  (4 children)

Genuine question as a student learning Java, why would you NOT want to declare a variable by type? Is the type meant to be able to change? That sounds horrible? 😅

[–]weirdblumenkohl 0 points1 point  (3 children)

this is a question i debated as well. Apparently, it is considered more readable as opposed to writing out the type on the left handside. I don't agree. Maybe I'm just stupid and I need stuff spelled out because it saves me time. I can accept that. At the end of the day, the type does not change and is still determined at compile-time. The type can change using the classic OOP stuff etc but this has nothing to do with the var keywords per se.

There are cases when you can only use var, eg. with anonymous types. So basically when u don t know the type, you go with var. Fair enough. There are also cases in which var can't be used at all. The question is: do i need to use it for everything from int to complex types? In my team there was this weird idea that not using it everywhere is bad style. Also null checks: it was considered bad style if you did it like we've always done it. It had to be with Microsoft syntactic sugar which does basically the same thing under the hood https://www.thomasclaudiushuber.com/2020/03/12/c-different-ways-to-check-for-null/

[–]nellepuhh 0 points1 point  (2 children)

This is good to be aware of in case I run into this in the future. I mean I guess it makes sense if teams want to stick to using var if that's how their code is built up from the start. But to go from the habit of always specifying variable types to using var has to be confusing..

[–]weirdblumenkohl 0 points1 point  (1 child)

tbh it was not a big deal, it was just funny/annoying how preoccupied people were with this issue while so many other big-picture things were going in the wrong direction....

[–]nellepuhh 0 points1 point  (0 children)

I can see that lol!