Know that:
- I'm not talking of the Plone core, that is obviously going in the right direction (the plone.* and plone.app.* universe is one of the clearest example) but only of products add-ons.
- I'm not also talking of bad code (no "Spaghetti code"). Maybe your final result is great and will change the world! I don't care.
If you are not a genius, probably the first Plone product you did was crappy. Apart of the features in it, its structure was probably something like a single product called "Products.MyProjectXy".
What this mean is: all Plone features you need in a single product (a real monolith!).
Maybe you were already an experienced programmer (so your product was well designed... inside) but the final result was not the best.
After some times, when you started looking at other product's code (or if you bough the Martin's book), you probably quickly learned that splitting the product is good: the Separation of concerns is really important.
What is the level of modularity you need to reach? In how many different eggs/packages you need to split your project? I've no a real response about it... we have a Third Normal Form about software design? I don't remember too much of my lessons about program engineering...
Thinking modular
Let me say: splitting a Plone project in more than one egg is "boring". Sometimes you have the sinister feeling that you are loosing your time (and I also remember times when ZopeSkel wasn't there to help us) and the temptation to ignore this practice. Maybe a Demon of Bad Software is talking at your soul in that moment.
An example: you are in a very productive state, lines and lines of wonderful code and new features are flourishing under you fingers (Daniel Pink call this the "Flow State")... then you develop something you know it's better to be moved away from the module you are developing because you know that this choice, one day, will pay you back. But to do that, you need to stop your "Python Frenzy" for some minutes.
Don't know you, but this sometimes hurts me. However I know this is good and must be done so (bleeding) I move the code away. Not later! Immediately! Why? Because the path to "Products.MyProjectXy" is easy... when you are there, it's too late!
Every time a customer ask you for a new feature:
- think if this feature can be made more "general purpose"...
- ... or if another customer can like it ...
- ... or if someone else already asked for something similar.
Too famous Plone features (sometime more that the product itself)
Some concrete examples.
Let me say that sometimes, when you create a Plone product, you don't know how useful to the community it can became in future. Worst, sometimes a feature inside you product can be useful to other...
... is not always easy to "think at future": the list of projects that follow talk about great Plone products I used a lot of times and the saved my time. So probably done by great developers... however inside them I can still found sometimes the problem I'm described above.
The Kupu link administration
We have all moved away from WYSIWYG Editor Kupu, preferring the famous TinyMCE.
However Kupu still have a useful feature inside it (I still remember the first time I see it at one of Plone Conference... woah!): an administrative tool that can transform your links inside documents from "normal" ones to the "Use resolve UID" form, or get back to the normal form.
Unluckily this feature is shipped with the Kupu product (and: using AJAX stuff, it need that Kupu si really installed to work properly).
The Maps location field and widget
The product Maps give us some simple but direct features of integration with Google Maps. Also, it contains a new type of field and widget: the LocationField (that can contains 2 coordinated values) and the LocationWidget (that help filling the LocationField using Google Maps interface).
This new field/widget pair can be very useful, but this feature is inside the Maps project, not given as external dependency. Also you are forced to install the product in your Plone site if you need it (having it only in your buildout is not enough).
Flowplayer metadata extractions
The well know collective.flowplayer is giving simple Plone Video features to Plone. Instead of simply giving you the video player integration, it contains a simple piece of code that extract video metadata from uploaded files using the 3rd party library hachoir.
We have two problem there: if you need the metadata extraction feature you need to add Flowplayer to your buildout (minor issue: this time you don't need to install it) but also you are forced to use hachoir, that is not a perfect library (first of all: it brakes you pdb!).
Other examples?
I'm sure there are other good products that give you additional features you can like to have also outside the products itself.
Conclusion
Keep you products compact but always think about software reuse. Experience done with your own customers and users can help you to know when a piece of technology need to be moved away and maintained alone. Also: small products are simple to be maintained.
So: don't listen at the Demon that say "Enlarge you Egg".
Thanks for your interesting perspective on Plone.
ReplyDeleteI am 'cutting my teeth' on it and the waters run deep.
How do I suppress the title from showing on page?
Is there an easy way or do I have to reach into the templates to change something css or metal or tal or create a custom view?
Dietrich
dietrich at dtschmitz dot com
A counterpoint: Modularity is good, but I don't think it should be the prime concern when first building an add-on. The reason is that it's often only possible in retrospect to recognize what things are worth factoring into separate modules. I've seen too many developers get bogged down prematurely trying to abstract the structure of their code before they've created anything at all. There's a time for that, but when starting a project, keeping things in one place makes it easier to *change* the structure as new requirements are discovered, and makes it easier to bring other developers up to speed.
ReplyDeleteI totally agree that it's a shame the kupu link manager isn't separate from kupu, though. Refactoring that into a standalone module would be a great project for an up-and-coming Plone contributor!
Dietrich: the easiest way to hide the title is with CSS. Another way would be to use a "drop" rule in a Diazo (plone.app.theming) theme.
You are right: we must not loose the Target, that is "I need solve This problem for That user"! Also I understand when you say that the excessive abstraction is a great risk (when I look into Singing&Dancing I cry... no joke).
DeleteBut this is exactly what I mean when I talk about "Third Normal Form": a good level of abstraction that is needed, not more... but not less!
Going along with my previous comment, I don't think there's a point at which it's "too late" to refactor. Having instances of objects persisted in the ZODB can make it more challenging, but there are ways (module aliases, upgrade scripts) to make it possible. We're building software, not Mars rovers. :)
ReplyDeleteGreat post and comments! Thank you guys!
ReplyDelete