Browsed by
Tag: CodingChaos

Tip #3: Always ensure you have high comment to code ratio, the more comments the better!

Tip #3: Always ensure you have high comment to code ratio, the more comments the better!

In the best cases, the comments can constitute 50% or more of your code, and that would be a good thing. The code is read more often than it is written, so explain every line of code with a comment so the next developer can understand it well. We do not write code in English (yet!) but in a language specifically designed for computers. Computers are better suited to understand it than humans. Code can be cryptic, unintuitive, and difficult…

Read More Read More

Tip #2: To make your tests more specific and focus only on the class you are testing, mock everything else.

Tip #2: To make your tests more specific and focus only on the class you are testing, mock everything else.

It is always observed that changes in one class cause other class’s tests to fail. This happens often because many other classes change when we change one class, leading to many other tests changing / breaking. It is always best to mock all other classes. That way, other classes are not actually used in the test, and you can ensure that your tests do not break! This also ensures that the only coverage we get is from the test written…

Read More Read More

Tip 1: Always commit as many unrelated features and bug fixes as possible into a single commit.

Tip 1: Always commit as many unrelated features and bug fixes as possible into a single commit.

First, this will make your commit message a cryptic mishmash, which no sane person will understand! Second, when someone needs to cherry-pick something from one branch onto another, they’ll be unable to do so cleanly. If you are linking your commits with JIRA, this is even more awesome because now the unrelated JIRA stories are also linked together by this commit! And if your team uses JIRA or commit messages to write release notes, oh well, they are in for…

Read More Read More