Designing Effective Websites: Where Functionality Takes Center Stage
July 3, 2023Tips for Writing Clean and Readable Code
July 24, 2023“Anything that can go wrong will go wrong.” – Murphy’s Law
In my three years of working in the web development industry, experience has taught me that Murphy’s Law can apply to any project. Whether it be a small or big project, at some point, something will go haywire or something will get overwritten.
When an investigation is performed, it is imperative to find the cause of the issue. If the source of the issue isn’t found as soon as possible, it could lead to more issues sprouting out and cause more damage.
There will be instances that the issue is caused by services such as Xero or Business Central, where something has occurred on their end. However, most of the time, issues are caused by code implemented on the project. If it is confirmed that the issue is coming from the project’s code, the developer investigating the issue needs to find out why it was implemented, when it was implemented, and who implemented it.
In this article, we will be discussing the best practices using the most useful Visual Studio Code Extensions, linking commits to their respective tasks and accurately documenting Jira tasks.
Visual Studio Code
- Git Graph – Provides a graph to the user that illustrates the relationship of all branches, gives additional git commands such as git-graph.addGitRepository and options to perform git actions.
- Git History – Allows the user to access a file’s history, create branches from commits and cherry-picking commits.
- GitLens – Allows the user to view the history of code implementations (i.e. Who implemented and when was it implemented). It also allows the user to view more details on the commit, view the differences between different commits, manage branches and displays inline annotations.
There are of course other extensions such as Gitlens Code Lens and Git Blame, but it mainly depends how much information you want to access for your project.
Installing the three extensions mentioned above already makes your coding journey an easier one since they complement each other very well.
Of course, you can experiment with different extensions - Each developer is different, and they handle projects differently.
Git Flow and Jira
When a new task needs to be created on Jira, it is recommended to always add a detailed description on what exactly needs to happen for the task. The reason why this must be done is to ensure that whoever accesses the task, has a general idea of what is supposed to happen.
If a task is created but no description was added, it makes it difficult for the developer to know what to do, particularly if there is no documentation to reference. The description doesn’t need to extremely detailed, but you at least need a summary of what needs to happen in the task.
If a client provides additional details that they have not initially stated in the previous meeting or the client has provided feedback for a developer’s question, it is best to record these interactions by writing them in the comments section of the task. Additional details in the comments also helps provide more information on the task and its development over the course of the task’s completion.
Adding these types of details are invaluable for developers that need to investigate why a certain issue has been happening more than once or need to document the code in a Technical Manual without having to scour through the entire project to figure out what the latest code change is doing.
To ensure that time is not wasted by trying to figure out what commits belong to a task, it is highly recommended to try and reference the Jira tasks in your branches and commits.
To do this, you will need to do the following:
- Ensure that your Jira Admin either connects GitHub or Bitbucket to your Jira site.
- Ensure that your Jira project has the View development tools project permission.
- Find the Jira task you wish to work on.
- Create a new branch and place the Jira Task ID into the branch name (i.e. feature/ASC-25-dropdown-height).
- Once you have finished implementing code, you will need to type in your commit message to briefly summarize what’s been done and include the Jira Task ID (i.e. [ASC-25]: Changed the default height of the dropdown bar).
It is inadvisable to commit your code with messages such as ggggggggg, implemented or bug fixed as this makes it extremely difficult for anyone who hasn’t done the code to know what was done or what type of bug was fixed. This way, adding the Jira Task ID and giving a brief, yet informative description to a commit message makes it easier to track it down. If you wish to learn more about referencing commits to your Jira tasks, click here!
I hope that this article has been very helpful and that it helps you improve on leaving a detailed paper trail of every action taken for your project.