Posts

Showing posts with the label refactor

when a new guy joins a team...

Image
Not so long ago, I was browsing merged pull requests to check quality of the work that was done. I don't know why, but in 202X C# is rather a modern language and some language syntax shall be adjusted to newer standards. When I was starting my developer journey - I was told to always add a code that looks similar to the one that already is there, unless it is total crap and adding new stuff needs more effort today, to not to die tomorrow. But in this case, we have a project that is created in in 202X and there is a lot of good looking and working lines of code around, so anyone can follow it. First time, when I was a student and helped my colleague, I was in shock that the teacher recognized my help, I turned all red and asked him "how you were able to recognize that?". He said that most of us have a kind of style that identifies us as developers, so this is spacing, the way how we organize braces (even when autoformated), how we write and solve problems,  and finally var...

the code need to be secure, all need to be checked... sarcasm

Image
In my days I am sometimes wondering why we humanins are so hateful to computers. We ask them to make a job that is not used, even we order them to do it twice or more in a process flow. A time ago I was shocked when I saw a code review that was approved by a senior developer with more than 8 years of experience and written by other senior with more than 10 years of experience in the .Net area. What killed me is that nicely looking code makes more noise and brings no value, but cost precious CPU ticks. Please read below listing: What do you think? I hope that this not look familiar to you!!! So let's try to add some context, so the parameter is received by api endpoint, and then passed down. Now firstly we can see that it is converted from string to int , in a safe manner using int.TryParse . Next we see the same method invocation (as Int32 is return type of try/parse) and then this parameter is passed down to document generator, then to submethod where we can see an expensi...