Duck Programming

Posted by Sam Minnée on 4 April 2012

Sam Minnée, Chief Executive Officer and co-founder of SilverStripe, has shaped the SilverStripe Suite and is part of its success story as an internationally respected open source CMS. Previously, Sam has posted about SilverStripe 3's new ORM.

When I see a bird that walks like a duck and swims like a duck and quacks like a duck, I call that bird a duck.

One thing that a few people have asked about is whether SilverStripe has modules similar to Drupal’s Content Construction Kit (CCK) and Views modules.

If you haven’t heard of CCK or Views, the one line summary is this:

  • CCK lets CMS users define new content types
  • Views lets CMS users build new templates based on those new content types

(Disclaimer: I’m not a Drupal expert!)

The short answer is that we deliberately avoided building features like these into SilverStripe. We have taken a different approach when creating SilverStripe, and I’d like to explain why.

In essence, the appeal of these systems usually seems to be to avoid having to 'do more programming' in order to add new features to the site.

Reg Braithwaite coined an apt expression for this: Duck Programming (a play on the term Duck Typing). He defines Duck Programming as “any configuration that defines or controls mission-critical behaviour of a software system that is thought to be ‘not programming’ because it doesn’t appear to involve programmers, programming languages, or programming tools.”

The point is that putting a different face on programming doesn’t really stop it from being programming in practice. We had actually tried this approach in an earlier product (the never-open-sourced SilverStripe 1). What we found is that, although some simple systems can be set up with a model like that, most of the time people hit the edge of what can be provided.

Software developers have spent decades coming up with effective ways of describing application functionality that are both flexible and concise. The result of that effort are modern programming languages such as PHP and Ruby, and modern frameworks such as SilverStripe and Rails.

Furthermore, there are all kinds of things beyond the code that software developers have adopted to manage the risks involved; things like version control, automated testing, environment management, and deployment pipelines. Most duck programming systems ignore all of this.

Because of this, we have deliberately avoided building duck programming features into SilverStripe. However, that’s not to say we never will. If we were to build and maintain such a system, we’d want to see it support these things:

  • Any custom functionality built using developer APIs built would need to be able to be extended by the duck programming system.
  • Any custom functionality built in the duck programming system would need to be able to to be extended by using developer APIs.
  • There would need to be a graceful hand-off between the base functionality that can be duck programmed and the extensions that are only possible with the developer API.
  • All changes made by the duck programming system would be put through the same version control, test automation, and environment management controls as the rest of the code.

All of this is achievable, but it wouldn’t be a trivial progress, and we have been putting our development efforts into other areas, because frankly, we don’t see these features as a panacea.

One of the appealing things about duck programming systems - a commonly quoted reason for wanting this feature - is that you don't need programmers involved to keep growing the site. Often the word “programmers” is accompanied by a grimace, and a subsequent expansion on how frustrating developers are to work with. This saddens me more than it surprises. We believe keeping developers involved in the ongoing maintenance of an application is a good thing.

If you accept our assertion that programming code is the best way to reliably describe the functionality of an application, then perhaps you will agree that it is more useful to find better ways for the team to work with developers, rather than opting for a band-aid solution like duck programming.

To borrow the phrase of another open-source developer, SilverStripe is opinionated software: it is a CMS and Framework optimised for sites where business owners, developers, and designers work together constructively, rather than trying to avoid each other. This might not be precisely what you are looking for, and that’s fine too. It is a bad idea to try and make a product that is everything to everyone, and this is the niche we have chosen for SilverStripe.

But it begs the question, doesn't a collaborative approach to web development sound like a better way?

Post your comment

Note: Comments are moderated and won't show until they are approved

Comments

  • i tried my hand on Drupal and Joomla, both are confusing, i really liked the silverstripe has laid out, its very user friendly, intiuative and Easy to manage. you dont need CCK un Strip, it like making Lots of layers to achive simple things.

    Posted by sye nayab, 2 years ago @syednayab

  • As someone who has limited programming background, I have to say that I found SilverStripe's lack of Duck Programming one of its best features. If I wanted a new feature for a website I had to do a bit of work to build the PHP code, but I found that much easier and more satisfying than the Drupal/Joomla approach: "Learn our (very complex) tools and/or find a module that someone else has written."

    Posted by Bruce Bowden, 2 years ago

  • Yes, part of not trying to be everything to everyone means accepting that, for some use-cases, other tools are going to be a better choice.

    It's better to have a small group of users love your product than to have everyone think it's okay. ;-)

    Posted by Sam, 2 years ago @sminnee

  • As someone who has come from drupal to silverstripe then back into drupal again I can say that I really like the current path Silverstripe has chosen.

    As already stated neither system is wrong in their approach - just different.

    From a developers perspective
    I much prefer Silverstripe. I feel I have much more visibility and control over what I'm building and deployment workflows much easier to manage. As I dive deeper into the code I feel it provides me with a better understanding architecture and design patterns. This knoweledge is easily transferable to other languages like java, C#, Ruby etc. This is priceless to me.

    Drupal feels like it tries to lock you into its way of thinking and working. In the end I find my knowledge base of Drupal less transferable. It feels more like a 'wizard' approach rather than DIY.


    From a Business perspective:
    For a publishing based business I would say Drupal is a better choice currently - everything else I prefer to go with Silverstripe.

    Drupal's history, and the way it works is much suited to this specific type of business. You don't necessarily need a developer to run a Drupal site. You don't neccessarily need a programming background to work out how CCK and views work so a publishing business can manage themselves quite easily. Where I currently work they have managed to get by without a developer for a long time and have full understanding of creating views and content types. A wizard approach works really well for admins.

    If you're a nuts and bolts type of developer Silverstripe is a good choice.
    If you prefer point and click drupal is a good choice.

    Neither approach is wrong.

    As a developer, Silverstripe has many benefits Druapl cannot provide me.
    For publishing, Drupal has many benefits Silverstripe cannot provide business cost effectively ;)

    Posted by Brett, 2 years ago

  • Hey UncleCheese,

    Congratulations on getting the module out! I think that you're "CLI? What happened?" comments on leftandmain.com mirror the challenges that we have.

    What you've built in SilverSmith reminds me a lot of the Rails scaffolding CLI tools. It provides a jump-start for the programmer, rather than trying to get the programmer out of the equation. I think that's a great approach.

    In my mind, my idea for "the perfect SilverSmith UI" would be one that actually reads and rewrites the PHP files (e.g., modifying just the $db and other variables at the top), such that a developer could still come and make modifications to those files, and see those changes reflected in the UI. It would be substantially more difficult (you would need to parse PHP and make non-destructive modifications to it) but it would mean that the application is useful throughout the lifetime of a project, rather than just at the beginning before a programmer has made changes to the PHP file.

    Thanks,
    Sam

    Posted by Sam, 2 years ago @sminnee

  • Wow, the timing couldn't be more uncanny. The day I release SilverSmith alpha, SilverStripe publishes a post denouncing duck programming. I love it!

    I agree with a lot of these points, and I don't believe in creating opaque programming proxies like CCK, but I do believe strongly in lowering the bar. Programmers love SilverStripe because it's so developer friendly, but designers and frontend developers are intolerant of having to call upon a programmer just to add a text field to their page. That to me is inexcusable, and should be looked at as a shortcoming of the product.

    I believe both design patterns can coexist in harmony. SilverSmith was highly influenced by Symfony's CLI tools, which do rapid code generation but never box you out of making your own changes. You can't get more programmer-oriented than Symfony, so if they're doing it, there must be some threshold of tolerable and appropriate duck programming.

    Let's face it, 80% of SilverStripe sites are the same. It behooves us to get that 80% done as quickly, accurately, and efficiently as possible so that you can apply your programming resources to the things that matter.

    Funny story -- I had lunch with Dries from Drupal at the CMS Expo, and I told him about SilverSmith (it was a brand new idea at the time).

    He responded, "Oh, so it's like CCK?"

    I nodded, but I didn't know what I was nodding to.

    Posted by Uncle Cheese, 2 years ago @unclecheese

  • Hi Sam,

    Yeah, fair enough. I can totally understand why you wouldn't want to have this sort of functionality in SilverStripe, but sometimes it's hella useful and a real timesaver.

    It's worth thinking of Views really as not being designed to be used by CMS users as such - but as being designed to be used by a Drupal developer, who understands programming but chooses to 'program' a particular piece of functionality via a web front end rather than via text editor.

    Horse for courses and all that.

    All the best.

    Posted by Dan, 2 years ago

  • Hey Dan,

    "Is not having to write a line of code a good thing or a bad thing? Neither, it's just 'a thing'. Drupal and SilverStripe (CMS & Framework) are both great bits of software, but use different paradigms for solving similar problems - which one is right for any given project depends on resources, time and expectations."

    Yes - I'd definitely agree with that. Some people will prefer to use Drupal and that's fine. The main point of the blog post was to explain why we have chosen to go in this direction.

    "Oh, and to imply duck programming (i.e. using Views) inherently increases risk is a little disingenous - any serious Drupal shop knows the potential pitfalls of using Views and has processes in place to mitigate these risks."

    I can only speak from my experience; after all, there's a reason that we've decided to stay away from it when developing SilverStripe. You're right in that the risks around duck programming can be managed.

    Posted by Sam, 2 years ago @sminnee

  • Interesting article.

    Views/CCK are great tools especially once you start using Views relationships, contexts and arguments, but they have a very steep learning curve and aren't really designed to be used directly by novice or even intermediate site editors.

    You generally don't need to write a single line of code to do some very funky things with your data using Views, but to build something useful you do need to understand programming concepts at the very least.

    Is not having to write a line of code a good thing or a bad thing? Neither, it's just 'a thing'. Drupal and SilverStripe (CMS & Framework) are both great bits of software, but use different paradigms for solving similar problems - which one is right for any given project depends on resources, time and expectations.

    Oh, and to imply duck programming (i.e. using Views) inherently increases risk is a little disingenous - any serious Drupal shop knows the potential pitfalls of using Views and has processes in place to mitigate these risks.

    Posted by Dan, 2 years ago

  • I totally agree. I see complex back-ends for systems joomla, and magento, and think "the client will never use or need any of that".

    Duck programming requires people to learn a whole new interface, which I'm guessing will either be the developer or the client. These learned "skills" are only specific to that CMS/interface.

    This is one reason I like SilverStripe, as it only focuses on functionality relevant to the client. The developer gets involved when they can't do something.

    The hard part can be finding where to draw the (blurry) line.

    Posted by Jeremy, 2 years ago @burnbrightweb

RSS feed for comments on this page | RSS feed for all comments

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.