Quantcast
Channel: uttumuttu
Browsing latest articles
Browse All 10 View Live

Obtaining BGGA Closure Parameter Types at Runtime

Recently Alex Miller has explored the use of BGGA closures for building dynamic visitors. Such visitor builders, and also Ricky Clarkson's closure-based pattern matcher, could be greatly simplified if...

View Article


Verbosity of Non-closured Java Violates the Law of Demeter

It is well known that Java programs (at least of the non-closured kind) tend to be rather verbose. Some people actually even prefer this, since it may make program more readable. In this post, however,...

View Article


Why C++ Still Kicks Ass

Take this simple class for three-dimensional vectors with parametrized types:template<typename T>class vec3 {public:    T x;    T y;    T z;    vec3(T const& x_, T const& y_, T const&...

View Article

Inferential Duck Typing, or: Type Hierarchies Considered Harmful

Let's begin with some Java code:interface File {    void open();    void close();    void delete();}interface Fridge {    void open();    void close();    void addSticker(Sticker s);}class Util {    //...

View Article

Reuse as a Refactoring Strategy

There has been a strange pattern reoccuring in a lot of my development efforts. Often, when I write a component X acting as a backend ("server"), and a component Y acting as a frontend ("client") to X,...

View Article


Static Checking is Defensive Programming

(But not vice versa.)void openFridge(Object object) {____if(!(object instanceof Fridge)) {________throw new IllegalArgumentException("!(object instanceof Fridge)");____} else {________((Fridge)...

View Article

Probabilistic Modus Tollens

Here's the rule that justifies the classical modus tollens inference:[A => B] <=> [~B => ~A].An example: if all kings have crowns, then not having a crown means one is not a king.However,...

View Article

Arguing on Taste

A saying goes: "you can't argue with taste". This is neither true nor false: the saying is too ambiguous to warrant such classification.This is a classical case of equivocation—the confusion of...

View Article


C++ Kana #1 — Usable Logging

Let's exercise RAII and streaming. Write function line() that allows you to writeline() <<"hello world "<< 5 <<"!";transforming tostd::cout <<"hello world 5!"<< std::endl;

View Article


C++ Kana #2 — Dependency Injection

This time we'll exercise templates and the typeid keyword to build a Guice-inspired dependency injection framework. Write class Injector that allows you to writeclass IService {public:    virtual...

View Article
Browsing latest articles
Browse All 10 View Live