Go, robots and refactoring

  • I would suggest naming the method "Device" instead of "GetDevice". The word "Get" is almost always redundant.

  • >Go aka golang is an amazing language

    By what standard? I've been very underwhelmed.

    The type system is very mediocre. Support for generic programming is awful. What kind of language idiomatically involves casting to the top type? That would be like if Java idiomatically involved casting to Object, or C++ idiomatically involved casting to void*, just to get any sort of genericism. Look at almost any big Go project; the abundance of {}interface typed variables is alarming

    And then how about language extensibility? Go relies heavily on built-in keywords, like range and make(). You want to range over a tree or a linked list? Too bad. You can only use built-in types. Or maybe you can wrap your data structure in a chan and range over that. Goodbye performance and simplicity.

    Go is not a bad language. I use it on a number of web projects, and it works very well. But Go is not, by any metric I can think of, an "amazing" language. At best, it is a decent language with lots of corporate support, a good standard library, and some good tools like golint, go get, and go fmt.

  • Nice post Matt! I would love to see more of these eyewitness accounts of refactoring in the go community. Maybe a refactoring video should be in the works ;)

  • This is really helpful. I'm getting started with Go now and common idioms and refactoring are useful when moving past the tour and introduction stage.

  • This is a really helpful article - nice work Matt.

  • Go looks interesting. Anyone else not a fan of the single character variable names?

    Also, Is there a better way, in terms of clarity, to do this:

    <- c

    Even with the comment I would think the developer forgot to fill in the first half of that and assume it was a bug.

  • Thanks for sharing this Matt.. really good insight.

  • Great post really enjoyed it.

    Also a big fan of golang, loving the posts by people using it in anger.

    Thanks