DEV Community

Jahleel A.
Jahleel A.

Posted on

Coding in Java

I don't know how to explain java. It's just that one language that exists, everyone loves it and hates it at the same time. Personally, I think its OK. I can use it to make applications, and Jetbrains has a powerful IDEA for it (Intelij IDEA)
So let me tell you about my experience working with java.

1. Prepare for the most BS errors ever.

Errors in java are helpful but not helpful at the same time. It will tell you what exception was triggered and where it was triggerd from but it doesn't tell you what went wrong. In languages like JavaScript (Node.js is the only example I can think of) it tells you what went wrong and where it went wrong. That is more than enough information to make debugging easier. However in java, errors are mostly handled by exceptions and oh boy do I get the wierdst of exceptions. So when coding in java, I've come to terms with the fact that when I'm going to debug I'm going to have a hell of a time. Sometimes it's alright, but sometimes you just have this one NullPointerException that is hiding deep in depths of your hurderds of lines of code.

2. Storing data, welcome to hell

Storing data is somthing your going to have to do no matter what you do in coding, what for you store it into is a different story. My personal favourites are JSON, mongodb and SQLite. They are simple to use and work for just about anything. However, anything that is simple in one language will definitely not be simple in java. There's just this fustation that comes with saving files or connecting to any external services with java. So many objects with so many functions, initialisers. Its doable, its always been doable, but sometimes you just think to yourself, I don't need this in my life right now.

3. Data types confuse minds

There are 4 data types that most if not all coding languages have. Intagers, Booleans, Strings and Floats. In java it's nice and simple. int for Integers, bool for Booleans, float for Floats, and string for Strings- hang on. That sounds too easy. Yep, even the basic data types have a confusing side. For example, if I wanted to make a int null, I have to use Integer to define the variable instead of int. And the rabbit hole continues from there. Turns out, every single data type exept strings have two ways of defining it. Either the short abbreviations of it or the actual Java Class. Oh and btw in java you also have doubles. But why are strings an exception? You need to have the Class String to define it. Why java made it like this? I will never know.

Well that 3 things I have picked up while coding in java and I hope you enjoyed reading me talk about useless stuff. Until next time, bye!

Top comments (5)

Collapse
 
alainvanhout profile image
Alain Van Hout

Strings are not a primitive type in Java because a string is inherently an array of characters. That's also the case in e.g. C/C++, except that Java made strings less cumbersome to work with than an actual character array.

Collapse
 
thejyt profile image
Jahleel A.

Thank you for the info! That does explain somewhat why it is how It is. Just a reminder it was never my intention to badmouth or complain about java. I'm just taking about my experience with it and things I find difficult to do. Just some pointless rants xD

Collapse
 
alainvanhout profile image
Alain Van Hout

No worries. Everyone working in software development has moments of frustration similar to what you mentioned 😅. Ranting can help alleviate that stress a bit 😁.

Collapse
 
dhruvgarg79 profile image
Dhruv garg • Edited

For the 2nd point, use JDBC, or other libraries like there is a panache entity in quarkus. another example will be hibernate orm. It will make your life way easier.

For someone with node.js background, it's understandable to have these issues. sometimes, I also get frustrated with the 3rd point. like for e.g. on leetcode you have to return int[] but DS uses Integer[].

Collapse
 
braisdom profile image
Braisdom