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
-
@theScientist would you consider this one?
```If ( something || something_else) {
return true;
} else {
return false;
}```
Over
``` return something || something_else; ``` -
Yes I would consider it if that is the code guideline for the company/project.
It is more important to keep everything uniform.
I once had an very old codebase of 100k lines and a new dev made a new feature in psr2. I had a sort like discussion but I was open to it: if you refactor the entire project into psr2 you can use it.. Hell you can use any standard aslong as the entire project uses 1 standard -
@wiardvanrij, but this doesn't seem like a standard. It's plain making it more pleasant for others to read. Placement parentheses is a standard but if there's a standard for constructing your logical if and return statements (outside the scope of DSLs) then that seems like a different problem altogether.
-
xalez19367ypeople generally don't like to be told they're wrong, and depending on the way it's approached, they can get defensive
people also generally don't like change
people also generally learn better if they reach conclusions themselves as opposed to being told
I don't know how new you are in the job, but if you started from week 1 telling them how to improve their code, I'd wait a bit more..
if I were you, I'd start by focusing on writing clean code, being useful and valuable to the team, getting to know them and wait until the newness feeling is gone and trust is built, let them see your code and judge for themselves, then start approaching these issues if you need to
if you feel the need to do that right now, approach it as questions vs. criticism if you can. "why is this done as X instead of Y" vs. "this should be Y, X is wrong"
remember that whoever wrote this code might've been working on a tight deadline
I don't know ur exact situation, but this is my generic 1024 cents -
spacem18367yI would say if you did it in one line that is fine. If you complain that others should do it in one line then you are being petty.
Exception is if the team have a linter setup that makes red lines for inconsistent formatting. In that case you should follow the rules or get consensus to change the rules. -
@xalez I'm on a freshly created team that will handle an existing project. It was a pull request scenario and I asked, politely if it would be okay to put a comment. And I did just that, like politely stated that 'would it alright to consider turning this as a one liner?' And he said, as long as it works it should be alright, it shouldn't hinder pull-request. I was just in awe, why bother having a pull request?
-
@spacem I don't complain, I was just 'okay' and kept quiet, I was shookt. Here I am, took it to devrant. Because I thought devrant was created for things like this.
-
@silverbyte Don't be sad or frustrated. I too once felt that way, but remember that they won't change just because you mentioned the benefits of clean code. Most people just want to get stuff done, even the code is dirty or unreadable as long as it's the easy way (for them). Cheer up.
-
@Bitwise I get what you all said really. I wouldn't be ranting here if I didn't. The thing is we're all new. It's a new team.
I really have no qualms about formatting and stuff if this was formatting. This isn't really rocket science, it's almost trivial, there's no logic being fucked here. I'm not even suggesting to change the name of a class or method.
What I find baffling is the utter disregard to considering a polite question or suggestion of a colleague. There's no other reason I can think of but just plain ego. This was supposed to be a team, for god's sake. Yeah maybe I was wrong. I was wrong to expect a professional behaviour from people -
@Bitwise yeah no none taken. All I really have come to realize is that this software development as a whole is not for me. Maybe I did something wrong, I expected a polite discussion from them or something. I think my naive personality isn't cut out for this. I was coding for a couple of years. Just had one company though, this was my second, the third and the fourth wouldn't probably open also like this one.
Related Rants
-
cdrice105"You gave us bad code! We ran it and now production is DOWN! Join this bridgeline now and help us fix this!" ...
-
MoboTheHobo36My Friend: Dude our Linux Server is not working anymore! Me: What? What did you do? My friend: Nothing I swe...
-
tommy15Right now someone at Google is coding something useless for us to laugh at on April Fools.
Sad. Got a new job. Apparently, readable code is not a priority. My suggestions were being ignored. Does the benefits of condensing an if-else to a simple one-line return statement really that hard to understand? Does making clean and readable code should be an optional thing to consider? It doesn't help that I'm the youngest, they felt like I don't have enough street cred. I'm starting to hate my job.
rant
clean code
fml