News for hackers. Stuff that matters.
Re:Using a Framework will harm the maintenance of your software by berkes on Thursday October 13, 2022 @05:12AM (#33188851)
Author here.

I use Django and Rails as examples. Both are, indeed, "just a bunch of libraries". But many of those libraries, and especially their bundled collection, enforce certain behaviour, shape and architecture.

When you inherit from base-classes offered by a library, you are tightly coupling against that: i'd then stop calling it a library and call it a framework instead. The alternative would be a library that you inject, or compose.

There's a big difference between (Rails)

`class Project < ActiveRecord::Base; end`

and

class Project

  def initialize(project_repo) # Ruby has no interfaces, but this would be something that has at least an `.add(project)`

    @project_repo = project_repo

  end
end

The first inherits, couples tightly to a bunch of libraries (ActiveRecord::Base really is just a bunch of modules that you could pick and choose) the former injects behaviour which might come from libraries, or might come from your own code.

There are no comments on this comment yet.