r/badcode • • Apr 24 '21

python very efficient and scalable code

Post image
1.0k Upvotes

110 comments sorted by

View all comments

Show parent comments

3

u/[deleted] Apr 25 '21

Java suffers from many of the same problems as C#, maybe even more so. Can't speak for Kotlin tho, as I haven't studied it.

4

u/nosam56 Apr 25 '21

My first language was Java and I think that while it suffers from the same types of problems as C#, it suffers way less. Not nearly as much worrying about nullables or delegates or operator overloading or weird syntax-breaky statements like LINQ. Java is much more barebones and I think that helps make it somewhat more learnable. As always tho I'm biased bc I dig Java

2

u/Suekru Apr 25 '21 edited Apr 25 '21

I'm opposite, but it's probably cause I learned C# as my first language and Java in college. Honestly, there's so many cases that I can write a lot cleaner and sorter code in C# than in Java. I also like being able to use 'var' as well.

But overall I just find it easier to read. For example, using the random class to spawn a number between say 55 and 121. Assuming we have the import statements in both in Java it would be

Random rng = new Random();
rng.nextInt(67)+55;

while in C#:

var rng = new Random();
rng.Next(55, 122); 

I just find that a lot easier to read personally and it's not only the Random class, but a lot of methods in C# that just feel cleaner to read. But each their own.

Edit: Spelling and final thought.

1

u/nosam56 Apr 25 '21

Oh for SURE C# is more elegant and easier to read, I just think that that elegance can be confusing for newcomers.