Skip to main content

Posts

Showing posts from November, 2012

The Untouchables

There are some technologies that have such strong "street cred", they are effectively untouchable. Anyone who dares imply that they are deficient in any way is instantly labelled an uneducated moron. It is impossible to have a realistic conversation about these technologies, and it's not very common for enthusiasts of these technologies to admit their failings. Let me give some examples:Linux is the best operating system.Common Lisp is the best programming language ever invented.Haskell code is shorter, more elegant, and more correct than code written in any other language.Emacs is the best editor for real programmers.Apple creates the most user friendly user-interfaces.Tiling window managers lead to the highest degree of user productivity.Ruby on Rails is the best web framework written in any language.The only way to write good software that meets its users needs and is delivered on time is to embrace agile software development and use test-driven development.Of course,…

Humor: Metamocking

There are a lot of very powerful concepts in the world of software engineering that have "meta" in their name. Just consider metaprogramming and metaclasses. I've spent some time thinking about what "metamocking" might look like. What would it mean to mock a mock?First, some background. Let's say I have the following function (written in Dart):void helloWorld() { print("Hello, World!"); }How do I know if it works correctly? Since it doesn't return anything, but rather changes the state of the outside world (specifically, the stuff printed to my terminal), it's not so easy to test.Mocking to the rescue! I need to add a bit of dependency injection so that the test can pass in its own code for printing and so that I can mock things properly:library hello_world; const defaultPrinter = const Printer(); class Printer { const Printer(); printValue(String s) => print(s); } void helloWorld({Printer printer: defaultPrinter}) { printer…