Technical Concepts

The basic principles of how Cotonti is built

Эта страница еще не переведена на украинский. Отображен оригинал страницы на английском языке. Вы можете зарегистрироваться и помочь с переводом.

 

First of all we need to say that Cotonti is a successor of Seditio CMS which is in turn a successor of Land Down Under and that means that it is not just yet another new born portal system, but it is an inheritor of more than 9 years of quality work legacy. It means that as a new project it tends to follow the most important of modern web development trends but meanwhile to keep the best of oldschool traditions.

#1. Procedural Core

Sure you are going to say that it is obsolete, outdated and must die forever. You would probably like to claim the object oriented programming is the world savior and is the only paradigm to survive ever. If you really think so, you'd better take a look at some other purely object oriented framework.
But we made it a deliberate choice for three simple reasons:

  1. We keep the code very clean, straight-forward and easy to understand.

  2. This way it beats other content management systems in performance.

  3. And this way it makes a difference on a crowded CMF/CMS market which is however all the same with all those «true OOP», «real Web 2.0» and other buzzwords which make noise but no sense when it comes to real everyday work.

On the other hand, Cotonti is not so rudimentary and conservative as you might suppose. Although thecore is mostly procedural, some exact functionality and peripherals can be provided with handy classes and class libraries. So, we don't hesitate taking the best from both of these famous programming concepts.

#2. Object Oriented Components

We utilize objects in the domains where they demonstrate their best. For example, Cononti uses PDO database abstraction layer which combines expressive power of database-independent classes and performance of native PHP extensions.

Another common place where polymorphism, encapsulation and inheritance (3 basic OO principles) help a lot is Cache library. Cotonti has multiple cache layers for different optimization purposes and supports a variety of cache storages, but all of them provide a solid interface, so you don't need to care what driver it uses and how it actually works.

Our template engine also has object-oriented interface, but this is just a side note. In contrast to this I can tell you that a special Object Oriented class library is being developed in a secret laboratory by Cotonti Team. It is still built on top of standard procedural Cotonti core, but it uses some world-class object oriented techniques to provide incredible reusability of common structure and code patterns. With such a library a developer will be able to write new business and content management applications just within a few minutes.

#3. Model, View,.. Script! (MVS)

Model-View-Controller is the most popular design pattern for a web application. In most modern frameworks it consists of 3 fundamental layers of the application:

  • Model. Represents data in terms of entities, relations, records and properties. Some developers think that storing data in a database or using database abstraction layer is having a model. But a little more experienced ones know that it is code that represents structure of application data and basic abstracts for data management.

  • View. Is based on a principle that what a user sees is not all of what application does. Having a view layer means separating layout from procedures and using special procedures for layout generation. In most cases this implies use of a template engine.

  • Controller. Often meant as just the code that does all the rest, in pure MVC controller is an event handler and the entire system is event driven. Different controllers are responsible for different parts of the application, they react on events and organize execution flow.

Speaking of Cotonti, it is a bit different in every component of the pattern:

The data models are usually defined in old-good plain SQL. We don't put any restrictions on the model structure and logic and therefore give the developers of modules freedom to design the application as they think is the best. For data manipulation and querying the PDO (PHP Data Objects) layer is used.

Cotonti is special for its template engine called CoTemplate. It comes with all features of a quite popular XTemplate engine and is backwards compatible with it. It has structural blocks pushed by the controller and substitutable variables (“TPL tags”) in them. It also has the later “callbacks” feature for the variables, piping the output through processing functions. Block-based template engines have really simple and clear structure and require no programming skills, unless you want to do something special. In this case you would need to modify the controller every time you want to check something in the template. This problem is solved in CoTemplate because it supports logical control structures (IF/ELSE) and static structure blocks (BEGIN/END) at the same time. So, it combines freedom and clarity for both designers and coders. And to make sure it is not slow as you might suppose, it caches memory images of templates and does no parsing in real-time.

While most of modern frameworks encourage you to build complex controller hierarchies often including tens and hundreds of interacting classes, in Cotonti controllers are extremely straightforward. In fact they are built in spirit of pure scripting so that you can easily track the program flow without having to dig deep into class hierarchies and underlying APIs. Despite their sequence, controllers are highly extensible by the mean of hooks which are actually entry points for inclusion of other scripts called “plugins”. Modularity explanation follows.

#4. Modular Architecture

In the heart of the system there is a set of libraries and core scripts. Each library containing a group of functions or classes implementing a specific feature is called an API. The main vital API, a bootstrap script which loads the minimal CMS environment and a few scripts implementing standard behavior are called the Core. Together with the user management module and administration backend these files make the Content Management Framework.

The framework is used to build Modules. Modules are the biggest building blocks for a site. A module represents a location on site providing some unique functionality to the end-user. Modules are self-contained. They may interact with other modules but they can work entirely by their own.

Plugins are used to extend the core and modules. Plugins hook into modules or core scripts to modify their behavior. Modules and plugins together are called Extensions because they extend core functionality. Extensions give you limitless freedom in site customization and save you from lots of headaches upon updates.

#5. Internationalization

Internationalization (often shortened as i18n) is an important feature for an application to be configured for use in different natural languages. It is also a major step forward to multilingual contents. In the XXI century many sites may contain messages in different languages at the same time and that is why more and more people choose Unicode as character encoding. Cotonti supports Unicode out of the box and prefers UTF-8 as default character set.

Interface of the system is localized using concept of language files. There are several types of language files: core language files, module language files, theme language files and language files that come with every single plugin. If for some reason there is no language file available for your language, you can easily make a translation yourself or with help by a translator or the community.

Internationalization of site contents such as pages and categories is also supported. You can build purely multilingual websites with Cotonti, manage translations and switch between languages on the fly if you enable i18n extensions.

#6. Stability and Security

Seditio was one of the most secure PHP CMS in the world (regarding to bugtracks) and made stability one of its major goals. We believe it is a good tradition to follow. The coders are aware of SQL injectionscross-site scripting (XSS), cross-site request forgery (CSRF) and common PHP pitfalls and they do their best to protect your site with both passive (neat coding, bug fixes) and active (special algorithms) defense.

There is also a powerful and clear permission granting system based on Access Control Lists (ACL) and Access Modes. It is a matrix with user groups and site elements as columns. Fields and cells of the matrix contain exact permission for a group and an item.

There is also built-in anti-hammering and spam protection. But in spite of all these brilliant security systems, you should always remember that they cannot protect the site from yourself.

One of the obvious definitions for Stability is the lack of bugs. There are two ways to achieve it. The first is careful coding as we have already mentioned above. The second is known as Quality Assurance (QA). It consists of user-submitted bug reports, testing, debugging and updates.

#7. Performance and Scalability

When it comes to performance, the most important question is how many requests per minute (RPM) or requests per second (RPS) your site can handle. And in Cotonti we do our best to get high results. We avoid overhead when adding new features, use effective performance techniques such as pre-rendering and server-side cache. SQL queries and database is optimized and the code is designed to do its job well when your site gets larger and much more popular.

You can create multi-site installations if your host supports it, so that you can use the same engine to power several databases and site configurations. On the other hand, if the load gets high enough so that one server is not enough, Cotonti is easily scaled with MySQL clusters, web server clusters, load balancers and works in distributed mode without any problems.

#8. SEO Friendly

There are some very good looking websites, with lots of graphics and Flash, which have perfect look and feel but are ranked by search engines so low that it is a miracle that you have found them at all. That is why optimizing your site for search is important.

Cotonti comes with powerful URL designer tool, customizable titles, metas and a lot of useful configuration options. Cotonti tells a web spyder which pages it should not index and what links it should not follow. Sitmaps are also provided by plugins. Finally, there are great SEO opportunities with plugins: the number of them is growing and you can easily write what you want.

#9. And the list goes on

Cotonti follows the most important modern trends in web development. Below only most important of them are mentioned.

#9.1. AJAX and Syndication

AJAX stands for Asynchronous JavaScript And XML but in fact it is a happy family of similar technologies. It provides client-server communication without need to refresh the page. This way web application works faster, consumes less bandwidth and looks smother for a user sight.

Cotonti comes with the worlds most popular JavaScript library jQuery which provides excellent AJAX support on client side. On server side any Cotonti module can work in both synchronous and asynchronous mode and you can easily write AJAX parts for plugins.

By default (X)HTML output is generated. You can easily write XML template files to turn it into compact XML files suitable for AJAX handlers and robots.

Robots can grab the contents of your site also if you have the standard RSS module installed which produces RSS and Atom-compatible output for different areas of your site with respect of access permissions.

Such extensions as feed aggregators are provided by the community.

#9.2. Site Search and Tags

Most sites provide information, the faster a visitor finds the information he wants the more satisfied he is. Cotonti does its best for appropriate site contents to be available in popular search services but unfortunately external search systems such as Google or Bing cannot access some private areas of your site or update their index of your site in real time. This is why we have developed our own site search system which updates its index in time and searches directly in data that a user is allowed to see.

Life on some popular sites cannot be imagined without Tags and Cotonti brings you a flexible Tags subsystem. You can use tags in pages, forums, third-party modules and your own plugins. Let your users tag site entries and it will generate tag clouds and let people search items by tags.

#9.3. Socialization and Web Services

Cotonti is not a social network out of the box because it is a generic CMS/CMF with very basic core functionality. But you can create one if you make use of its basic features (pages, forums, private messages) together with some great plugins available on the net: blogs, friends, user walls, galleries, etc. If some brick is missing in the wall, it won't cost you much of effort to make it — this is the power of Cotonti.

Connection with other popular social networks can be established with free plugins and services as well. For example, there are plugins for interaction with Facebook, Twitter and other social networks and services.

When it comes to web services Cotonti can easily communicate with existing ones such as Single Sign-On providers, file sharing, geolocation. Or you can build modules and plugins to export web services from your Cotonti site using an interface of your choice: REST, XML-RPC, SOAP, whatever.


Коментарі відсутні
Додавання комментарів доступно лише зареєстрованим користувачам