Latest Posts Under: Refactoring

One of the challenges we face with coding is dealing with coupling. Coupling is an important aspect of programming, it tells us how much our code is tangled. When coupling is too high, we can’t easily re-use code. When the coupling is too low it does little. You can measure coupling, there are several metrics for it even (for instance “Coupling between Objects, CBO”). In this blog post I’d like to talk about a subtle introduction of coupling: when you introduce a factory method. Consider you have an interesting piece of code, and this piece… Read Article →

A lot of things can be found in the snippet at “What is wrong with this code #02″. Here it is again: [sourcecode language=”java”] public MyObject { private String myField; … (imagine multiple fields) … public GenericObject toGenericObject() { GenericObjectFactory genericObjectFactory = GenericObjectFactory.getInstance(); GenericObject genericObject = genericObjectFactory.create("myObject"); genericObject.setField("myField", myField); // imagine multiple lines using genericObject.setField("field", field) return genericObject; } } [/sourcecode] Already many things are pointed out in the comments of the initial post. One thing that immediately struck me is this line: [sourcecode language=”java”] GenericObjectFactory genericObjectFactory = GenericObjectFactory.getInstance(); [/sourcecode] Don’t do this. GenericObjectFactory implies… Read Article →

Recently I posted my opinion about regression. Regression bugs are likely to occur on projects with a lot of legacy code. I consider legacy code as untested code. At the legacy coderetreat we used a small codebase (you can find it here). With that codebase we exercised in sessions to improve the code. The nice thing is that this is very similar with your daily job. You open up a project and you have to make changes in code you haven’t seen before and do not understand. In order to get a better understanding you… Read Article →

I hate it. You change something and you can’t tell if your change broke something in the system. If you’re lucky, you did not break anything. Or nobody noticed it. Next to that, on the same scale of luck, the potential bugs are found in the manual testing phase. But often there is no time to do all the regression testing by hand. It will take days and days, and the change you made looked so insignificant. It should go live. What could possibly go wrong?. Then it happens. You’re live, your changes work, but… Read Article →

At the end of 2011 I started organizing a coderetreat. It started on twitter around October. I’ve also posted about it in my last mini blog. The original event can be found here. If anyone was interested, they could sign up (max 25 people) for free. All you needed to do was bring your best humor and if possible a laptop with your preferred dev environment set up. (Its not hard to organize one, check here if you’re interested) If you want to know more about what a coderetreat is, click here. Even better: join… Read Article →

Scroll To Top