Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
ltlian21885yStill, what bothers me the most in that snippet is the lack of space before the comment.
-
-pthread4395yWhy is he using tons of if else just use fucking dictionary or unordered map whatever there is in java(i don't know java)?
-
crisz81915yIt would make sense if it was written by a CS teacher. Maybe his/her students didn't study the exceptions yet?
It's fine, it looks like a basic exercise, why should you scare everyone introducing new complicated concepts? -
@crisz Then you should use a better example. This is all over the place just very bad practices.
-
And yet people like this are the people teaching the youth how todo what the PHDs think we professionals do.... we need to get back to professionals teaching the youth and PHD folks back to just writing papers and doing research... cuz they are the reason the youth sucks at programming
-
@QuanticoCEO
The youth suck at programming because the youth have always sucked at programming. It's just that for a long time we didn't *know* that because the barrier to entry has been so high for much of the industry (buy an expensive compiler, build your own fucking pc, learn a low-level language like c, etc) even though people's expectations were lower.
Now, the barrier to entry is *lower* owing to the availability of tools, but people's expectations are *higher*, *much higher* and consequently there are a lot of new tools, and ceremony to learn to accomplish those sorts of things (fucking Babel).
And of course you have inter-corporate powerstruggles fucking with eachothers tech standards (directx, opengl), and breaking tooling through actual code and legal techniques like lawfare (COCs, etc) to keep their dev bases trapped in each corps portion of the mind ghetto called 'the software industry in 2019' but I digress. -
@crisz This was from a higher level SWE course where every student should know about exception handling. The course is currently talking about unit testing. Maybe he wrote it this way on purpose to show why bad code makes it harder to test?
Regardless, bad design. The month member is a string instead of an integer, yet everything that operates on month first converts it to an integer using this method. Silly. -
@-pthread Yeah Java has multiple map implementations in its collections API. An array would work for this, though.
It's sad to see this kind of code. -
Avyy7495yWhat makes me mad is that he is using different functions for months, sometimes calling equals and sometimes equalsIgnoreCase. Just pick a damn one
-
KiDoDa1255yDoes java have a switch statement?
Also, shouldn't System.exit arg be -1 ( or 1 or 2) for error? O thought exit code of 0 means "all is well"? [*NOTE: I haven't used much java]
I can fully understand not using a feature before introducing it, but in this case, Im not certain that it what's happening... lol -
sirjofri5175yYou could also remove all the elses in that function. The ifs will make it fall through "if not", the remaining code is not executed because of the returns. Same thing with the last else...
There are at least hundreds of things that could be nicer and also teach the students actual programming
Related Rants
"Fatal Error"
Exceptions? No, let's just halt the entire program.
Apparently a CS professor wrote this code.
"Needed to keep the compiler happy"
rant
java