Whole document tree 3. The Four Universal Parts of Any SoftwareThe file set of any Application Software, graphical, server-side, commercial, open/free, monolitic etc, has allways four universal parts: 1st :: The Software on its own: the bodyThe executables, libraries, static-data files, examples, manuals and documentation, etc. Regular users must have read-only access to these files. They are changed only when the system administrator makes an upgrade in this Software. 2nd :: Configuration Files: the soulThese are files that define how the Software will run, how to use the Content, security, performance etc. Without them, the Software on its own is usually useless. Depending on your Software, specific priviledged users mey change these files, to make the Software behave as they want. It is important to provide documentation about the configuration files. 3rd :: ContentIs what receives all the user attention. Is what the user delegated to be managed by your Product. Is what makes a user throw away your product and use the competitors', if it gets damaged. Are the tables of a database system, the documents for a text editor, the images and HTML pages of a web-server, the servlets and EJBs of an Application Server, etc. 4th :: Logs, Dumps etcServer Software use to generate access logs, trace files problem determination, temporary files etc. Other types of softwares also use this files, but it is less common. It is the last class of file, but many times they are the most problem generator for a system administrator, because their volume can surpass even the content size. Due this fact, it is important for you to think in some methodology or facility for this issue, while you are in design time. 3.1. Practical ExamplesLet's see how universal is this concept analyzing some types of softwares: Table 1. Universality of 4 Parts
Pay attention that the Software on its Own contains all your product business logic, which could be useless if you hadn't a Configuration to define how to work with a data bundle, provided by the user. So, Configurations are what connects your product to the user. We can use a metaphor about a Sculptor (business logic), that needs Bronze (content) and a Theme or Inspiration (configuration) from a Mecenas (user), to produce a beautifull work (content). He make annotations in his Journal (logs) about his day-by-day activities, to report to his Mecenas (user). 3.2. The Importance of Clear Separation Between Four PartsOK, so let's be more practicall. The fact is, if we correctly use the universal parts concept, we greatly improve the quality of our Product. We'll do that simply separando, encapsulating, each one of these parts in different system directories (having only different files for each part is not sufficient). There is a standard called FHS that defines the Linux directories for each part, and we'll discuss it later in Section 4. By now let's see the value of this separation to the user:
Let's make some exercise with separation using as example a system called MySoftware, in which the business logic is in Example 1 and the configuration is in Example 2. Example 1. A Shell program refering an external configuration file Example 2. File containing only the configurations for MySoftware 3.3. One Body, Many SoulsWhen I was a system administrator for IBM e-business Hosting Services, I was facinated by Apache's flexibility leting us do things like this:
If we don't pass any parameter (like the first example), Apache loads its default, hardcoded configuration file from /etc/httpd/conf/httpd.conf. We built other configs, one for each customer, with a completelly different structure, IP address, loaded modules, content directory, passwords, domains, log strategy etc. This same concept is used by a text editor of a multiuser desktop (like Linux). When the code is loaded, it looks for a configuration file on the user's $HOME, and depending who invoked him (user A or B), it will appear differently because each user has its own personal configuration. The obvious conclusion is that the Software's body (business logic) is pure e completelly oriented by his manipulator's spirit (configuration). But the competitive advantage lays on how easy we switch from one spirit to another, like in Apache's example. It is very helthy to promote it to your user. You'll be letting him create intimity, reliability, confort with your Product. We used this approach with many different Softwares in that e-business Hosting time, and it was extremelly usefull for maintenance etc. In a version migration we had total control over where were each of its parts, and upgraded and downgraded Software with no waste of time, with obvious success. But there were some Products that refused to work this way. They had so many hardcoded parameters, that we couldn't see what divided the body from their spirit (or other parts). These Softwares were marked as bad guys and discarded/replaced as soon as possible. We concluded that the good guys Softwares were intuitivelly blessed by their developer's four parts vision. And they made our life easyer. In fact, in that time we formulated this theory, that continues to prove itself. Do you want to deploy bad guy or good guy Software? |