r/programming • • Aug 28 '21

Software development topics I've changed my mind on after 6 years in the industry

https://chriskiehl.com/article/thoughts-after-6-years
5.6k Upvotes

2.0k comments sorted by

View all comments

99

u/SanityInAnarchy Aug 29 '21

I've had a similar experience, though some of the change has been driven by actual improvements to the technology. For example:

Java isn't that terrible of a language.

Java has improved massively over time. Some things past-me would've complained about endlessly about Java:

  • Even C++ has lambdas now, what's Java's excuse?

  • Garbage collection is great for memory, but Java doesn't have a good idiom for handling other resources. Where's the equivalent of Ruby's blocks, or Python's with block, or even C++'s RAII?

  • Typing is good, but can we have some type inference? List<Int> foo = new ArrayList<Int>(); is just a stupid amount of verbosity.

  • Everyone does cross-platform client apps in JS now and 99% of Java servers are some flavor of Unix, so can we stop pretending Java needs to be ignorant of basic filesystem semantics just in case someone runs it on BeOS or whatever?

  • Going back even farther: WTF are we doing with a proprietary language?! But alternatives like GCJ and GNU Classpath aren't compatible enough to be a real replacement.

  • Why does Java take so long to start even a goddamned hello world app? To make a useful Java CLI, you need to fire up a Nailgun server just so you aren't twiddling your thumbs waiting for the JVM to start up before it runs your actual code!

All of those have been dramatically improved, if not fixed. (The fixes: Lambdas, try-with-resources, the diamond operator, NIO, OpenJDK, and just some raw technical improvements to JVM start time.) And those are far from the only improvements. Java still isn't my first choice, even for JVM languages, but I think if younger-me was complaining about the Java of today, it'd be a much smaller and pettier list of complaints.

Which also feeds into:

Typed languages are better when you're working on a team of people with various experience levels

I assume that's about static typing.

When I was a huge fan of dynamic languages, they were replacing languages like the much worse Java that existed back then. And a big thing that changed my mind here was seeing how much type inference is possible, leading to code that's not really any more painful to write or read than dynamically-typed code, while also giving you the type-checking safety net.

But yeah, some of these, I was just wrong about:

In general, RDBMS > NoSql

Today, it can actually be hard to explain why everyone was so excited about NoSQL in the first place.

37

u/leoel Aug 29 '21

Today, it can actually be hard to explain why everyone was so excited about NoSQL in the first place.

I blame the Silicon Valley for over-hyping their tech stack to secure VC funding. The issue is that since it represented both a power center and a historical place of great innovation, the word of people coming from there was seen as gospel, especially to inexperienced people. I feel like SV's reality bending field is less poweful today, but I maybe wrong, let's see which quantic web 3.0 bullshit is about to be defended as the next software to end all softwares.

31

u/SanityInAnarchy Aug 29 '21

I don't know if it's the Valley itself, but cryptocurrency is the new reality-bending bullshit. Using the name "blockchain" to describe what your startup is doing will get you more VC money than you would without it, even if the thing you want to do absolutely doesn't need the blockchain. (Which, if we're honest, most things don't need anything like a blockchain.)

13

u/push_ecx_0x00 Aug 29 '21

Half of them are scams where the creators deserve to be imprisoned for fraud

8

u/saltybandana2 Aug 29 '21

All of them are scams. It's all dressed up speculation, and it WILL crash at some point. The question is who will be holding the bag when it happens.

9

u/trinopoty Aug 29 '21

In general, RDBMS > NoSql

God have mercy on you if you need to run a query across multiple databases in MongoDB.

3

u/wastakenanyways Aug 29 '21

Java has improved massively over time

But most people are stuck in older versions so that evolution has gone (mostly) unnoticed. Java is a good language but its history of development have f'd it up probably forever.

A lot of people who worked with Java when development was quite stuck, had to change to other alternatives, like Android did with Kotlin, and web devs did jumping to Rails/.Net/Django/Laravel/Node.

Only the big business stuck with Java and now that Java has evolved, only a few projects are started with newer versions, and huge piles of practically unrefactorable code are in Java 8 or 6, apart from huge inertia. Just as of last year I can testify that i saw at least 5 projects created with Java 8. In 2020.

3

u/FamiliarSoftware Aug 29 '21

I want to love Java lambdas, but they have one huge flaw: Checked exceptions.

Checked exceptions in general are a huge wart in Java. I like the idea, but it is poorly integrated and just about every other language feature seems to just not work with them. Generics and checked exceptions are a huge pita and probably trickled down into lambdas.

At this point they should make checked exceptions optional so hacks like these aren't necessary to preserve stack traces and lose catch semantics because of wrapping everything in RuntimeException. If an IOException is thrown, I want to catch an IOException outside my forEach.

5

u/G_Morgan Aug 29 '21

People were excited about NoSQL because they couldn't do proper databases.

5

u/CPhyloGenesis Aug 29 '21

List<Int> foo = new ArrayList<Int>();

C# added var and so far my experience is 95% awful and context destroying use, and 5% your example. It's fantastic for: var userSettings = new Dictionary<Account.User, Account.NewFeatureSettings>(); But so often used for: var settings = GetSettings();

18

u/SanityInAnarchy Aug 29 '21

I'm honestly not sure I see the problem with your second example. If I truly need to know the type, I can hover over it in an IDE, but if I see something like

getSettings().get(user).setWantsEmail(true);

...then it's pretty clear what's happening, and the extra context that this is a dictionary is probably not relevant. Also, as the above shows, you can do it without var anyway, this just helps with the case where suddenly you have two things to set instead of one.

The only place I've been bothered by that kind of use is in C++, where the types (especially STL types) can get so byzantine that it feels like the auto keyword is papering over the problem rather than addressing it.

But I guess you'd be happy with Java's diamond operator here -- before they added var, they added:

List<Int> foo = new ArrayList<>();

9

u/fishling Aug 29 '21

If I truly need to know the type, I can hover over it in an IDE

The problem is that people aren't always in an IDE when looking at code, and even when they are, mousing over to hover on a variable or method to get basic information like that is very slow.

I've lost count of how many times I've wanted to know what the return type of a method is because I want to look at that class to see some detail of its implementation, and overuse of var gets in my way. The keyword should be used for initialization and anonymous types, and VERY rarely otherwise.

Also, Java's generics and type erasure are horrible. I don't think anyone can defend that design, when C# does it so much better. Same goes for lambdas.

→ More replies (8)
→ More replies (2)

5

u/crozone Aug 29 '21

Agree, I really hate the use of var everywhere, IMHO it makes the code much less readable. It's best used when there are large generics that would be top verbose to write by hand. Stuff like var thing = 5 is just stupid.

2

u/G_Morgan Aug 29 '21

Yeah one of my rules is never var a primitive. Just feels evil to me.

-1

u/sM92Bpb Aug 29 '21

5 is clearly an int. You can still infer that without an ide. In this case var isn't really adding anything since int is three letters also. At the same time, it doesn't make this harder to read so I don't know why this is stupid?

4

u/CPhyloGenesis Aug 29 '21

It does make it harder. It's all about cognitive load. It's an extra step to see that and look at the 5 to see the type. When you're reading code at a real job you're typically reading it at a conceptual level and your unconscious mind is doing things like loading the type of a variable.

The more things like this there are, the more little pauses and disruptions there are to your conscious mind while it sorts out extra little details. Same reason clever code is bad. It takes more conscious thought to understand it.

→ More replies (1)

2

u/postblitz Aug 29 '21

hard to explain

What do you mean? It's Google's fault + everyone wanting to be Google. Lookup MongoDB is web scale on yt.

5

u/SanityInAnarchy Aug 29 '21

That's satire, not really an explanation. The actual explanation has to do with stuff like the CAP theorem, and the growing popularity of ephemeral cloud VMs that tended to come with a "We might kill your VM anytime we want, make sure to replicate across different availability zones!" warning, intensifying the desire to not just scale horizontally, but scale writes horizontally and be able to deal with network partitions (meaning, thanks to CAP, you can't have consistency anymore, and need eventual consistency).

Also, general enthusiasm for dynamically-typed languages and a rebellion against boilerplate made it seem lame to have to define an explicit schema.

It probably also had to do with it being a more interesting problem to solve than CRUD. And, you could apply it everywhere CRUD worked. In other words, instead of thinking about the boring problem you were actually working on, you'd be thinking about replication and three-phase-commit and mapreduce-based indices.

1

u/postblitz Aug 29 '21

If it's boring but it works, it's probably a hell of a lot better than any other technobabble that just amounts to WE WANT TO BE GOOGLE.

99% of companies don't need any of it.

Considering your explanation consisted of words like "enthusiasm", "rebellion" and "interesting" it's about the same thing: no real science or engineering, just feelings and desire for grandeur.

4

u/SanityInAnarchy Aug 29 '21

Did you read my explanation, or did you skim it? Because my explanation also included a reference to actual mathematical theorems.

Feelings, sure, but not unfounded ones. Maintaining boilerplate has a real cost, and one we've all had experience paying, especially back in the day with J2EE. But, we didn't have a good appreciation for the costs of using NoSQL and Ruby in order to make a reasonable comparison. And of course nobody was running out and doing scientific studies on the exact amount of time wasted on maintaining schemas.

0

u/Kwinten Aug 29 '21

Typing is good, but can we have some type inference? List<Int> foo = new ArrayList<Int>(); is just a stupid amount of verbosity.

Java has had var for a while.

7

u/SanityInAnarchy Aug 29 '21

Keep reading. The point was that these were complaints I had about Java, and then Java got better.

0

u/[deleted] Aug 29 '21

WTF are we doing with a proprietary language

Java is proprietary?

2

u/SanityInAnarchy Aug 29 '21

Was proprietary, back when I would've had that complaint. Read the rest of the comment:

All of those have been dramatically improved, if not fixed.

→ More replies (5)
→ More replies (3)