My list of best practices
Posted in Best Practices
Over the 19 years I’ve been a developer I can say I have seen some good, some bad and some ugly practices, but lets remain positive and here is my list of best practices/thoughts to which I hope have adopted to over the years:-
- Make sure you have the latest version of the code before you check in (if you’re using SVN).
- Small commits and commit often, after you’ve run your tests locally that is.
- Don’t be the developer who is always breaking the build, check that your code builds on the build server.
- Check your builds daily, make sure builds aren’t left broken for days.
- Automate builds/deployments where practical, manual deployments are a no-no.
- Measure code coverage as it can point to bad smells in your code base.
- Write Integration tests and Unit Tests which add value, not just to get code coverage up.
- Clean up after you, don’t leave stuff lying around.
- Make sure your log files are actually helpful, don’t fill them with useless info and make the log level easily configurable.
- If you create Helpdesk tickets then give some meaning to the piece of work, don’t be lazy.
- Don’t check in Third Party Nuget packages to source control – keep your repositories lean as possible.
- Begin Transaction *put your update statement here* Rollback Transaction, trust me this can save your ass.
- Leave the code in a better place than it was before you touched it, remove unused code, unused using statements, refactor duplicated code etc.
- Get the database Id in SQL using ‘select db_id()’ and trace it so you know exactly what your stored procedure is doing
- At the daily stand up, have a note of what you were working on, “I don’t know what I did yesterday helps no one”.
- Try and figure out why its broken, don’t leave it for others to fix, you wont learn much doing that.
- Take an interest from development right through to deployment, the more you know the more you’ll understand and can perhaps help out.
- We are professionals, act like one and take pride in your work.
I will add to this list over time, feel free to comment on any of this and tell me your thoughts.
Catch me on twitter @gsuttie
What does “If you create Helpdesk tickets that give some meaning to the piece of work, don’t be lazy” mean? Seems like a rant with no real context 🙂
Should read then – I’ll fix typo thanks
thanks for a great article, We Use TFS , but all of above is really good practice to follow.
Question: what is use of select db_id() . can you explain ?
Get the id of the database so I can use SQL profiler to see what is happening with my query
if your in sql server you and you ave say a database called DemoDB, go into SQL Query Analyser on that database and run select db_id() this sould return then integer value which represents your database. Now when profiling your database filter it on the database id which select db_id() returned.
There is also a “database name” filter
Great list Gregor. Gives our team a few things to aim for. Thanks!
[…] My list of best practices (Gregor Suttie) […]