News for hackers. Stuff that matters.
Re:The Lava Layer Anti-Pattern by bglazer on Friday December 19, 2014 @01:44PM (#8773726)
So would a better solution be to use something like:

    public static doSomething(Database db){
        db.write("did something"
    }
Re:The Lava Layer Anti-Pattern by kevan on Friday December 19, 2014 @01:59PM (#8773827)
That's the dependency injection[1] way to do it.

[1] http://en.wikipedia.org/wiki/Dependency_injection

Re:The Lava Layer Anti-Pattern by rverghes on Friday December 19, 2014 @02:02PM (#8773843)
Not really, because db is not static. In my example, that Database.write() method would itself be static, and thus you can't pass it in as an argument.

Basically, this concept means that it's static all the way down, from the top layer to the bottom layer.

Re:The Lava Layer Anti-Pattern by kyllo on Friday December 19, 2014 @03:46PM (#8774413)
s/static/void/