The Python community has a concept of things being "pythonic" or not. It's a loosely defined subjective feeling experienced Python programmers (ie not me) get when looking at Python code. It's a judgement about how well that code or design works with the language rather than against it. It becomes a cultural thing that seems to get passed on from programmer to programmer without anyone really being able to put their finger on it. It kinda gives the language its 'personality' and best practices.

Does Drupal have a similar concept?

The closest anyone can seem to get to defining what "pythonic" actually means seems to be this:

The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.

Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch*.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

* Before anybody wonders about that bit - Guido van Rossum the creator of Python is Dutch :)

Now it seems to me that Drupal seems to have it's own personality and culture that we seem to unconsciously soak up (to varying degrees) after sitting in it for a while. There are also "Drupalish" ways of doing things vs "non-Drupalish" ways of doing things. As an example the taxonomy system is a classic Drupal concept that can be wielded beautifully when working with it or turned into a nightmare when trying to fight against it.

What defines "Drupalish"? (note: must think up a better word)

Should we as a community come up with a "Zen of Drupal" way of thinking that imparts these concepts to newcomers without them having to learn the hard way. After all, I suspect most newbies site design problems with Drupal are probably more conceptual than technical. Do we need to document more higher level conceptual ideas?

Now I don't feel like an experienced enough Drupal user to write these myself, but maybe I could make a start. In no particular order:

  • it's best to explore Drupal before diving into a site implementation
  • taxonomy is just about categorization
  • chances are there is already a module that can do that
  • it is probably already somewhere in the handbook
  • it's amazing how much you can do with just CSS
  • extend the core rather than hack it
  • chances are that it's something to do with your webhosts configuration
  • yes, databases and webservers can be complicated

Note some of these may just be plain wrong or stupid - corrections and refinements are more than welcome :)

Feel free to add some more concepts in the comments here, we might end up with enough good ones to create a handbook page.

Comments

szczym’s picture

  • small is beautiful, tiny is lovely
  • content is master, interface is slave

___
Obin.org - Independent media workshop

sepeck’s picture

You are certainly experianced enough to start on it. Once you get to far in, it gets more difficult to explain.

One of the new audiences we are attracting are those not coming from the Open Source movement. We need some general philosophy pages and intro to Open Source as well. To introduce our new folks to the Open SOurce community in general and then your page to introduce them to Drupal in specific.

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

styro’s picture

Maybe we could just pilfer (sorry - fork hehe) some of what other people have written eg ESR or Bruce Perens etc. I imagine any ESR stuff might need much editing first though :)

Anybody have any links to good material?

--
Anton

sepeck’s picture

Oh absolutly, just customize and quote the parts relavant to our community with links back to the source

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

styro’s picture

I can't really find anything that even compares to the excellent stuff you guys (the documentation team) have put in the first few sections of the About Drupal handbook.

It seems to pretty much say it all. I don't think the challenge is writing more - it's getting newbies to actually read what's already there.

I think the handbook speaks in a better more natural language for Drupal newbies than the 'open source' writers do. ie less jargon, more concise etc.

--
Anton

sepeck’s picture

Tell you what then. Some of the pages can probably be better written combined or organized so that they can be more visible. Try looking at it from that perspecitve. Eaton has an interesting approach that's close enough to what I was thinking of that we can tie this all together.

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

Tresler’s picture

* Yes, someone should do something like that, when will you start?
* README twice, Implement once.
* Give a man the code, and he eats for a day, teach a man to code and he eats for a lifetime. (or woman, of course)

Finally,
* Install, Enable, Access.

Zen’s picture

eh?! :P

styro’s picture

you are the Zen of Drupal.

We have finally found you!

PS - did you know your profile page is the first google result for 'zen of drupal' :)

--
Anton

puti’s picture

I'm starting to see why contributing to the drupal community is important. It's a good idea to have a page talking about the drupal culture. In the spirit of contributing here goes...

flexible is better than fixed?

drupalessence?
drupalike?
drupalish?

I'm no poet, but since this thread is about about 'the zen of drupal', I had a go at writing a haiku (tongue in cheek!)

let drupal questions
be like autumn leaves, falling
gently and often.

styro’s picture

drupalessence?
drupalike?
drupalish?

How about druplicable?

...drupalastic?

...drupalicious?

...drupadelic?

Geez, sounds too much like Austin Powers.

I have a nagging feeling I'll regret this post later :)

--
Anton

lucyconnuk’s picture

Drupalosophy?

From the greek, "sophia" = wisdom and "drupal" = drupal...

Lucy C

grcm’s picture

I'm still working on Drupalogy on the path to Drupalosophy...

-- Version Control your Drupal web site with The File High Club

styro’s picture

This whole thread will end up being refined and put in the handbook somewhere (yes I will take care of that). Comments and feedback welcome...

I think two related concepts Drupal seems to use heavily and some newbies might not grasp at first are abstraction/polymorphism and decoupling.

These two ideas combine to produce (I'm stretching a bit here) horizontal integration instead of vertical integration.

This will be old hat to software developers or anyone who knows Drupal already and appreciates the horizontal integration, but these concepts sometimes confuse and frustrate newbies that might expect a more vertically integrated experience. They can't understand why Drupal is the way it is.

As this is a deeply ingrained and deliberate design feature of the whole Drupal architecture and community culture, I think it would be helpful for people to realise this upfront. It would either help them come to terms with it sooner, or help them decide that maybe Drupal isn't for them without wasting too much of their time. Either way this is better for both the potential newcomer and for Drupal.

Now to explain what I mean by horizontal vs vertical...

Vertical integration
This is when something does a specific task from top to bottom in a relatively self contained way eg it handles display, searching, data entry, navigation etc. You build your system by adding components to sit beside each other.

The vertical approach is easier to get started with, but you can run into trouble later on as things don't integrate well with each other later, and each new piece you add seems to exponentially increase the complexity of integrating these components.

Vertical integration works best when you can find a single tool or application to do pretty much everything you want.

Horizontal integration
This is when you have independent components that each solve one layer of many different problems in an interoperable way. And you build your system by stacking them and arranging them in different ways.

This approach requires more upfront planning, design and discipline, but ultimately leads to a more maintainable extendable and better integrated system. It also makes it much easier for someone to add new functionality when 80% of the effort has already done by other layers and is just waiting to be used.

Horizontal integration is best for when you want flexibility and the ability to integrate other functionality.

Frameworks tend to use the horizontal approach, while applications tend to use the vertical approach. Drupal is a bit more of a framework than an application.

While Drupal might be regarded as a horizontally integrated system, it can still be used to create a single vertically integrated system. eg CiviCRM successfully does that.

As for what I mean by those other concepts...

Abstraction/Polymorphism
My use of these terms is a bit fluffier than what an Object Oriented software developer might expect, but hey they aren't the intended audience. Better ideas for these words are welcome.

Drupal content is based around nodes of different types. Instead of writing specific functionality targeted at a specific node type, generally Drupal developers try to target nodes in an abstract way. That way a new piece of functionality will work against any (or at least most) node types that a site might install.

There is a similar abstration with taxonomy. It is a general purpose system for describing content, and functionality can be written to leverage that in any way the developer likes.

Decoupling
Instead of big monolithic pieces of functionality, the Drupal world favours many smaller pieces that can interoperate with each other. So instead of using a small number of prefabricated components to build your web site, you use a larger number of interoperable building blocks.

This approach reduces the reinventing of wheels (and bugs) that happens with large monolithic components. This in turn keeps components focussed, tight and reusable for different tasks.

This is somewhat related to the Unix command line shell where a complex task can be solved by piping input and output through a series of small common components, rather than looking for one big tool to do that complex task. In turn each small component gets a wider audience to report and fix bugs than would happen with the small specialised audience for that monolithic complex tool.

I think the upfront effort of a horizontally integrated system is offputting to newbies that don't initially see its advantages. It is probably why Drupal attracts a somewhat more technically inclined audience than other systems. Our challenge is make these advantages more apparent, while not giving any false impressions about how easy the early steps will be compared to other approaches.

The future of Drupal looks like it heading even to an even more polymorphic and decoupled architecture with the work being done on systems like the Views module, CCK (Content Construction Kit), and (less officially at the moment) the Category module.

Hmm this text is probably getting too long...

--
Anton
New to Drupal? Please read this
Also: Forum posting tips

sepeck’s picture

People's heads will explode if they read that. :)

Found this in the module dev guide.
http://drupal.org/node/23789

This sort of sums it up in many ways. I am thinking of bringing it up a level when we re-org the dev section of the handbook.

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

styro’s picture

People's heads will explode if they read that. :)

That realisation was dawning on me as writing it. It basically boils down to explaining just what framework vs app means in some ways.

Maybe this whole 'Drupal Philosophy' topic could be presented as a set of repeatable and quotable one liners like the original ones above, but with a subpage briefly explaining what each one mean if more clarification is needed. These subpages make liberal use of links to pages like the one you listed.

Or if the explanations are short enough, they could possibly be handled by a definition list on one page.

--
Anton
New to Drupal? Please read this
Also: Forum posting tips

eaton’s picture

The Zen of Drupal...

A web site is a garden.
...And only you can create your perfect garden.
...The garden that is perfect for me is not perfect for you.

Many others have gone before us, though...
And they have shared their tools...
And their flowers...
And their knowledge.

With them, we will plant...
And water...
And tend...
And watch...

And each of us will grow our perfect garden.

...When we find a tool...
...Or a flower...
...We will share it, too.

And future gardens will grow greater than ours.

--
Jeff Eaton | I heart Drupal.

--
Eaton — Partner at Autogram

styro’s picture

Brilliant - I vote that goes on the front page somewhere ;)

Or that should at least go somewhere like the Theme Garden...

--
Anton
New to Drupal? Please read this
Also: Forum posting tips

Crell’s picture

Eaton that's not the Zen of Drupal. That's the Zen of Life. :-) I like it.

--
Larry Garfield
http://www.garfieldtech.com/blog

--
Larry Garfield
http://www.garfieldtech.com/
Thinking Functionally in PHP: https://leanpub.com/thinking-functionally-in-php

pcwick’s picture

My head did not explode reading styro's post. Its one of the most helpful things I've read about Drupal since I started exploring this site about a year ago. As I read, several times I said to myself, "Ohh, I see". I think Drupal docs will benefit from many more general descriptions like this as a preface to more specific and technical details.