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
-
You're solution was better but was a part of the assignment about following specifications. That's really important too.
-
noogli6457y@dougheeren how u know his solution is better ?
For me it's just wrong because he completely missed the specs just imagine another dev rely on this function to return an int now he has to debug his work which will cost him about 70% of his dev time only because one junior decided that it's more convenient to return a bool
Sry maybe I'm overreacting but this happens to me so often cause every smart as junior does this -
@noogli better because it simplifies use and readability. Well depending on the name of the function...
-
If it's getNumverOfWhatever then boolean is wrong. If it's isMoreThanWhatever then boolean is right. If no specs were given then fuck that Prof.
-
Pointer32377y@dougheeren it's all about the specs.
If he asked for a function that returns an int (error codes, used in a lot of software from the days ago), then implementing one that returns bool it's wrong. -
The function simply simulated a drunk man's path, and returned true if he made it home, false if he ended at the pub (those were the only two possibilities)
I guess the prof wanted me to return his end position and then check it in the main method to determine if he ended at home, instead of returning whether he did or not.
I totally agree it's fair, it was required in the spec and I did not read it right, plus he's the prof so he calls the shots. I just wish he was a bit more flexible on the details... There's not only one solution to any given problem, and by giving no agency it undercuts creative thinking, which is very important when writing software. As for the name of the function, I can't comment as I don't remember what I called it đ -
buried947y@nanoandrew4 sounds like you were working with 2 functionalities:
1. Getting the current position
2. Validating that position
By returning the validation in the position method, that's probably where you went out of spec, since you aren't accounting for separation of concerns. Ideally those would be two separate methods called by the main method.
Something like:
int position = getPosition();
boolean validPosition = isPositionValid(position); -
@ArcaneEye You can just rerun the function again to simulate another trip. That's how the spec asked for it, we still don't know about classes âšī¸đđ (or he hasn't introduced it, and I'm not looking to lose marks going farther from spec)
-
Comments, TL;DR...
But if it hasn't been said already, the professor has a point. Returning an int serves both as a Boolean and a number, and for some use cases it means you only have to use the function once instead of twice.
However, if you did everything that the assignment asked you to do, and as efficiently as possible, should of got that 10 đ -
@jesse-bryant Nah, that's the reason I got 9, because I didn't return an int there. However, the only purpose of returning the int is to compare it, so I figured I might as well do the comparison before.
What I get for going away from spec... I just wish he was more flexible on small details like that, because he never says why we should do it that way, just that we should. And blindly following spec just because someone said so, and taking marks away for going away from it when it's not clear why we should even stick to it just makes me sad... If you're gonna take marks away, at least tell me why I should be returning an int for comparison and not just comparing it and returning the answer, which in the context of the program makes more sense.
We're only interested in the times he makes it home, and not to the pub. So if I return true when he makes it home, it makes sense logically, and it's easy to understand the output. Just returning some random number makes less sense.
Related Rants
When your prof gives you 9/10 on your CS assignment because, instead of returning an int and doing a comparison, you do the comparison and return a boolean.
đ¤đ u serious man
rant
cs
marks
much logic
assignment
prof