DEV Community

Discussion on: Which mainstream programming language has the ugliest syntax?

Collapse
erikthered profile image
Erik Nelson • Edited on

Java's verbosity gets old pretty fast. Especially after seeing what's possible with other JVM languages.

Kotlin is a joy to use, in part because of how expressive yet succinct it is. Going back and forth between the two makes Java's flaws much more visible, unfortunately.

Collapse
nektro profile image
Meghan (she/her)

To each his own haha, I love Java for how verbose it is and really dislike Kotlin. Operator overrides are a really neat idea but I can't get over the fun/func craze of using it instead of just saying function. Swift, Go, Rust, they all do it.

Collapse
chrisvasqm profile image
Christian Vasquez • Edited on

I agree with you on the fun part. I've been getting more into JavaScript recently and I can see the use of the full word (function) being better for beginners overall.

Thread Thread
hrmny profile image
Leah

"fun is short for function"

"Oh ok"

Thread Thread
chrisvasqm profile image
Christian Vasquez • Edited on

Yeah, but I still haven't seen the first person who doesn't question what fun is the first time they see it.

Sometimes being clear and short don't go hand to hand.

Thread Thread
nektro profile image
Meghan (she/her)

there's a readability factor that I feel is added when you use the whole function. Especially for compiled languages, the "less characters" argument has no weight at all.

Thread Thread
series0ne profile image
series0ne

It’s actually a “fewer characters” argument.

Thread Thread
aramix profile image
Aram Bayadyan • Edited on

Actually in javascript es6 you don't have to type any word to create a function just () => {} which is the best notation IMHO

Collapse
hrmny profile image
Leah

What's the benefit of typing out function?

There is none, it just adds more characters

Thread Thread
chrisvasqm profile image
Christian Vasquez • Edited on

Then we should use f because "un" would just add a few more characters 🤔.

I think there's a fine line between short and too short.

Thread Thread
alainvanhout profile image
Alain Van Hout

There's a reason why we don't all prefer our Shakespeare or our technical documentation in SMS/text speak :).

Thread Thread
juhohame profile image
Juho Häme

Writing code Shakespeare style would be awful.

Thread Thread
awwsmm profile image
Andrew (he/him)

f already stands for function in mathematics:

y = f(x)
Thread Thread
hrmny profile image
Leah

it's just what you start with, the next one would be g(x)

Collapse
xtabdeveloping profile image
Márton Kardos

Rust goes like: Fn... And I don't think there's anything wrong with writing instead of function, with good syntax highlighting there's barely a difference. I don't think code becomes any more readable by writing longer words. And Java's verbosity doesn't increase the readability at all. "final public static void" Btw you don't even have a function keyword in Java and nobody tends to make a problem of it.

Thread Thread
mojo2012 profile image
Matti

the modifiers are necessary to differentiate non-final private/protected non-static methods with a return type ... it makes total sense 😅

Collapse
tobias_salzmann profile image
Tobias Salzmann

Java Syntax has the weird ability to direct the attention to the less important parts of the code first.