Coder Social home page Coder Social logo

austinmoore / acts_as_cms Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 240 KB

Prototype for adding cms functionality to a rails app. The cms content, however, is saved to git instead of to a db.

Home Page: www.namics.com

JavaScript 0.75% Ruby 99.25%

acts_as_cms's Introduction

acts_as_cms is a prototype for exploring the following question:

1. Why do all content management systems (cms) save their content in a database?  Why not save the content in source control?

I reiterate, this code is only a prototype.  It is not, nor ever will be production code.

Read on for more information about this project and the question above.


== Saving cms content in source control (i.e. git) ==

Ask yourself the following question: In a web project, who are the content creators?  In other words, who is
responsible for creating the different pages on a website?

Three different groups of content creators come to mind:
1. Software developers (e.g. mycoolpage.html.erb)
2. CMS Authors (e.g. contact.html designed by the marketing department and created in the cms)
3. Users (e.g. my cool blog entry)


Where is their created content saved?

Software developers -> source control (e.g. git)
CMS Authors -> cms database (e.g. day cq)
Users -> application database (e.g. mysql)


Why?

O.k., user data being saved in a database makes sense.  That I don't want to dispute.  That developers save their
css, javascript, rb, etc. files in the source control also makes complete sense.  Consider the chaos we would have
if each developer had their own oracle database on their machine and they saved their work as blobs in the database.
In order to get another developers work, you'd have to export their database and import it into yours.  Merging,
for example, would be absolute hell.

...

Wait a second.  If saving developer's work in a database is such a bad idea, why do we do just that for author's work?

Is an author more like a developer or more like a user?


I would argue that an author is more like a developer:

1. Given a website, xyz.com, can a visitor to that website tell whether the content comes from an author or a
developer? No.  It is possible to tell user generated content apart though.

2. Ideally, when the website is made live, the content from authors and developers is set. The users content is the
only thing that changes.


"Yeah, but what about a newspaper's website" you say.  They have authors (i.e. journalists who write articles) and
users (i.e. visitors to the site that comment on the articles).  The content from the journalists and from the users
changes daily.  The content provided by the software developer changes at a much slower pace (monthly at the most).
Would we want to redeploy the website for every article the journalist writes?  No.  Don't we want to be able to
search for old articles? Yes.

Ok. Ok.  I admit, there are cases when a traditional cms backed by a traditional database is the best solution.
However, by the same token, I argue that their are other cases in which a traditional cms with a database is not the
best solution.


Take the following case.  We have a small website which consists mainly of a few applications (e.g. dynamic content).
There are a few exceptions though.  There is an 'about', 'contact' and a few other pages (e.g. static content).
Typically, the few static pages wouldn't warrant the use of a full blown cms.  The developers would simply program
those pages too. Whenever the website owner's address changes, he'd call up the developer and ask him to update it.
The developer would make the change and redeploy the site.  The website owner is constantly on the move, so his address
needs to be updated quite often.  Eventually the developer implements a micro cms for the website.  The owner can
now change his own address and all of the other static pages.  The pages are saved in the application's database.

Let's take a look at this scenario closer...

What if there are two developers working on the project?  Don't they see two different versions of the static content,
even if their code is both up to date?

What happens when a new developer joins the team?  He won't have any static content.  What will the site look like for
him?

What happens when a developer clicks on the link to a static page that doesn't exist in his local database?

Shouldn't the website look the same for the developers as it does for the users?


Ok. Lets wrap things up here.  I think there are certain scenarios where a website just barely needs a cms, but the
content from that cms is more closely related to source code than user generated content.  For said scenarios, saving
the author's content in source control might make more sense than saving it in a database.


== Next steps ==

1. Use the prototype to answer the following questions:

* In which projects, if any, does such system (author content in soure control) make sense?

* Should the content be saved to the file system or directly to the source control?

* If the content is saved to the file system, when should it be pushed to the central source control server?

* Or should content only be pulled from the author systems and merged on a developer machine before being pushed to
 the central source control server?


2. Take an existing micro cms (e.g. comatose, sandstone) and modify it such that the content is saved like in this
prototype.


3. Try out the modified micro cms on a real project and evaluate it in the real world.


== Getting started ==

1. Download the source code from git (https://github.com/austinmoore/acts_as_cms/tree/master)
2. cd acts_as_cms
3. cp ./config/database.yml.example ./config/database.yml
4. Go wild. :)


== Plugins used ==

ActiveRecordBaseWithoutTable
ryanb/nifty-generators

acts_as_cms's People

Contributors

austinmoore avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.