This is as good a place as any if you're looking to solicit opinions
from the development community around Django. I'm happy to answer a
few quick questions (and even a couple of detailed questions) to help
out.
Yours,
Russ Magee %-)
It's certainly one of the strengths of Django as a framework. However,
I would also point at a couple of other big features that contribute
to Django's success:
* Language choice - Python is a very clean, highly expressive language
* Batteries included philosophy - Django works out of the box with a
minimum of fuss.
* Great documentation - Although it isn't perfect, there's a lot of
officially provided documentation, and it is (for the most part) well
written and clear.
* API stability - our backwards compatibility policy is a strong
selling point for larger customers
> - no other famous and widely used *web* frameworks (es: cakephp, ror,
> etc...) shares the same idea
I don't think I'd agree with this quite as rapidly. Zope, for example,
is essentially a framework for reusable web applications by definition
-- you plug your Zope application into your Zope server. You could
argue over how well the Zope implementation achieves the reusability
goal, but it's hard to argue that the idea of reusable components
aren't at the core of it's architecture.
As for more contemporary frameworks like RoR or Pylons; they may not
make as much of a community noise about reusable apps as part of their
core philosophy, but that doesn't mean that reusability doesn't matter
to users of those frameworks. There is a vibrant community of plugins,
APIs and tools for RoR and Pylons, all intended to maximize reuse.
Reuse isn't a Django-specific feature - other frameworks use different
language and different approaches, but *any* good engineer will aim to
maximize reuse, regardless of the toolset they are using.
> - this idea is not well advertised (how many of us started developing
> a website in a single and heavy application and only then realized the
> "big idea" of reusable apps?)
No disagreement here. In the broader community (through presentations
like those given by James Bennett, and by example in projects like
Pinax) there is a lot of documentation about the reusable app
philosophy. However, we haven't been as effective at integrating this
into the core project website.
There has been some talk recently about adding some more pages to the
tutorial to address this omission -- however, this has also been
discussed many times in the past. It's not a new idea, it's just a
matter of resources. Writing good documentation takes time, doubly so
for tutorials.
> - patterns to build actual reusable applications are not established
> yet or they are not easily available to users to follow, resulting
> (with some exceptions) in a lot of not reusable apps or apps
> implementing their modularity in very different ways (not following a
> patter or a standard method)
Part of the problem here is that standards for reusable apps are still
emerging. Every time we write a new reusable app, we are able to
improve slightly on best practice. contrib.comments was a good example
of a reusable app when it was delivered in v1.0. However, as of v1.2,
it's missing a number of important features (such as URL namespaces
and class-based URL configuration). If Arthur Koziel's GSoC project
lands, that will change best practices yet again.
Interestingly, the idea of documenting best practices for reuse is
actually where Pinax started. Originally, Pinax grew out of a project
called 'Django Hotclub', which was/is a mailing list that was/is
trying to identify best practices for reusability. James Tauber
identified (quite correctly) that it's very hard to have these
discussions in the abstract, so he started Pinax as a way of providing
a testbed for reusability ideas. Pinax has been extremely successful,
and serves as an excellent set of examples for how to do reusability
well; however, the original project of distilling the best practices
into a documented set of guidelines hasn't fared as well.
As for the state of reusability in the wider community -- yes, some
publicly available apps aren't as reusable as they could be. However,
in their defence -- they're exactly as reusable as they needed to be
for their creators. People don't intentionally put bad code up on
Bitbucket et al; they put up code that they have found useful, and
they want to share with the wider community. An app that doesn't reach
the theoretical maximum reusability doesn't mean it isn't reusable, or
isn't useful for some given purpose.
While there is a some theoretical, Platonic ideal of reusability that
could be achieved, actually shipping a product is much more important
-- remember, we're perfectionists with deadlines. While there are some
simple things you can do to maximize reusability, many of the steps
require some serious engineering work -- for example, using url
reversing instead of hardcoding URLs is easy; making a core data model
pluggable (as contrib.comments does) is much harder. Sometimes, the
effort required to make an application completely reusable isn't
warranted by the person who writes the application in the first place.
I'm sure that most of the authors of these "imperfect" apps would
gladly accept patches to improve them, and the more successful the
app, the more likely it will approach best practices. Again, Pinax has
made a habit of this -- find a project in the wild that does something
interesting, and 'adopt it', making it more reusable until it can be
integrated as part of Pinax itself.
Again, this is an area where Django has room for improvement. If there
is a pain point or common patterns that reusable apps need to
implement, we should be providing the infrastructure to minimize the
code that end-users need to write. We rely upon our community to talk
about these pain points, and to propose (and implement) solutions.
Yours,
Russ Magee %-)