9. MVC Applications Browser accesses a “controller” - Centralizes control - Clean separation of content/style - More involved to produce - Easier to maintain and expand
10. MVC MVC is an Architectural Design Pattern Separates a web application into three different modules. Model | View | Controller
11. MVC Advantages Separation of interests. Model centralizes business logic. View centralizes display logic. Controller centralizes application flow. Clean separation of content/style. Improved decoupling. Easier testing. Allow multiple people to work on different parts.
12. RAILS & MVC Rails in an MVC framework ”… Rails is such a framework that tries to remove the complexity and drudgery of MVC, while still allowing you to realize all the benefits.” - DHH (David Heinemeier Hansson)
13. Model - ActiveRecord ActiveRecord is a design pattern. (Martin Fowler) Object wraps a row in the database. Encapsulates data access. Contains business logic. Handles relationships. Handles validation.
14. View - ActionView Renders the view. Both .rhtml and .rxml files. Provides master layouts. Uses ERb (embedded ruby) for templating and control.
15. Controller – ActionController Controls application flow. Controls which view to use. Makes data available as instance variables @var Contains several actions/defs Controls rendering and redirection.