Ticket #614: chapter3-first-sections.patch

File chapter3-first-sections.patch, 9.6 KB (added by me@…, 13 months ago)

first two sections of chapter 3 in the official guide (manual.xml)

  • docs/docbook/manual.xml

     
    781781    <section id="system-architecture"> 
    782782      <title>System Architecture</title> 
    783783 
    784       <para></para> 
     784      <para>Agavi is an OOP application framework. All Agavi 
     785      applications, at least where they communicate with Agavi, 
     786      consist of classes and configuration. Configuration is the glue 
     787      between different components of your application. Much of what 
     788      would be expressed as code in other cases is expressed as 
     789      configuration in Agavi.</para> 
     790 
     791      <para>To achieve such kind of flexibility, Agavi provides and 
     792      uses an XML-to-PHP compiler which serves as the configuration 
     793      engine for the framework and its applications. The configuration 
     794      engine is smart about XML files and reads them only when needed, 
     795      most of the time relying on the compiled PHP code instead. Note 
     796      that despite being quite an advanced feat for a PHP application, 
     797      this engine is in principle replaceable.</para> 
     798 
     799      <para>Before further discussion ensues, it must be made clear 
     800      that when this manual makes reference to Agavi and Agavi 
     801      applications, it does so relating to the stock Agavi framework 
     802      configuration. Many Agavi components can be replaced, and some 
     803      are replaced often by application developers wishing to 
     804      implement unique features specific to their particular 
     805      project. Stock Agavi is an MVC Web application framework, but it 
     806      can be reconfigured for applications that transcend both MVC and 
     807      Web. The manual does not make attempts at guessing towards the 
     808      extent of these use cases and refers specifically to your usual, 
     809      as-from-the-box framework and Web applications.</para> 
     810 
     811      <para>Agavi encompasses your application and serves as the 
     812      dispatcher and the front controller for it. The core logic of 
     813      your application (domain logic) is expressed as a freeform API 
     814      through Models, which are invoked by your Actions (Controllers) 
     815      and Views. When a Web request arrives, Agavi selects and 
     816      executes Actions relevant for that request; every Action names a 
     817      View that should be responsible for its output; the resulting 
     818      output is collected and returned to the client. Some Actions can 
     819      be empty and only their View counterparts would be 
     820      processed.</para> 
     821 
     822      <para>Actions are determined through Routing, which is an 
     823      extremely powerful mechanism for mapping Web requests (and any 
     824      kind of requests in general) to Actions. One request may require 
     825      more than one Action to execute and render its output. For this 
     826      reason, a general response layout management mechanism and a 
     827      layered output mechanism is provided to your application.</para> 
     828 
     829      <para>Note that unlike most of other frameworks, especially 
     830      Rails and it's sprout-offs, <emphasis>Agavi makes a clear 
     831      distinction between views and templating, and between models and 
     832      database</emphasis>. In Agavi, the templating mechanism is 
     833      abstracted away through adapters to the point a single 
     834      application can successfully use different templating engines 
     835      simultaneosly - even on the same page. You can connect any 
     836      template library - or any template source - as one of the 
     837      rendering mechanisms used in your Agavi application. Same goes 
     838      for models: an Agavi Model is just an empty class. Agavi does 
     839      not have its own database library, instead providing a global 
     840      database connection service to your application, including an 
     841      unified configuration mechanism and adapter classes for 
     842      different fashions of talking to databases. You can use your 
     843      custom database library or grab a third party one. Doctrine and 
     844      Propel are especially nice when working hand-in-hand with Agavi 
     845      mentality. The point is, you have the choice, and Agavi Models  
     846      in no way imply "database".</para> 
     847 
     848      <para>Agavi is environment and execution path. As an 
     849      environment, it provides configuration and a way to communicate 
     850      with the outside world. As an execution path, it provides a 
     851      predictable flow of events, facilitated through it's front-end 
     852      routing/dispatching facilities. These are assured through 
     853      Filters, which are plugins that are executed by 
     854      FilterChains. Filters are actually responsible for most of 
     855      Agavi's internal logic. As everything else in Agavi, they are 
     856      replaceable.</para> 
     857 
     858      <para>Additionally, Agavi has support facilities: security and 
     859      validation, handling of multiple request and response types, a 
     860      Form Population Filter (an unique Agavi feature), 
     861      internationalization and localization features, logging, ways to 
     862      express your application as a Web API to the rest of the world, 
     863      facilities to hook up third party libraries, session management 
     864      and persistent storage, caching and a bunch of other 
     865      helpful tools that make your life so much easier.</para> 
    785866    </section> 
    786867 
    787868    <section id="elements-of-an-application"> 
    788869      <title>Elements of an Application</title> 
    789870 
    790       <para>modules</para> 
     871      <para>Agavi applications are organized into Modules. Modules 
     872      group application code. A module is contained in a directory 
     873      that stores configuration, Action and View code, as well as 
     874      templates and other module-specific stuff. All Agavi application 
     875      objects - Actions, Views, Models and such - can be addressed in 
     876      terms of a Module name and the target object's name and 
     877      type. Modules are generated by Agavi's build system</para> 
    791878 
    792       <para>actions</para> 
     879      <para>Actions are your application's high level user interaction 
     880      logic. An Action is a specifically named class that is loaded 
     881      and instantiated from a specifically named file. It contains 
     882      callback methods that are invoked during different stages of an 
     883      Action's lifetime and under different condition. Actions map to 
     884      the request types: in terms of HTTP in a Web application, an 
     885      Action can specify methods to behave differently under a GET and 
     886      a POST request. Actions also specify the runtime parameters, 
     887      such as security credentials. When an Action is finished 
     888      executing, it typically selects a corresponding View to do 
     889      whatever is necessary to produce the final output.</para> 
    793890 
    794       <para>views and templates</para> 
     891      <para>Views are your application's high level user presentation 
     892      logic. A View is a class that uses the naming conventions and 
     893      callback methods similar to those of Actions. Views correspond 
     894      to Actions; and an Action can have many Views. While Actions map 
     895      to request types, Views map to output types: a single View can 
     896      produce its output as HTML, JSON, CSV, RSS feeds and PDF files, 
     897      for example. An Action selects a View that should produce the 
     898      output; Agavi asks the View for output of the appropriate 
     899      type. The output type is determined in the layout mechanism, 
     900      through configuration and routing. For HTML, a View employs 
     901      Renderers to do its bidding and apply Action-specific 
     902      information to templates.</para> 
    795903 
    796       <para>models and global models</para> 
     904      <para>Models are where your application actually takes 
     905      place. Actions and Views are just user interface glue that maps 
     906      UI requests to actual things that happen inside your 
     907      application. Agavi Models are completely unrelated to database; 
     908      thus, in an Agavi application, you may have two different kinds 
     909      of models: the Agavi Models, which are wrappers around your 
     910      domain logic, and the application's models, which may or may not 
     911      be additional levels of indirection, with or without ORM or any 
     912      other persistence, and with or without any database access at 
     913      all. Agavi deals exclusively with its own high level Models. The 
     914      difference is easy to illustrate on an imaginary reporting 
     915      application that needs to render reports into PDFs and email 
     916      them to users: one Model would be dealing with creating a 
     917      Report, one would know how to convert it to PDF, and the final 
     918      one would know how to email people. Actions and Views would glue 
     919      the whole thing together.</para> 
    797920 
    798       <para>config files</para> 
     921      <para>The central place of your application is the configuration 
     922      files. The configuration files let Agavi know what goes where in 
     923      your applications. Most of things in Agavi are configurable: for 
     924      instance, your configuration defines whether the application is 
     925      active or not, is in debug mode or not, what to do when a 
     926      security problem occurs, how to arrange your log files, how to 
     927      perform localization, translation, validation of actions and 
     928      many other aspects of your applications. Agavi solves most of 
     929      the typical Web application problems for you, and all you need 
     930      to do is to describe the solution. The XML configuration files 
     931      are not actually examined on every request: they are compiled 
     932      into PHP code and stored in the cache. The configuration engine, 
     933      together with Agavi's autoloading and factory mechanisms, 
     934      provides a generic way to spawn objects and glue them together.</para> 
    799935    </section> 
    800936 
    801937    <section id="environments-and-contexts"> 
     
    47324868      </section> 
    47334869    </section> 
    47344870  </chapter> 
    4735 </book> 
    4736  No newline at end of file 
     4871</book>