Version Control
Contents
Ruby on Rails
1. Ruby – The Language
2. Rails – The Framework
3. Convention over Configuration
4. Don’t Repeat Yourself
5. Scaffolding
6. Agile Methodology
7. Active Record Pattern
8. Model View Controller
Version Control
1. Version Control
2. Version Control Systems
3. Centralized Version Control Development
4. Centralized Version Control Data Store
5. Distributed Version Control
6. Distributed Version Control Development
7. Distributed Version Control Data Store
8. Centralized vs Distributed
December 20, 2015 © Yash Mittal 2
Ruby – The Language
Ruby
• Dynamic, reflective Object Oriented, general
purpose programming language
• Designed and developed by Yukhiro “Matz”
Matsumoto in Japan
• Influenced by Perl, Smalltalk, Eiffel, Ada and Lisp
• Supported programming paradigms:
→ Functional
→ Dynamic Type system
→ Auto Memory Management
• Type : Cross-platform
• Extension : .rb, .rbw, .erb
• License : Open Source, MIT License
• Earliest Version : 0.95 in 1995
• Latest Version : 2.1.5 in 2014
IRB – Interactive Ruby Shell
• An interactive language shell for
programming in Ruby
• Launched from the Command Line
• Has the extension .irb
• Includes command history, line
editing capabilities, and job control
December 20, 2015 © Yash Mittal 3
Rails – The Framework
Ruby on Rails
• Open source web application framework, written in
Ruby
• Designed to support development of dynamic websites,
web applications, web services and web resources.
• Aim: Alleviate overhead associated with common
activities performed
• Author : David Heinemier Hansson
• Type : Cross-platform
• License : Expat License (Open Source)
• Initial Release : 1.0 in 2005
• Latest Release : 4.1 in 2014
• Rails is installed via RubyGems – a package manager for
Ruby, providing a standard format to distribute Ruby
programs and libraries
• Provisions in Rails
→ Libraries for Database access
→ Templating frameworks
→ Session Management
→ Code reuse
• Paradigms used:
→ Convention over Configuration
→ Agile Programming
→ Don’t Repeat Yourself
→ Active Record Pattern
• Architecture: Model-View-Controller
December 20, 2015 © Yash Mittal 4
Convention over Configuration
- Software design paradigm, also called Coding by
Convention
- Aim: Decrease number of decisions to be made by
developers
- Gain flexibility, but DO NOT lose flexibility
- Developer only needs to specify unconventional aspects
of the application
- Ex: A class ‘Sale’ in the model corresponds to a table
‘Sale’ in the database by default.
- If one deviates and calls the table ‘Revenue’, then code
needs to be written
- When convention implemented by tool matches the
desired behaviour, it behaves as expected without
having to write configuration files.
- Developer needs to configure explicitly only in case of
deviation from implemented convention
December 20, 2015 © Yash Mittal 5
Don’t Repeat Yourself
• Aim: Reduce repetition of information of all kinds
• Useful in multi-tier architectures
• Principle: Every piece of knowledge must have a
single, unambiguous, authoritative representation
within a system
• Formulated by Andy Hunt and Dave Thomas
• Includes Database schemas, Test plans, Build system
and Documentation
• When applied successfully, modification of a single
element does NOT require a change in other logically
unrelated elements
• Logically related elements change predictably and
uniformly, and are thus kept in sync.
• Tools used for DRY
→ Methods and subroutines
→ Code generators
→ Automatic build systems -
Rake
→ Scripting Languages
December 20, 2015 © Yash Mittal 6
Scaffolding
• Technique supported by Model View Controller frameworks
• Programmer can specify how the application database may be used
• Framework uses this specification, together with pre-defined code templates, to
generate the final code
• Used to perform CRUD operations – Create, Read, Update and Delete on Database
entries
• Templates are treated as a scaffold, on top of which more powerful apps can be built
Scaffolding in Ruby on Rails
• scaffold: model_name is added to a controller to automatically generate appropriate
data interfaces at run time
• Since the API is generated on the fly, the programmer cannot easily modify the
interfaces this way
• Scaffold is often used for prototyping applications
• External command: rails generate scaffold model_name
• As of Rails 2.0, dynamic scaffolding is no longer stored
December 20, 2015 © Yash Mittal 7
Agile Methodology
• Agile Software Development is a group of
software development methods based
on iterative and incremental
development.
• Requirements and solutions evolve
through collaboration between self-
organizing, cross-functional teams.
• Promotes adaptive planning,
evolutionary development & delivery,
and a time-boxed iterative approach.
• Encourages rapid & flexible response to
change.
• It is a conceptual framework that
promotes tight interaction with the
customer throughout the development
cycle.
December 20, 2015 © Yash Mittal 8
Active Record Pattern
• An architectural pattern found in software engineering
• Stores in-memory object data in Relational Databases
• Interface of an object of such functions would include Insert, Update & Delete
• A table or view is wrapped into a class  Object instance is tied to a single row
• Wrapper class implements accessor methods or properties for each column in view
• Commonly used by object persistence tools, and in Object-Relational Mapping (ORM)
December 20, 2015 © Yash Mittal 9
Model View Controller
• Software architectural pattern for implementing User Interfaces
• Divides a given software application into 3 interconnected parts
• Aim: Separate internal representations of information from the
ways that information is presented to or accepted from the user.
Components
• Model – Central component of MVC, captures the behaviour of
the application in terms of its problem domain, independent of
the UI.
• Directly manages the Data, Logic and Rules of the application
• View – Can be any output representation of information, such as
a chart or a diagram. Multiple views of the same information are
possible.
• Controller – Accepts input and converts it to commands for the
model or view.
December 20, 2015 © Yash Mittal 10
MVC Interactions
• Controller (Operations - When)
→ Sends commands to the model to update the model’s state (ex: Editing doc)
→ Can also send commands to view to change its presentation method (ex: list vs grid)
• Model (State, Data - What)
→ Notifies its associated views and controllers of a change in state
→ Allows the views to produce updated output, and controllers to change available
commands. In some cases, implementation is passive.
• View (UI - How)
→ Requests information from the model to generate an output representation to the
user
The Future – MOVE
• Models, Operations, Views and Events
• Created to reduce code being stuffed into Controllers
• Controllers are broken into Operations and Events/Sessions
December 20, 2015 © Yash Mittal 11
December 20, 2015 © Yash Mittal 12
Version Control
• Also known as Revision Control and Source Control
• Important aspect of Software Configuration
Management
• Defined as the Management of changes to
documents, computer programs, large web sites,
and other collections of information.
• Changes are usually identified by a code, termed
“revision number” or “revision level”
• Each revision is associated with a timestamp and the
person making the change, the author.
• Revisions can be compared, stored, and in some
systems, merged.
December 20, 2015 © Yash Mittal 13
Version Control Systems
• Most commonly run as stand alone
applications
• Software such as Word Processors and
Spreadsheets employ embedded version
control. Ex: Google Docs and Sheet, Office
Online, Apple Pages & Keynote
• Content Management Systems such as
Wikipedia’s Page History and Wordpress
also use embedded revision control
• Revision control allows for the ability to
revert a document to a previous version
• Helps defend against vandalism and
spamming, keeping information secure
December 20, 2015 © Yash Mittal 14
Centralized Version Control Development
• Revision control systems
are often Centralized,
with a single
authoritative data store,
the Repository.
• Check-outs and check-
ins are done with
reference to this central
repository.
• Ex: Apache Subversion
December 20, 2015 © Yash Mittal 15
Centralized Version Control Data Store
Differences are stored as it is where they take place and when they take place
December 20, 2015 © Yash Mittal 16
Distributed Version Control
• Also called Decentralized Version Control
• Peer-to-peer approach
• Allows software developers to work on a
given project without requiring them to
share a common network. Software
revisions are stored in a Distributed
Revision Control System.
• No single repository is authoritative
• Data can be checked out and checked
into any repository
• When checking into a different
repository, this is interpreted as a merge
or patch
• Ex: Git
December 20, 2015 © Yash Mittal 17
Distributed Version Control Development
A developer can pull/push to any repo and all are synced together simultaneously
December 20, 2015 © Yash Mittal 18
Distributed Version Control Data Store
December 20, 2015 © Yash Mittal 19
Centralized vs Distributed
December 20, 2015 © Yash Mittal 20
Thank You
Yash Mittal
December 20, 2015 © Yash Mittal 21

Ruby on Rails & Version Control

  • 1.
  • 2.
    Contents Ruby on Rails 1.Ruby – The Language 2. Rails – The Framework 3. Convention over Configuration 4. Don’t Repeat Yourself 5. Scaffolding 6. Agile Methodology 7. Active Record Pattern 8. Model View Controller Version Control 1. Version Control 2. Version Control Systems 3. Centralized Version Control Development 4. Centralized Version Control Data Store 5. Distributed Version Control 6. Distributed Version Control Development 7. Distributed Version Control Data Store 8. Centralized vs Distributed December 20, 2015 © Yash Mittal 2
  • 3.
    Ruby – TheLanguage Ruby • Dynamic, reflective Object Oriented, general purpose programming language • Designed and developed by Yukhiro “Matz” Matsumoto in Japan • Influenced by Perl, Smalltalk, Eiffel, Ada and Lisp • Supported programming paradigms: → Functional → Dynamic Type system → Auto Memory Management • Type : Cross-platform • Extension : .rb, .rbw, .erb • License : Open Source, MIT License • Earliest Version : 0.95 in 1995 • Latest Version : 2.1.5 in 2014 IRB – Interactive Ruby Shell • An interactive language shell for programming in Ruby • Launched from the Command Line • Has the extension .irb • Includes command history, line editing capabilities, and job control December 20, 2015 © Yash Mittal 3
  • 4.
    Rails – TheFramework Ruby on Rails • Open source web application framework, written in Ruby • Designed to support development of dynamic websites, web applications, web services and web resources. • Aim: Alleviate overhead associated with common activities performed • Author : David Heinemier Hansson • Type : Cross-platform • License : Expat License (Open Source) • Initial Release : 1.0 in 2005 • Latest Release : 4.1 in 2014 • Rails is installed via RubyGems – a package manager for Ruby, providing a standard format to distribute Ruby programs and libraries • Provisions in Rails → Libraries for Database access → Templating frameworks → Session Management → Code reuse • Paradigms used: → Convention over Configuration → Agile Programming → Don’t Repeat Yourself → Active Record Pattern • Architecture: Model-View-Controller December 20, 2015 © Yash Mittal 4
  • 5.
    Convention over Configuration -Software design paradigm, also called Coding by Convention - Aim: Decrease number of decisions to be made by developers - Gain flexibility, but DO NOT lose flexibility - Developer only needs to specify unconventional aspects of the application - Ex: A class ‘Sale’ in the model corresponds to a table ‘Sale’ in the database by default. - If one deviates and calls the table ‘Revenue’, then code needs to be written - When convention implemented by tool matches the desired behaviour, it behaves as expected without having to write configuration files. - Developer needs to configure explicitly only in case of deviation from implemented convention December 20, 2015 © Yash Mittal 5
  • 6.
    Don’t Repeat Yourself •Aim: Reduce repetition of information of all kinds • Useful in multi-tier architectures • Principle: Every piece of knowledge must have a single, unambiguous, authoritative representation within a system • Formulated by Andy Hunt and Dave Thomas • Includes Database schemas, Test plans, Build system and Documentation • When applied successfully, modification of a single element does NOT require a change in other logically unrelated elements • Logically related elements change predictably and uniformly, and are thus kept in sync. • Tools used for DRY → Methods and subroutines → Code generators → Automatic build systems - Rake → Scripting Languages December 20, 2015 © Yash Mittal 6
  • 7.
    Scaffolding • Technique supportedby Model View Controller frameworks • Programmer can specify how the application database may be used • Framework uses this specification, together with pre-defined code templates, to generate the final code • Used to perform CRUD operations – Create, Read, Update and Delete on Database entries • Templates are treated as a scaffold, on top of which more powerful apps can be built Scaffolding in Ruby on Rails • scaffold: model_name is added to a controller to automatically generate appropriate data interfaces at run time • Since the API is generated on the fly, the programmer cannot easily modify the interfaces this way • Scaffold is often used for prototyping applications • External command: rails generate scaffold model_name • As of Rails 2.0, dynamic scaffolding is no longer stored December 20, 2015 © Yash Mittal 7
  • 8.
    Agile Methodology • AgileSoftware Development is a group of software development methods based on iterative and incremental development. • Requirements and solutions evolve through collaboration between self- organizing, cross-functional teams. • Promotes adaptive planning, evolutionary development & delivery, and a time-boxed iterative approach. • Encourages rapid & flexible response to change. • It is a conceptual framework that promotes tight interaction with the customer throughout the development cycle. December 20, 2015 © Yash Mittal 8
  • 9.
    Active Record Pattern •An architectural pattern found in software engineering • Stores in-memory object data in Relational Databases • Interface of an object of such functions would include Insert, Update & Delete • A table or view is wrapped into a class  Object instance is tied to a single row • Wrapper class implements accessor methods or properties for each column in view • Commonly used by object persistence tools, and in Object-Relational Mapping (ORM) December 20, 2015 © Yash Mittal 9
  • 10.
    Model View Controller •Software architectural pattern for implementing User Interfaces • Divides a given software application into 3 interconnected parts • Aim: Separate internal representations of information from the ways that information is presented to or accepted from the user. Components • Model – Central component of MVC, captures the behaviour of the application in terms of its problem domain, independent of the UI. • Directly manages the Data, Logic and Rules of the application • View – Can be any output representation of information, such as a chart or a diagram. Multiple views of the same information are possible. • Controller – Accepts input and converts it to commands for the model or view. December 20, 2015 © Yash Mittal 10
  • 11.
    MVC Interactions • Controller(Operations - When) → Sends commands to the model to update the model’s state (ex: Editing doc) → Can also send commands to view to change its presentation method (ex: list vs grid) • Model (State, Data - What) → Notifies its associated views and controllers of a change in state → Allows the views to produce updated output, and controllers to change available commands. In some cases, implementation is passive. • View (UI - How) → Requests information from the model to generate an output representation to the user The Future – MOVE • Models, Operations, Views and Events • Created to reduce code being stuffed into Controllers • Controllers are broken into Operations and Events/Sessions December 20, 2015 © Yash Mittal 11
  • 12.
    December 20, 2015© Yash Mittal 12
  • 13.
    Version Control • Alsoknown as Revision Control and Source Control • Important aspect of Software Configuration Management • Defined as the Management of changes to documents, computer programs, large web sites, and other collections of information. • Changes are usually identified by a code, termed “revision number” or “revision level” • Each revision is associated with a timestamp and the person making the change, the author. • Revisions can be compared, stored, and in some systems, merged. December 20, 2015 © Yash Mittal 13
  • 14.
    Version Control Systems •Most commonly run as stand alone applications • Software such as Word Processors and Spreadsheets employ embedded version control. Ex: Google Docs and Sheet, Office Online, Apple Pages & Keynote • Content Management Systems such as Wikipedia’s Page History and Wordpress also use embedded revision control • Revision control allows for the ability to revert a document to a previous version • Helps defend against vandalism and spamming, keeping information secure December 20, 2015 © Yash Mittal 14
  • 15.
    Centralized Version ControlDevelopment • Revision control systems are often Centralized, with a single authoritative data store, the Repository. • Check-outs and check- ins are done with reference to this central repository. • Ex: Apache Subversion December 20, 2015 © Yash Mittal 15
  • 16.
    Centralized Version ControlData Store Differences are stored as it is where they take place and when they take place December 20, 2015 © Yash Mittal 16
  • 17.
    Distributed Version Control •Also called Decentralized Version Control • Peer-to-peer approach • Allows software developers to work on a given project without requiring them to share a common network. Software revisions are stored in a Distributed Revision Control System. • No single repository is authoritative • Data can be checked out and checked into any repository • When checking into a different repository, this is interpreted as a merge or patch • Ex: Git December 20, 2015 © Yash Mittal 17
  • 18.
    Distributed Version ControlDevelopment A developer can pull/push to any repo and all are synced together simultaneously December 20, 2015 © Yash Mittal 18
  • 19.
    Distributed Version ControlData Store December 20, 2015 © Yash Mittal 19
  • 20.
    Centralized vs Distributed December20, 2015 © Yash Mittal 20
  • 21.
    Thank You Yash Mittal December20, 2015 © Yash Mittal 21