Post on 30-May-2018
8/9/2019 Intro Session on Ruby MVC RoR
1/24
Introducing
RubyMVC FrameworkRuby on Rails
8/9/2019 Intro Session on Ruby MVC RoR
2/24
TAG Cloud Java Ruby PHP Object oriented ActiveRecord
python Ruby on Rails Rails J2EE Hibernate
FrameworkMVC RadRails Aptana NetBeans
Struts IDE Architecture ActionPackgems
WebserverTesting plugins OpenSource Helpers webrick Methods
8/9/2019 Intro Session on Ruby MVC RoR
3/24
Do weneed???
Another Language...
Another Framework...A new design pattern...Wide range of new tools...
...
...
...
8/9/2019 Intro Session on Ruby MVC RoR
4/24
8/9/2019 Intro Session on Ruby MVC RoR
5/24
So let's dive in...
8/9/2019 Intro Session on Ruby MVC RoR
6/24
Rubyis... An interpreted language
- a.k.a dynamic, scripting
- e.g., perl Modules allow addition of behaviors to a class
Object Oriented
Single inheritance
High level - Good support for system calls, regex and CGI
Relies heavily on convention for syntax
8/9/2019 Intro Session on Ruby MVC RoR
7/24
Rubyis... All classes derived from ObjectincludingClass (like Java) butthere are no primitives (not like Java at all)
Ruby uses single-inheritance
Mixins give you the power of multiple inheritancewithout the headaches
Modules allow addition of behaviors to a class
Things like = and + that you might think are operators areactually methods (like Smalltalk)
Variables are not typed
Automatic memory allocation and garbage collection
8/9/2019 Intro Session on Ruby MVC RoR
8/24
Traditional Applications
Browser directly accesses page.
- Do not offer centralized controly - No separation of content/style
- Difficult to maintain
8/9/2019 Intro Session on Ruby MVC RoR
9/24
MV
C ApplicationsBrowser accesses a controller
- Centralizes control
- Clean separation of content/style- More involved to produce
- Easier to maintain and expand
8/9/2019 Intro Session on Ruby MVC RoR
10/24
MV
C
MVC is an Architectural Design PatternSeparates a web application into three different
modules.
Model | View | Controller
8/9/2019 Intro Session on Ruby MVC RoR
11/24
MV
C AdvantagesSeparation 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 differentparts.
8/9/2019 Intro Session on Ruby MVC RoR
12/24
RAILS &MV
C
Rails in an MVC frameworkRails is such a framework that tries to remove thecomplexity and drudgery of MVC, while stillallowing you to realize all the benefits. - DHH
(David Heinemeier Hansson)
8/9/2019 Intro Session on Ruby MVC RoR
13/24
M
odel - A
ctiveRecord
ActiveRecord is a design pattern. (Martin Fowler)
Object wraps a row in the database.
Encapsulates data access.
Contains business logic.
Handles relationships.
Handles validation.
8/9/2019 Intro Session on Ruby MVC RoR
14/24
View - ActionView
Renders the view.Both .rhtml and .rxml files.
Provides master layouts.
Uses ERb (embedded ruby) for templating and
control.
8/9/2019 Intro Session on Ruby MVC RoR
15/24
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.
8/9/2019 Intro Session on Ruby MVC RoR
16/24
Whatit looks like?
8/9/2019 Intro Session on Ruby MVC RoR
17/24
Walkthrough...
8/9/2019 Intro Session on Ruby MVC RoR
18/24
FolderStructure
8/9/2019 Intro Session on Ruby MVC RoR
19/24
RAILSin 10 points
Dont Repeat Yourself Convention Over Configuration Model View Controller Agile Development Configuring DB ActiveRecord (Built-in ORM support) CRUD operations Generators Migrations Plugins
8/9/2019 Intro Session on Ruby MVC RoR
20/24
Worth diving. Isn't it?
8/9/2019 Intro Session on Ruby MVC RoR
21/24
Who's using...
8/9/2019 Intro Session on Ruby MVC RoR
22/24
Applications...
8/9/2019 Intro Session on Ruby MVC RoR
23/24
References...
http://wiki.rubyonrails.org
http://rubyonrails.orghttp://www.workingwithrails.comhttp://www.37signals.com...
...
8/9/2019 Intro Session on Ruby MVC RoR
24/24
Thanks!Sumanth Krishna. A
www.sumanthkrishna.comtosumanthkrishna@gmail.com