When you're using libraries, you're actually making your own custom framework. Because a framework is basically a set of libraries that work together to help you get to a certain goal. If there's already a framework that helps you get to a certain goal, it can save you a lot of work to use that existing framework instead of making your own. It can also save you a lot of security issues. But if your requirements don't…
Frameworks are for hacks, libraries for seeds
21–30 of 50 posts
Re: Frameworks are for hacks, libraries for seeds
#22If indeed that's the case, then welcome to the era of the quick hack. From the nanosecond the user hits the power button on their little box, and the BIOS loads 0x7c00 and executes it (loosely defined, frameworks call your code), we're in framework world. You want your browser loaded? Better hope that the user clicks it, and the OS calls your code, because otherwise you're malware (and you were still loaded by the OS…
You're interpreting the poster by pulling the definition past the breaking point of any utility to this conversation.
Either air your grievances with the word "framework", or try and read what the author meant.
Re: Frameworks are for hacks, libraries for seeds
#23Re: Frameworks are for hacks, libraries for seeds
#24If indeed that's the case, then welcome to the era of the quick hack. From the nanosecond the user hits the power button on their little box, and the BIOS loads 0x7c00 and executes it (loosely defined, frameworks call your code), we're in framework world. You want your browser loaded? Better hope that the user clicks it, and the OS calls your code, because otherwise you're malware (and you were still loaded by the OS…
On the contrary, if the only connection between my code and the kind of "framework" you're describing is the entry point, my code is 99% not dependent upon frameworks. I am free to structure the remainder however I wish and to incorporate libraries on my terms wherever reusing their code is helpful.
Even if those libraries might encapsulate some functionality that calls back to some OS API, they do so when I want to use that functionality, not when the OS requires me to make that API call. So for practical purposes I don't think your analogy between system/platform software and frameworks holds at all.
Re: Frameworks are for hacks, libraries for seeds
#25When you're using libraries, you're actually making your own custom framework. Because a framework is basically a set of libraries that work together to help you get to a certain goal. If there's already a framework that helps you get to a certain goal, it can save you a lot of work to use that existing framework instead of making your own. It can also save you a lot of security issues. But if your requirements don't…
Frameworks tend to be more tightly coupled than libraries. They impose more opinion onto your code and make it harder to achieve modularity. They also tend to show up in languages which lack critical features for achieving proper modularity.
Truth is,with dependency injection, one doesn't need a framework.But most people writing Ruby or Python apps don't understand the value of a registry that lazy-loads objects and it's dependencies.They mix module systems with IoC .
Re: Frameworks are for hacks, libraries for seeds
#26However, I think there's more here that the author skirts around. He laments the fact that "in-fashion" changes to a framework force you to refactor your code. I'm not so sure that this is purely a negative thing. Let's take the upcoming Laravel 5 as an example; on the face of it, Laravel 5 is a drastic departure from Laravel 4.2. The directory structure is completely different, and the way you interact with The System is changing in a subtle but significant way (middleware). Is this cause for consternation? Perhaps. It requires developer time to upgrade, which is not free. But the gain is twofold: you benefit from using newer and, ostensibly better, structure around your app; and you grow as a developer, because you learn a new way to do something familiar.
I'm not saying here that the author's assertion that this is unnecessary is incorrect; just that there are benefits to being forced into change.
Also, regarding libraries: just because two libraries deal with the same topic or technology does NOT guarantee that they'll make the same assumptions about abstraction. Even on the device driver level, you can't take that for granted.
Re: Frameworks are for hacks, libraries for seeds
#27If indeed that's the case, then welcome to the era of the quick hack. From the nanosecond the user hits the power button on their little box, and the BIOS loads 0x7c00 and executes it (loosely defined, frameworks call your code), we're in framework world. You want your browser loaded? Better hope that the user clicks it, and the OS calls your code, because otherwise you're malware (and you were still loaded by the OS…
EFI, on the other hand, is quite framework-ish.
Re: Frameworks are for hacks, libraries for seeds
#28The problem with libraries is that they might not match. For example, what if one library you use uses another String class from another library you use. You'd have to write a lot of glue-code to let these libraries talk to eachother. It gets especially tricky if one library uses a garbage collector, and another library uses a different one. You could get cycles between objects managed by different libraries, which w…
This is a real problem, certainly. In very bad cases (anyone remember programming COM from C++?) the burden of making a simple function call from one part of your code to another can be soul-destroying.
This is why I think the modern kitchen-sink standard libraries might be missing a trick. Instead of trying to provide everything out of the box, often to an acceptable but not best-in-class standard, what if our programming languages concentrated on just establishing conventions and providing universal tools with relatively small standard libraries, and then emphasized tools to connect different libraries from other sources together? That is, could they make it easier not just to import modules from different libraries but also to convert data types and match calling conventions and initialize/close down run-time systems?
Plenty of ideas have already started down this path, from implicit type conversions or coercion to full-blown lens libraries, simple calling convention annotations to full-blown FFIs and wrappers, and so on. However, to my knowledge, no mainstream language today has an explicit design goal to make integration of multiple modules that have related functionality but different conventions as easy as possible. I wonder how far we could run with that strategy.
Re: Frameworks are for hacks, libraries for seeds
#29Win32, Swing, iOS, et al aren't really frameworks in the same sense that something like Rails is. Win32 doesn't care if you name your code something that clashes with The Revelation Given To Great Prophet DHH; all it cares about is that your WNDPROC behaves like it should. The OO variants of this only care that you derive your UI classes from the framework's classes so you can be notified of relevant events. Nor did these old 'frameworks' (as often incorrectly stated) prescribe the underlying architecture. They didn't force you into MVC for every single project, they didn't force you to use a database for persistence.
Monolithic frameworks are a modern fetish; borne out of a Stockholm Syndrome for the Business: "how will we hire easily replaceable workers?" / "how will we spin someone up in the minimum amount of time?". The answer: programming by MadLibs.
Developers advocate for them because they provide immediate gratification for doing very little work. They confer a mediocre architecture on all projects, which is perceived as preferable to the hard work of designing and architecting a system from scratch. They are a form of blame-shifting by developers: they can offload some of the risk and the Hard Parts of development to a Smart Person/The Community and run to them for help when it breaks. This is not a bad thing, but it does stunt the design impulse, and limits their growth as developers.
In the case of Rails, choosing Rails is no guarantee of project quality, or even conventions. Are you using Postgres, Mongo, or a combination of data stores? If it's the latter, then AR's transactional niceties are out the window! Are you using regular Rails views, presenters, or decorators? When you structure your controllers, are you using The Rails Way (fat models), or services, or more Bernhardt-esque design (app lives in lib/)? All of these things require spin-up time to learn the where and the why.
I do think frameworks are a symptom of propping up conceptually weak abstractions (e.g. the web) and languages. It should be concerning to you that all the metaprogramming in the world + a fully dynamic runtime cannot produce a framework that makes it easy to produce minimally coupled run-of-the-mill business software that doesn't require horrendous hacks like Rails' Spring.
Buy a copy of Growing Object Oriented Software, Guided By Tests. The author builds something sans framework, letting the construction of the software guide him to the best design. The resulting software is lean, supple, and easy to extend.
Re: Frameworks are for hacks, libraries for seeds
#30There are a lot of platitudes here whirling around a central point: Frameworks are more restrictive than libraries.
But, omgwtf, that's exactly the point of frameworks - they enforce convention in exchange for faster development. Also, newsflash, any large software project is going to have its own conventions. Okay, so, if you're still following me, get ready to take a leap. What if we have conventions that can apply to more than one project to reduce the ramp-up time for programmers to contribute?
The neophytes on HN eat this kind of stuff up, without ever considering that the thing the author is whining about is exactly the intent.