Refactoring

all tags

Pages tagged with "Refactoring":

Give Me Smarter Objects

18 Jun 2018 , tagged: Scala, OOP, Object Oriented Design, Code Smells, Refactoring

A coding exercise I do once in a while is writing Battleship. It’s a fun little exercise, comes with a slew of interesting decisions, and every once in a while I do this exercise with a candidate as part of the interview process. It’s always exciting to see what other developers come up with. Today I was doing the exercise and I contemplated on the primitive obsession code smell that always seems to creep into my code and saw a beautiful way to apply the extract class refactoring that very succinctly shows how nice object oriented programming can be.

read more →

gorename and invalid expression

23 Oct 2015 , tagged: Golang, Go, zsh, Refactoring

This took me longer to figure out than I care to admit, so here’s the solution. The issue comes up when trying to use gorename: $ gorename -from "github.com/ilikeorangutans/foo".MyType -to 'MyBetterType' gorename: -from "github.com/ilikeorangutans/foo.MyType": invalid expression Even though the from query looks normal, gorename just refuses to work. However the issue is not so much with gorename but rahter my shell, zsh. Turns out properly escaping your from query, fixes the issue:

read more →