Adopting good coding practices ensures that the code you write and the HCL Notes and Domino applications you create are easy to understand and maintain by all members of your development team. How you write your code is just as important as what features go into the applications you build. Your coding practices will affect the ultimate quality of the application as much as the testing strategies you use.
There are many aspects to a good coding practices policy. The best practices listed here may be more or less relevant for different teams or different applications, but the important thing is that you adopt a standard approach and make sure everyone uses it. Here are the most important things to think about when it comes to Notes & Domino application development.
1. Adopt Sensible Naming Conventions
Adopting a sensible naming convention for all code and design elements is essential for consistency, readability and maintainability of any application. If each team member is allowed to work using their own naming conventions (or no convention at all) it will be a lot harder to modify or maintain the application because you first have to decipher the names that have been randomly chosen to make sure you understand everything that is going on within the application.
There are many different examples of naming conventions and rules, from Hungarian, to camelCase. It doesn’t really matter what style you choose to adopt, as long as you adopt something and make sure everyone on the team follows it. In many cases, based on the relatively simple nature of many Notes/Domino applications, it makes sense to come up with your own simplified set of rules for naming, rather than adopting an all-encompassing generic standard. The more meaningful the name, the better, but it’s good to have some rules so that no-one has to try and work out the difference between Var1 and Var2.
2. Use a Standardized Toolset
It’s important to ensure that everyone on the team is using the same set of tools to develop applications. Without a standard tool set, it’ll be very hard for different team members to update code that was originally developed by someone else using different tools.
Make sure everyone is consistent with the features they use and that they receive the same quality of basic training. If the skills or knowledge of the tools varies too greatly across all developers, the results can be just as bad as if they were using different tools. A lack of proper training can also lead to people not using the tools they have, or using them incorrectly.
3. Do the Small Things That Make Applications Easy to Maintain
One of the best things you can do to set standards for coding practices is to insist on making maintainability a core aspect of all work. For example, making smart choices earlier on about how to store and access configuration data so that there are no hard-coded elements like server names, filenames, user names, and even replication formulas will reduce the maintenance requirements in the future. By making smart choices early on, moving the application to a different server or domain will be a lot less painful.
Another way to help make things easier to maintain is to avoid making backup copies of the elements you’re working on. This leads to many different elements all with titles like ‘Copy of memo’, ‘Another copy of memo’, and ‘Another copy of copy of memo’. Backups like this are the responsibility of the source control system. You shouldn’t have to deal with multiple versions using a clumsy manual process like copy and paste.
4. Avoid Manual Work
For developers, a good coding practice is to let the machine do the work. There should be no reason to perform a task by hand that a small program could do much easier and more reliably. This can apply to anything from a copy and paste back up scheme, to the updating of documents in a database either before or after a design upgrade, to the building of the template itself. Acquire tools that will make your life easier, make sure everyone knows how to use them, and does use them!
5. Encourage Code Reuse
Code reuse is very important to saving time and increasing the overall maintainability of applications that are created. Code reuse also makes the look and feel of applications more consistent, and in turn develops consistency on the part of the end users in the way that they interact with the applications. This reduces the overall training requirements for end users.
There should be a common place where all tested and reusable code is stored. When this practice is implemented, each developer will know where to look for reusable code objects. The code should be accompanied by a cataloging system where each reusable artifact can be documented regarding where it was originally developed, who developed it, and how it can be used. There should be someone on the application development team who has responsibility for regularly maintaining the objects so they don’t stagnate and become unusable.
6. Run Peer Code Reviews
Coding practices can be difficult to enforce and maintain. Code reviews are a great way to double check your work before releasing it to testing, but they are also a great tool to make sure everyone is following the practices outlined by the team. Just like an author will have a draft document reviewed by peers before publishing it, programmers should have their code given a once over.
Depending on the number of people involved, peer code reviews can be a great learning tool for other members of the development team. Code reviews provide an opportunity to identify code that can be reused later, or places where a reusable object should have been used. This will go a long way towards improving the overall amount of reuse a team is doing.
Mandates such as a requirement to perform code reviews and automated application scanning should be enforced where possible and practical. The team leads for the application development team should be strongly encouraged to perform spot checks and code reviews, even if they fail to see the value of this testing. Code documentation tools should be used to make it easier to break the code down and allow peers to review it.
If one or more of these best practices fit your environment and they are things you’re not already doing, we’d encourage you to start. To discuss code quality or any aspect of HCL Notes and Domino application development, click below to contact us. We’re always happy to talk!