Hacker News new | past | comments | ask | show | jobs | submit login

He hits mainly on the layers of complexity and abstraction, but the biggest problem I have using frameworks is the inversion of encapsulation and control. When I want a hammer to stick in my app, what I don't want is a big Hammering Framework that wants my app to go inside of it. It's particularly problematic if you want both hammers and saws, and both the Hammering Framework and the Sawing Framework want to be the top level.



Exactly, that's why I always prefer libraries over frameworks.


I prefer creating customized frameworks from libraries. I tend to know more about my particular problem than any generic framework writer.

Also, I can focus only on the solutions and features I need. I often don't have to build for the super general case, which often results in a simpler framework that helps rather than hinders.


Important point there.

Frameworks are not to be avoided, but generic frameworks are very dangerous, so usually a custom framework, built with generic libraries, is the better choice.


But then you are just one abstraction step away from creating the generic framework framework that can spawn custom frameworks as needed.


Yes you are, and you can choose to go down that path or not.


Well said.

I read somewhere (wish I could remember where, bizarrely I think it was on paper) that the very definition of a framework over a library is that inversion of control - ie your application runs inside the framework - you are beholden to its lifecycles and view of the world.

When on the JVM, I use scala - and I have found very little utility for frameworks. Libraries - oh yes, very much so.


Yeah, I think that might actually be the definition now that I think of it. I do think there are some cases where that inversion of control makes sense, but it really has to be cases where there's no sensible way to proceed with anything other than total buy-in to a particular way of doing things. For example, it's fine that something like the Unreal Tournament engine is a framework. If you're going to write your game in the UT engine, you're really going to have to write it in the UT engine, and commit to doing things the way it does things; there's no sensible way for you to just use the UT engine as a library subordinate to your game. But I don't want to do that sort of thing very often or lightly.


Inversion of Control is a core aspect of any framework (Ralph Johnson discusses it quite nicely on "Components, Frameworks, Patterns" http://st-www.cs.illinois.edu/users/johnson/cs329/2003/frame...).

Main points: two frameworks can be very hard to use together, unless designed to be (both keep trying to keep the control), frameworks are a lot harder to use than library, as they impose their whole world view, and frameworks encourage tight coupling (there are about 3 patterns from Ralph's book with Erich Gama, Richard Helm and John Vlissides that have this kind of problem to solve).




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: