Martin Fowler has a very nice article about why you should use an ORM, when you should not, and what alternatives there are.
See http://martinfowler.com/bliki/OrmHate.html.
Of course, as I have often said (but not always, never always), think before you blindly pick something to use. Is it appropriate? Is there something better?
Monday, 26 January 2015
Monday, 19 January 2015
Connecting Issues in GitHub to Git via Commit Comments
When you enter "Fixes #45" into a commit message, issue #45 is closed once that commit is merged into your default branch. If the bug isn't fixed in your default branch, the issue remains open. Once the commit with the fix is merged into your default branch, the issue is automatically closed.
Very nice!
I have similar functionality at work, using Trac (or Confluence) and Subversion, so it seems to become the norm more and more.
But for me, who grew up with separate un-integrated tools, it's still very impressive.
Very nice!
I have similar functionality at work, using Trac (or Confluence) and Subversion, so it seems to become the norm more and more.
But for me, who grew up with separate un-integrated tools, it's still very impressive.
References
- GitHub - Closing issues via commit messages
- https://help.github.com/articles/closing-issues-via-commit-messages
Monday, 12 January 2015
Are Comments Necessary?
There are a lot of opinions on Comments in code.
In the words of Uncle Bob1:
However, if the code is abstract, but the implementation refers to a (potentially complicated) knowledge domain, comments are a requirement.
However, sometimes the code should follow the knowledge domain. You try to implement the Knowledge Domain as faithfully as possible, to sort of map it one-on-one, if possible. If that succeeds, what you end up with is a Domain Specific Language (DSL).
Here is roughly my iterative software development written out:
Always keep in mind, if you have to add lots of comments to a piece of code, perhaps it is time to refactor instead.
I think that comments can still provide insight in "why" we do things, whereas the code only tells us "how" we do things.
In the words of Uncle Bob1:
“The proper use of comments is to compensate for our failure to express ourselves in code.”Here are some things to remember:
- Code is Leading.
- If comments and code do not match up, the comments are wrong.
- Code is always current, comments age.
- add comments, if the source code is unclear
- refactor the code, if the source code is unclear, until the code is clear
However, if the code is abstract, but the implementation refers to a (potentially complicated) knowledge domain, comments are a requirement.
However, sometimes the code should follow the knowledge domain. You try to implement the Knowledge Domain as faithfully as possible, to sort of map it one-on-one, if possible. If that succeeds, what you end up with is a Domain Specific Language (DSL).
Example
For example, in my job I work with valuation of houses. There are several characteristics that account for the value of a house.- location
- quality
- maintenance
- appearance
- purpose
- facilities
Here is roughly my iterative software development written out:
- I added comments on each of these (on the getters and setters) to indicate that it was a value characteristic. (instead of, for example, an address, price, year of construction, etc.).
- I thought about it, and decided that this was a group of related data.
- I made a class ValueCharacteristics, that contained all these.
- I removed the comments.
Conclusion
The steps you take can be generified as follows:- If the code is unclear, try and add comments.
- Then try and think how you can change the code to better reflect the comments.
- Change the code.
- Remove the comments.
Always keep in mind, if you have to add lots of comments to a piece of code, perhaps it is time to refactor instead.
I think that comments can still provide insight in "why" we do things, whereas the code only tells us "how" we do things.
References
- [1] Clean Code - Chapter 4 - Comments
- Robert C. Martin (Uncle Bob)
Saturday, 10 January 2015
The Spirit of Discordance: How to run .jnlp Java Web Start JWS apps with Open...
Just a small note for whoever needs to run JNLP files on the commandline of linux using OpenJDK.
The naming is not obvious.
The Spirit of Discordance: How to run .jnlp Java Web Start JWS apps with Open...: In the Windows world, Java Web Start apps run "automagically" . That is, if you install Java, that' s all there is to it . ...
The naming is not obvious.
yum install icedtea-web
The Spirit of Discordance: How to run .jnlp Java Web Start JWS apps with Open...: In the Windows world, Java Web Start apps run "automagically" . That is, if you install Java, that' s all there is to it . ...
Monday, 5 January 2015
Rubber duck debugging
A colleague of mine pointed me to a Software development method called "Rubber Duck Debugging".
Besides being very funny, I thought it was a great idea, and I see the added value in it. Check the wikipedia1 link below to find out more.
Besides being very funny, I thought it was a great idea, and I see the added value in it. Check the wikipedia1 link below to find out more.
References
- Wikipedia - Rubber Duck Debugging
- http://en.wikipedia.org/wiki/Rubber_duck_debugging
- The Pragmatic Programmer: From Journeyman to Master
- Andrew Hunt and David Thomas
Subscribe to:
Posts (Atom)