Drupal as framework - drupal

Can we use Drupal as a framework for larger application? Is it suitable for developing big application in its framework, or is there any limitation of it?
I want to use Drupal as a framework in my application. Is it worth?

If you are looking for a development-framework, Drupal is probably not the right choice. If you are looking for a suite to build websites, Drupal is probably the right tool.
People often tell that Drupal is a CMF, where the F stands for Framework, but in reality, Drupal is simply a flexible CMS.
On a high level, web application framework are split into two categories: the MVC and the CMS. Model View Controller being what most people call a framework. CMS being simply a flexible CMS with application-development abilities.
In practice, what Drupal lacks is:
Proper architecture. Most things in Drupal, evolved organically; which causes inconsistency, unexpected behaviour and unexpected barriers. Not saying that Drupal is not build up properly: just saying it has not been architectured: designed as a whole.
Principle of least surprise. Many frameworks allow skilled developers to create sites in a few hours. With Drupal you must gain a lot of experience and best-practices before you can be confident to roll out websites on planning.
MVC. Drupal has a distinct database-layer and a theme(view) layer, but they are unconventional, and often misused. And certainly not after a structural pattern.
unopinionated behaviour: a framework can force certain methodologies, libraries or even encourage certain behaviour, but it should not have hardcoded/none-overridable defaults that dicate your end-product. Or, in English: Drupals core has many defaults that dictate how you are going to set up, layout and structure your website, regardless of your (clients') needs or wishes. Modules or addons come even momre often with behaviour and often looks built-in and/or hardcoded.
DRY, don't repeat yourself: Drupal heavily depends on repeating oneself. Its entire theme-system depends on copying pieces of code into custom files and changing tidbits. Its form-override system requires copying large parts of the default form into custom modules and changing the parts that one wants modified.
Many of these lackings are the main cause for delay and budget-slips, as seen in my +10years Drupal-experience. Where the unopinionated behaviour part has proven the most nasty one to most of the projects I was involved in. Apparent simple features or ideas prove to take up large parts of the entire budget; Tiny details eating away development-weeks; that last 20% taking not just 80% of the effort, but sometimes 300%.
Besides that, Drupal does not follow OO patterns, which (according to the general consensus) is a bad thing. There is no inheritance, not DRY-practice, no object-relation-mapper*) and no unittesting-practice.**).
This might all sound negative, but in reality, people manage to build nice Drupalsites despite all these "downsides". That is because they adhere to the defaults by Drupal mostly (standard where possible, addons where changes wanted, custom development when no other option is left).
*) In fact there is; in Drupal 7, PDO was introduced, but is not (yet?) used as ORM much/at all.
**) In fact: all of core and many contributions have tests, but these are integration tests and a rare unit-test. Integration-tests (DrupalWebTest) install a clean Drupal-codebase+database for each single test. Your average core-testsuite taking over 8 hours to run is not an exception. TDD is simply not (yet) possible.
EDIT Reading into your examples: Drupal is particularly bad in the area of "form wizards", though it has seen improvement in Drupal 7. Another notable lack, in Drupal, is a proper, programmable workflowing system. There are several modules that enhance or replace the simple workflow-system in core, but they are not easy, nor efficient (development-effort-wise) to program against. It sounds like the main features you want, are amoungst the most underdeveloped areas in Drupal

This really depends on the needs of your application. Drupal, while flexible and extensible, is first a CMS and comes loaded with features which may or may not be desired for a web application. But if out-the-box or with additional modules it provide a large matches for the more classic web application features (ie. user management, content management, plugin system, theme layer, etc.), Drupal provides a great framework to avoid re-inventing the wheel (or dependencies on third party/less-mature framework plugins).
Drupal as a steeper learning curve compared to most framework. As a framework, Drupal is build and designed to for the CMS it is. Historically, Drupal puts almost everything in database. The situation is now better with the generalization of exportables and tools like the Features module. Also, unlike most framework Drupal does not use MVC and is mostly not object oriented.

Yes! You can use it as a framework. You'd want to be happy with some of the core APIs like the menu, node and probably the form API. The menu router and access control are quite good.
I've worked on a couple Drupal sites that didn't quite work because the core requirements had little to do with a CMS. Drupal is very flexible but it most suited to content management. You can of course use it as some satellite CMS for some other application. Drupal can also be used for service driven architecture.
If you want to scale up big, you might consider a framework that places more importance on testing and test driven practices. Drupal is a late adopter of these practices and is not mature in this area. It's something that I find frustrating especially on large sites where regression error becomes an issue. Consider something like Ruby on Rails if this is of interest to you.
Good luck!
Note to self: Why would I wish someone luck on a software project? ... interesting.

Drupal 8 change a lot.
- It is OOP
- Using Composer
- Have good cache mechanism in core
- RESTful in core
So now it is easy can be used as framework for any app. At end web all ways have content. E-commerce have content. And so on.

Related

When not to use prebuilt CMS?

Is there any case that creating your own CMS for a specialized website more advantageous than using a prebuilt CMS such as dotnetnuke or umbraco? Can anyone site a project when they had to create a custom CMS and not used a prebuilt CMS? Where to draw the line from using a prebuilt CMS to a customize CMS? Or is using prebuilt CMS always more advantageous than building your own CMS in any type of content driven website?
With the quality and variety of current open source offerings, I would say it's almost never a good idea to start from scratch. It really comes down to requirements and features. There's a huge variety in the features and user experience of different systems out there. You really need to figure out the priorities (performance vs. ease of use vs. flexibility vs. extensibility vs. SEO) to choose the right one.
I generally go with DotNetNuke with an assortment of custom modules to enhance aspects of its CMS and SEO capabilities. There's just not much you can't do with DNN once you really get to know it. But if performance is your highest priority, another option might be preferred.
I think it depends what the overall goal of the project is. If you are building a marketing website or your project can be easily accomplished with a pre-built CMS then you should certainly start there and build modules or customize a little if needed.
However, if you are building a web application that's core functionality is not just content, page management you have to consider going a custom route. Pintrest, Facebook, Flickr, etc. would definitely not start with a pre-fab CMS.
The Onion started with Drupal at one point but realized their needs were so custom that they ended up doing it all in Python/Django. Plus, with frameworks like Python/Django and Ruby on Rails if you are building web apps you can easily create the CMS features you need.
We do a lot of DotNetNuke, some Drupal and all of our custom web apps we are doing with Ruby on Rails. Once you have the requirements and goals of the project you have to look at your tools and see what is the best for the job. And sometimes it's making your own tools :]
if you move for a prebuilt CMS, you have to use their available functions and do improve whatever your features. but if you go fro a new custom CMS, you are free to customized to the maximum.
What are your requirements? If the majority of your requirements (65% +) are CMS related requirements, than I would strongly recommend looking into existing CMS solutions (opensource or commercial).
On other hand, if your CMS requirements are about 35% of your total requirements, then I would consider implementing in-house, fairly light-weight CMS.
Be aware, CMS sounds like an interesting and easy to tackle task, but when it comes to it, it is likely to be the most complicated project that you have ever worked on, mainly due to its extensibility, security and efficiency related requirements.
It all depends on what the requirements are for the project.

Architecture for Web-App development aimed at aiding interoperability between CMS systems. Has it been done?

I'm thinking about attempting to design a new framework architecture aimed at allowing a web app to later be easily ported into a system such as Drupal or Joomla while maintaining the independence of the original app such that updates to core functionality would require only one release or otherwise minimal extra work.
Before I start on this however, I would like to see what work has previously been done that comes closest to what I am proposing. So an answer to this question would come in the form of a reference to the most similar work or if possible a definitive 'no' that this has not been done before.
Clarification by example: MediaWiki is a common web app that has become one of the most highly recommended of its kind. However, site admins building their sites with Drupal would be required to hack MediaWiki in order for it to play nicely with Drupal in terms of sharing a user base for example. Imagine that MediaWiki has decided to do a complete rebuild of their system, what design could be used to make this interaction simply require a Drupal module or Joomla component and thus make MediaWiki available to more users?
I'm using MediaWiki as just an example, I think modules and components already exist that solve this particular problem but I hope I am able to get my idea across. It is a problem I have encountered many times during web development now that CMS systems are appearing more and more enterprise-like.
Thanks!
godwin
Content Management Interoperability Services (CMIS) is an OASIS Specification that you can use to imrprove the data portability and interoperability of a CMS. If your system has (or your provide) a CMIS interface, you can move content to / from other CMS systems that also provide CMIS interfaces.
See:
http://en.wikipedia.org/wiki/Content_Management_Interoperability_Services
http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=cmis

Developing a newspaper site in Drupal

I need to develop a newspaper site in Drupal, I've already played around with Drupal a little, and I think I know which modules would best suit my purposes. Naturally, one of the modules I'll be needing to use most is Views, but I have a couple of questions:
Because this is a content-intensive site, I was wondering if using 5-6 views on each page to generate node teaser + thumbnail lists would impact performance adversely?
I am a designer with significant front-end development experience. Like I said I've played around with Drupal quite a bit and other than running into a few hurdles which I eventually overcame, for the most part I was able to get it to do what I needed it to. Having said that, does one also need strong programming skills to fully develop a site in Drupal?
Thank you very much for your help!
Jane
Views offers caching and Drupal also has block caching, which should help you improve performance. The SQL that Views generates is never as good as handwritten SQL, but if you make simple Views, the SQL is actually quite good and not a performance problem (unless you have millions of page views).
If you can create the features you need, with modules from Drupal.org, you don't need strong developer skills. But you do need to know some PHP to make a Drupal theme which is what controls the layout of the site. It will also be a great help, in understanding the Drupal theming system, but not a requirement.
First off, check out openpublishapp.com for a Drupal distro that is made for publishers from the ground up, it's pretty hot.
To answer your questions:
1) As far as performance and views goes, having 5-6 views on a page is a normal requirement for a drupal news site and the performance issues are usually handled by views/panel cache, and using a page cache like Varnish in front of a web server, Object caches like Memcached (for the DB) and opcode caches like APC...if you don't want to learn all that off the bat you should still be fine if your traffic isn't too intense (but go sign up at getpantheon.com for awesome hosting with all of that and the kitchen sink, and check out groups.drupal.org/pantheon)
2) If the functionality exists by way of core/contrib modules, to fully develop a site for the most part one only needs to understand enough PHP to theme, and often with starter themes like Fusion, and some of the others you hardly even need that, just an understanding of how they work and are extended (which is well documented). That said, if you want functionality that doesn't exist, you'll have to code it, or have someone code it for which strong programming skills are desired, but not necessarily required :)
Even I recommend the use of the OPENPUBLISH - https://www.acquia.com/solutions/publishing
On top of to this you can make an efficient usage of
1. APC - PHP byte-code caching
2. Drupal Caching - block/template/view level caching
3. Boost - Caching module which doesn’t need any external tools
4. Varnish - HTTP accelerator
5. Memcache - Data intensive content.
Apart from this you will also need to think effectively on deciding on DEPLOYMENT ARCHITECTURE of the site - preferably Acquia or Amazon environment.
Learning curve may vary depending on your current skills in PHP or Drupal. Usage of already established distribution like OPENPUBLISH may help you to minimize the dependability on too much custom coding.

Whether to use CMS or not

I've started to wondering whether ASP.NET Webforms/MVC even have a place in the web developers toolbox anymore... It seems that CMS systems like Umbraco have replaced the web developers job. Yes I know that those CMS systems are built with ASP.NET Webforms/MVC - however is there even any reason for learning those things if all you gonna do is to use a CMS system anyway? - Also I cant find any situation where a CMS system can be replaced by your own web application.
My question is therefore: Is there any reason for learning Webforms/MVC when using a CMS?
EDIT:
My question might be more like: When should I use a CMS, and when should I go and build my own web app?
The problem with CMS solutions, and I mean all CMS solutions (not just Umbraco, or other .NET solutions, but in any language) is that you will always pay a price for using them. You may gain more from the time-savings afforded by using the CMS, but there are trade-offs to consider:
You will sacrifice a great deal of flexibility
You could pay a significant performance penalty. Many CMSs load a large amount of modules and code to service every request, and much of this is not relevant to a particular page function. (though some CMSs are more monstrously heavy than others!)
The future of your project is tied to yet another vendor, and their own choices
Very often, you rule out the possibility of using other databases that might have better fit your customer's needs (Umbraco doesn't support PostgreSQL, Kentico only supports SQL Server)
Once you start using a CMS you will be tied into satisfying the architectural decisions and API of the CMS framework, and you could eventually be backed into a corner.
This can be particularly problematic if your 'site' is more of a web application than a pure content delivery site. In such cases it can make more sense to choose to build using the full flexibility of the web application framework, rather than risk getting backed into an architectural corner.
On the other hand, if you are building a web site that has potentially hundreds of pages, with a lot of user-contributed content and is much less of a web application, then often a CMS is the way to go, and makes a lot of sense. But remember, you now have two frameworks and two APIs to learn and manage (your platform's framework and the CMS framework).
Writing a CMS is like invading Afghanistan.
Everybody gets a turn but nobody wins.
I don't think that Stack Overflow could have been built with a CMS. Does that answer your question? =)
Update
To answer your updated question.
If you want a regular corporation web containing news, articles, forum etc: Go ahead and use a CMS.
If you need to build a more custom web site like stackoverflow, a web interface for a system or anything like that: Built it using MVC etc.
I personally use a CMS for our corparate website and a MVC framework to build user and administration interfaces for our products.
Not every problem needs a CMS. In the same way not every problem needs a bespoke MVC/webforms website. It depends on what your requirements are. You pick the technology to solve the problem.
Build vs buy is the hardest decision to make. As a developer build always looks best. You can do better than that pile of carp they want to buy. Nevermind that you're reinventing the wheel, axel, cart, etc. To users/management buy always looks best. They don't have to think to hard about what they want and can have it now, not 3 months later after you write it. They forget it'll cost the same again to customise & make it impossible to upgrade.
I'll stop ranting now.
Umbraco is a pretty bare minimum CMS. To customize it (e.g. Version 7+) you'll need to know Heavy MVC, JSON, XML, Sql, etc.
In fact a Site built on Umbraco 7+ is entirely based on MVC views you set yourself and assign to SurfaceControllers (which are MVC controllers) and all you are really getting is the ability for users to edit things about your pages and have Umbraco manage it for you in a DB.
In short you still need experienced web developers to build a site on Umbraco, they just save a lot of time by not having to build the entire backend from scratch.
You use Umbraco to organize Document Types that define what Templates (MVC Views) are used for rendering different types of documetns (e.g. Web Pages) and then you built the template from the ground up with 100% control over the HTML, Css, and Javascript that get's output.
Imo Umbraco is more of a Framework like Django than a complete CMS.
Sure you can build a site in Umbraco and not customize anything, but it would be a pretty cheesey site.
The whole point to Umbraco is to give skilled .Net Developers a good platform for building a site on top of it, but they still have to build it.
Now sharepoint would be more of a complete CMS out of the box that you can do a lot with, but let's see a few problems with SharePoint...
Resource Heavy, eats 50+ Gig's to install
Eats 16 GB of ram just to boot it up (Sharepoint 2013)
Requires Sql Server 2008 R2 or equivalent (enterprise license, $$ chaching)
Requires Windows Server ($$chaching)
It's a monster basically, if all you need is a user editable blod platform... man what a waste of money. Foundation is free, but doesn't include things like the Blog Site Template, so you buy a server enterprise license ($$ big cachinge, 40,000$+ in some scenarios...)
Agreed. A CMS like Umbraco provides a (very) good out-of-the-box solution for the most basic applications. Any sort of specialized purpose is going to require additional programming knowledge. Anymore, though, and your major, if not primary need is going to be a good understanding of the business need. I think we're getting away from building the Legos themselves and on to building the neat toys with the Legos. Cheers!
A CMS (or similar application framework) will provide you with a lot of functionality out of the box, and many of them also have a good library of plug-ins. But you'll still need to write WebForms/MVC code if you want to add any custom features.

Web application integration with Drupal

We want to build a web application, that is specific to our domain, but also includes forums, blogs, etc in this application. Some integration points to Twitter and Facebook are also required.
There will also be a desktop application that connects to our web application for uploading data and downloading configuration and reports.
The question is, can we extend Drupal to host both the regular modules and our web application? (There will be business entities and their properties and daily data uploaded from the desktop application)
Or can Drupal be integrated with external applications? As an example, users and roles need to be the same and consistent across both. We may also want data from the web application searchable in Drupal.
I know this is a bit vague, but I cannot reveal more. I am very new to content management and I just wanted to know if someone has built this kind of application.
I try to rephrase what you wrote, just for you to check that I got your question right. You basically need to create a web application that:
Implements some of the standard functionality of Drupal
Have some custom functionality that should "blend into" the Drupal one (same users, same permissions, etc...)
Be able to upload/download content (or data) from desktop applications.
If I got you right, the short answer is: yes, you can do that with Drupal.
Now for the extensive one:
- Drupal has literally thousands of modules, so I expect you to get most of the things you want by simply installing the right combination of readily available modules.
- Of course, any custom functionality can easily be implemented in form of a module too (quite standard thing these days).
- The interaction with a desktop application is normally implemented via webservices rather than querying the DB directly. Drupal comes natively with a xmlrpc server and client, but you can scale up to SOAP - if you wish - via a couple of contrib modules.
Some additional thoughts:
If you choose to use Drupal, and you start from scratch, then you have to be aware you and your team will need to dedicate some time and effort to understand how Drupal works. Although - differently than Palantir - I stuck with Drupal, I agree with her/him on the fact that Drupal gets complicated complex right off the bat. This is the trade-off you have to pay in order to have a platform that - rest assured - is very flexible, extremely pluggable and rock-solid (otherwise it wouldn't have been used to redesign the whitehouse, nor Drupal would have got for the second year in a row the "best PHP CMS" award, I suppose).
The good news is: there are some excellent books out there, and I would certainly recommend "Pro Drupal Development" for an in-depth and all-around explanation of the system. Just be sure to get the 2nd edition, as the first deals with the now obsolete 5 seres. That said...
A very good thing about Drupal, at least in my opinion, is that most of the tweaks you might need to do to an existing functionality can be implemented by hooking into the original code from a custom module too. This IMO is the biggest advantage of Drupal: you never have to touch other developers' code to achieve your goals, and this means - for example - that you will be able to keep your core and contrib modules up-to-date without breaking any customisation you might have done.
Drupal is heavy. Compared to other CMS it sucks plenty of processing power and RAM from your server, and - unless you are going to have a very small site - I recommend to deploy it in conjunction with nginx, rather than Apache.
Drupal scales well, thanks to a good mechanism of caching and "throttling up" mechanisms. Strange as it might sound, Drupal scales very well on large traffic websites, so that big increases in traffic do not necessarily imply big increases in resource usage.
The user experience out-of-the-box on a Drupal site is quite poor. There is a massive work being done on this at the moment (here and here (video)), but improvements won't be available until D7 is released [soon, but then you will have to wait for the modules to be ported], so it is advisable to allocate some time to create an administrative theme, if the admins of your website won't be of the technical type.
At the end of the day, my advice is: if your site is going to go big / complex / with complicated business logic and lots of functionality, then Drupal is probably a good candidate. If your site is contrarily a small-scale one with standard functionality plus a few custom bits, maybe Wordpress / Joomla could fit your needs better [not because they are 'less powerful' but because Drupal strengths would be unused in this case, while Wordpress/Joomla simpler architecture would probably represent an advantage in this scenario]
Other options would certainly be frameworks like CakePHP or Django, for example, but that - IMO - is a totally different approach to the matter, I would say.
Short answer: Drupal is well suited to build something like that, especially if you are willing to integrate your app/logic into Drupal as a suite of custom modules. The other way, integrating Drupal into an external application, can also be done, but will give you more friction, as Drupals architecture is pretty much geared towards being a framework in its own right.
Longer answer: I have a pretty much opposite opinion/experience compared to Palantirs. I've been working almost exclusively with Drupal for a year now, in the context of two fairly complex/'enterprisy' projects (after several years of 'on the side' usage for smaller things). While I agree that it imposes some rigid rules (but not limits!), I consider this to be an advantage, as those rules give a clear guidance and provide proven ways on how to do things. The three parts Palantir mentions are good examples for this:
Menu system - Provides a well structured and effective dispatching mechanism that is easy to extend with your own stuff, while giving huge flexibility to tweak/manipulate existing/default paths. (Note that 'menu system' in Drupal denotes the whole topic of managing your URL space, not just the subset of 'visible' menus that is usually associated with the term)
Forms API - A declarative approach to web forms, with a well designed processing workflow and a whole lot of built in security features that you would otherwise have to take care of yourself. Also highly extensible, with straight options to adjust/extend already existing forms on demand, add new validation rules to any field or whole forms, multi step forms, javascript based form adjustments, etc.
Translation system - This is pretty complex, simply because internationalization is fricking hard to do. But it is built in, again giving clear guidance on how to do things in order to work in a generic way (though there are problems with quite some contributed modules that are not using/supporting it the way they should).
I could give more examples for parts where I appreciate the 'rules', but this post is getting long already, and I still have to cover some downsides ;)
So to sum up the positive part - if I where given the rough specs you posted, I'd say 'no problem' and go with Drupal, being confident that it would be a solid foundation for the custom parts, while providing all the 'standards' like forum, blogs, twitter/facebook integration and many, many others in the form of already existing solutions (even though those might need some adaption/tweaking).
Downsides: As always, there are flaws, and some of them are substantial, depending on requirements/circumstances.
Learning curve - Drupal is quite complex, and 'grokking' its concepts takes time. 'Playing with it for a week', as Palantir suggests, will certainly give you a general feeling/broad impression, but it is in no way enough to allow for a serious judgement of its pros and cons, as those will only surface while coding in/for it. So if you are already deeply familiar with an established web development framework, this might be an issue. If you have to learn one anyways, this should be less of a problem.
Database restrictions - As of Drupal 6, database support is MySQL or PostgreSQL only, using a Drupal specific 'abstraction layer' (which obviously isn't one ;)
Drupal 7 will move to PDO, which should (finally) end this questionable state.
Test/Stage/Production migrations - Parts of Drupals 'out of the box' flexibility are due to many things being configurable in the administrative backend, which implies that many important configuration settings are stored in the database. This makes migration of data and/or configuration between several instances pretty difficult/tedious, once you left the (early) stages of development where you can get away with complete dump/restore operations (see e.g. this question & answers)
These are the main ones for me, but you'll probably find more :)
I worked for over a year using drupal extensively, but I ended up abandoning it. Drupal, and other CMS systems out there, have very rigid limits and rules. I'd use Drupal for projects where you have simple requirements and few or no business rules. Drupal gets complicated almost immediately when you want to do complex things (especially pay attention at the menu system, forms, and the translation system if you need to be multilingual).
If your system will really be large, with all the things you mentioned, then I'd rather use a PHP framework to implement your business logic, and integrate external products as they fit (a forum, a blog, a twitter client, etc...).
But the advice is: don't trust anyone :) Download it, and play with it for a week. You'll be able to make your mind and be more confident about your choice!
As Drupal is open source, you can pretty much do as you wish with it. A couple of points though:
Changing Drupal's user/role structure would be tedious and unnecessary. You would need to have your desktop application authenticate from Drupal's MySQL database.
Drupal has hundreds of plugins for just about everything, so Drupal could no doubt run the whole "web" side of things including visitor stats etc. You would just need, again, to connect your desktop application to the correct MySQL tables and show the data as desired.
Don't forget to check other content management systems such as Joomla! (and many others). Each has its pros and cons. www.opensourcecms.com allows you to easily test CMSs and I've used it extensively in the past.
Just be sure to map out all the components first. Every hour planning up front saves many hours of headaches later.

Resources