|
|
|
| SWiZ5 Tips and Tricks | SWiZ5 How to Create an Application |
The SWiZ (simple visualization classes) is an open source (LGPL) PHP visualization framework.
The SWiZ is a rapid prototyping tool focusing on an effective implementation of a web application. Basically, all the aspects of the SWiZ framework are modular, thereby no code is duplicated and no work is duplicated. Furthermore, if you are lucky, your application (or at least its parts) is already written in form of prepared components or packages.
The basic principles of the SWiZ5 framework can be separated into 3 groups: (i) data flow modeling, (ii) using of components, and (iii) template parsing. The groups correspond to a MVC paradigm (models - the data flows, views - the templates and parsing, a controller - the components). In other words, you design how to obtain and save data from/into a data storage (e.g., a database table, a file, a webservice). Then, you reuse (or write) various components (e.g., data listings, forms for data editing). And finally, you reuse (or create) a template for the output ((X)HTML, XML, CSS, or others).
The SWiZ5 is "shipped" with the most frequently used components in web applications: G_List (a linear listing of data), G_Form (a form for a data manipulation), G_Tree (a hierarchical listing of data), G_Pager (pagination of various page parts - menus, sheets, and similar). The components can be extended using so-called extenders. Likewise the components, many usable extenders are in the base package of the SWiZ framework (e.g., a wizard-like form, a selection extender of data in a listing). The components are supported by data flows, objects representing a data storage entities. A prepared data storage connector using the Creole library can be used to access MySQL and PostreSQL databases. The web package contains a complete groundwork for web-based information systems, administrations and other applications based on a unified GUI. The package contains an user administration, logging of the users' activity, ACLs, and localization. Since the framework emphasizes the modularity and leverages an open source license, it embodies a progressive grow and enjoys an external support.
All the prepared parts of the SWiZ can be used by virtue of a simple principle, which is an overriding. Both files and classes can be overridden. By the file overriding, it is meant creating of a file with the same name as the overridden file in another package. By the class overriding, it is meant inheriting of a SWiZ class and implementing of its event methods. Each class in SWiZ triggers events in particular points of the processing. The events can be used to change, specify, or complete the behavior of the classes. With the help of the overriding principle, a new application can be created only with a few lines of code, since the main workload lies under the implementation in the framework, but without sacrificing the flexibility.
The SWiZ framework uses its own template syntax, but do not worry, the basic syntax is based only on 3 template tags. All else is a classical (X)HTML, CSS, or other languages. The templates with a such simple syntax have one big advantage. The code of the template cannot be messed up with the program logic, which greatly improves the readability of the resulting code.
The development of the SWiZ framework started in 2003, when we began with a pretty simple commercial web project. So we questioned us: Should we use an existing framework or write a new one from the scratch? We knew about several frameworks at that time, but no one satisfied our needs in a way we would like.
Our requirements was quite elemental: we needed two easy-to-use visual components - a listing of data and a form for manipulations with the data. So we wrote the SWiZ1 overnight. The first version was not a framework at all. It was only a couple of classes leveraging a template parser from a friend of ours (thank you, Kamil Sopko). The class parameterization and the class tree was slightly inspired by the Borland's Visual Component Library (VLC). And it surprisingly worked pretty well.
The next version added a page switching functionality and a couple of new visual elements (tree listings). It was used only for one IS project. By the contrast, the SWiZ3 is widely used by our friends till now and tens of projects was based on it. The third version works on PHP 4.3+ and follows the basic principles introduced in the first version of the SWiZ framework (override a fully featured class (e.g. a list), implement various event methods, set the parameters, and run the application)
A big problem of the SWiZ3 was an inflation of the basic visual classes by more and more features. Thereby the classes was more and more unreadable and wasteful the system resources. So we designed a completely new SWiZ4, using a bunch of loosely coupled objects and components. Every little feature was externalized into its own class. These little components was interconnected and by calling of each other methods, the output was parsed. It was a nice design, with a nice "academic" background, but the users of the SWiZ3 was extremely confused by the complexity of the system. The system was chaotic for them and they rejected it.
So we put the fourth version into our hall of fame and started to think, what should the next version of the SWiZ be like. We knew the flaws of the SWiZ3 and the SWiZ4 and we also knew the benefits. In so far that, we took the good things from both and created a brand new SWiZ5 in PHP 5.1+. Now, there are no complicated interconnections of the components and all those little features was externalized into easy-to-use objects called component extenders. Nowadays, in 2010, we have the first final version of the SWiZ5 framework, marked as SWiZ 5.0.0.
|
|
|
| SWiZ5 Tips and Tricks | SWiZ5 How to Create an Application |
Documentation generated on Mon, 19 Jul 2010 01:50:48 +0200 by phpDocumentor 1.4.3