SlideShare a Scribd company logo
1 of 76
From 1 To 30 How To Disassemble One Monster App Into An Ecosystem Of 30 Jonathan Palley, CTO/COO Guo Lei, Chief Architect © 2010 Idapted, Ltd.
An Experience
A Tale of Two Buildings
 Shanghai Lotus Riverside Community 1909 Beijing Forbidden City
1 30
What is one?
The entire web application/system/platform runs as one single rails application (We are talking about really large systems.   Multiple different types of clients/functions)
Problems Confused new staff Hard to test/extend/scale
What is 30?
A ecosystem of applications
Independent
Linked and Seamless
Basic features of each app Separate database Runs independently (complete story)  Lightweight (single developer) Tight internal cohesion and loose external coupling Advantages ,[object Object]
Developer autonomy
Technology (im)maturity safetyAPPEAL TO DEVELOPER LAZINESS
What’s the mystery of the forbidden city?
Consistent UI Shared CSS/JS/Styleguide Common Helpers in Shared Gem Safely try new things
interface All applications use the same base CSS/JS Keep all the application the same style <%=idp_include_js_css%> # => <script src ="/assets/javascripts/frame.js" type="text/javascript"></script> <link href="/assets/stylesheets/frame.css" media="screen" rel="stylesheet" type="text/css" />
interface CSS Framework
interface Abstract Common Helpers to Gem Search function for models
interface Common Helpers: Combo search (cont) View: <%= search_form_for(HistoryRecord, :interaction_id, :released,[:rating, {:collection=>assess_ratings}],[:mark_spot_num,{:range=>true}], [:created_at, {:ampm=>true}])  %> Controller: @history_records= HistoryRecord.combo_search(params)
interface Common Helpers: List table well formatted with pagination  sortable customizable
interface Common Helpers: List table (cont) <%= idp_table_for(@history_records,:sortable=>true,:customize => "history_records") do |item, col| col.add:id, link_to(item.id, admin_history_record_path(item)),:order=>:id col.build:duration, :waiting_time, :review_time col.add:scenario, item.scenario_title, :order => :scenario_title col.add:mark_spot_num   end %>
interface Development Lifecycle Implement new View code/plugin in a second application Abstract intoplugin using existing “idp” helpers Put it into main view gem
interface data
data How do applications share data? 	(remember: each app has its own data) ,[object Object]
 Services
 AJAX Loaded View Segments,[object Object]
Purchase App data Requirement: List course packages for user to select to purchase but The course package data is stored in the “course” application
Solution data readonly db connection course
Code data Model: class CoursePackage< ActiveRecord::Base acts_as_readonly:course end View: <ul> <%CoursePackage.all.eachdo |package| %> <li><%= package.title %> <%= package.price %></li> <%end %> </ul>
data Why doesn’t this break the rule of loose coupling?
data acts_as_readonly in Depth def acts_as_readonly(name, options = {}) config = CoreService.app(name).database establish_connectionconfig[Rails.env] set_table_name(self.connection.current_database + (options[:table_name]||table_name).to_s) end
data acts_as_readonly in Depth def acts_as_readonly(name, options = {}) config = CoreService.app(name).database establish_connectionconfig[Rails.env] set_table_name(self.connection.current_database + (options[:table_name]||table_name).to_s) end
data Core service classCoreService < ActiveResource::Base self.site = :user defself.app(app_name) CoreService.find(app_name) end end
data Centralized configuration How does Core know all the configurations?
data Each app posts its configuration to core when it is started
data config/site_config.yml app: course api: course_list: package/courses config/initializers/idp_initializer.rb CoreService.reset_config
data core_service.rb in idp_lib APP_CONFIG = YAML.load(Rails.root.join(“config/site_config.yml”)) defreset_config self.post(:reset_config, :app => {           :name => APP_CONFIG["app"],  :settings => APP_CONFIG,           :database => YAML.load_file( Rails.root.join("config/database.yml"))}) end
data
data Again, implemented in gem config/environment.rb config.gem ‘idp_helpers’ config.gem ‘idp_lib’
data gems
data Web services for “write” interactions class CoursePackageService< ActiveSupport::Base self.site = :course end
example data Roadmap needs to be generated after learner pays.
codes data Course: app/controllers/roadmap_services_controller.rb def  create Roadmap.generate(params[:user_id], params[:course_id]) end Purchase: app/models/roadmap_service.rb class RoadmapService < ActiveSupport::Base self.site = :course end Purchase: app/models/order.rb defactivate_roadmap RoadmapService.create(self.user_id, self.course_id) end
data AJAX Loaded Composite View <div> <%=ajax_load(url_of(:course, :course_list)) %> </div> Ecosystem url_for Fetched from different applications
interface data user
Features of User Service user Registration/login Profile management Role Based Access Control
Access Control user Each Controller is one Node * Posted to user service when app starts
Access Control user before_filter:check_access_right defcheck_access_right unlessxml_request?orinner_request? access_deniedunlesshas_page_right?(params[:controller]) end end * Design your apps so access control can be by controller!
user How to share?
Step 1: User Auth user
Step 1: User Auth user config/initializers/idp_initializer.rb ActionController::Base.session_store = :active_record_store ActiveRecord::SessionStore::Session.acts_as_remote:user, 	:readonly=> false
Step 2: Access Control user Tell core its controllers structure CoreService. reset_rights defself.reset_rights data = load_controller_structure self.post(:reset_rights, :data =>data) end
Step 2: Access Control user before_filter:check_access_right defcheck_access_right unlessxml_request?orinner_request? access_deniedunlesshas_page_right?(params[:controller]) end end
Step 2: Access Control user has_page_right? Readonly dbconn again
Step 2: Access Control user class IdpRoleRight < ActiveRecord::Base acts_as_readonly:user, :table_name=> "role_rights" end def has_page_right?(page) roles = current_user.roles roles_of_page = IdpRoleRight.all(:conditions => ["path = ?", page]).map(&:role_id) (roles - (roles - roles_of_page)).size > 0 end
user Again, gems! config/environment.rb config.gem ‘idp_helpers’ config.gem ‘idp_lib’ config.gem ‘idp_core’
interface service data user
service Support applications File Mail Comet service
File class Article < ActiveRecord::Base has_files end  Specify Class that Has Files Upload File in Background to FileService Idp_file_form Store with app_name, model_name, model_id Use readonly magic to easily display @article.files.first.url
service Comet classChatRoom < ActiveRecord::Base acts_as_realtime end  <%= realtime_for(@chat_room, current_user.login) %> <%= realtime_data(dom_id, :add, :top) %> @chat_room.realtime_channel.broadcast(“hi world", current_user.login)
service mail Mail services MailService.send(“test@idapted.com”, :welcome,  :user => “test”)
Host all in one domain Load each rails app into a subdir, we use Unicorn  unicorn_rails --path /user  unicorn_rails --path /studycenter  unicorn_rails --path /scenario
Host all in one domain use Nginx as a reverse proxylocation /user {    proxy_pass http://rails_app_user; } location /studycenter {    proxy_pass http://rails_app_studycenter; }
Host all in one domain All you see is a uniform URL   www.eqenglish.com/user   www.eqenglish.com/studycenter   www.eqenglish.com/scenario
Pair-deploy
How to split one into many?
By Story 		Each App is one group of similar features. By Data 		Each App writes to the same data
Example User Management Course package Purchase Learning process …
Iteration
Be adventurous at the beginning. Split one into as many as you think is sensitive
Then you may find Some applications interact with each other frequently. Lots of messy and low efficiency code to deal with interacting.
Merge them into one.
Measurement Critical and core task of single app should not call services of others. One doesn’t need to know much about others’ business to do one task  (or develop). Independent Stories

More Related Content

What's hot

JSP- JAVA SERVER PAGES
JSP- JAVA SERVER PAGESJSP- JAVA SERVER PAGES
JSP- JAVA SERVER PAGESYoga Raja
 
Building a Backend with Flask
Building a Backend with FlaskBuilding a Backend with Flask
Building a Backend with FlaskMake School
 
DataBase Connectivity
DataBase ConnectivityDataBase Connectivity
DataBase ConnectivityAkankshaji
 
Java Servlet
Java ServletJava Servlet
Java ServletYoga Raja
 
Spring as a Cloud Platform (Developer Summit 2011 17-C-5)
Spring as a Cloud Platform (Developer Summit 2011 17-C-5)Spring as a Cloud Platform (Developer Summit 2011 17-C-5)
Spring as a Cloud Platform (Developer Summit 2011 17-C-5)Kazuyuki Kawamura
 
Database connect
Database connectDatabase connect
Database connectYoga Raja
 
uMobile Preconference Seminar
uMobile Preconference SeminaruMobile Preconference Seminar
uMobile Preconference SeminarJennifer Bourey
 
Dh2 Apps Training Part2
Dh2   Apps Training Part2Dh2   Apps Training Part2
Dh2 Apps Training Part2jamram82
 
RubyOnRails-Cheatsheet-BlaineKendall
RubyOnRails-Cheatsheet-BlaineKendallRubyOnRails-Cheatsheet-BlaineKendall
RubyOnRails-Cheatsheet-BlaineKendalltutorialsruby
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Tuna Tore
 
CTS Conference Web 2.0 Tutorial Part 2
CTS Conference Web 2.0 Tutorial Part 2CTS Conference Web 2.0 Tutorial Part 2
CTS Conference Web 2.0 Tutorial Part 2Geoffrey Fox
 
Rich Portlet Development in uPortal
Rich Portlet Development in uPortalRich Portlet Development in uPortal
Rich Portlet Development in uPortalJennifer Bourey
 
Spring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topicsSpring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topicsGuy Nir
 
Spring (1)
Spring (1)Spring (1)
Spring (1)Aneega
 
Introduction to Google App Engine with Python
Introduction to Google App Engine with PythonIntroduction to Google App Engine with Python
Introduction to Google App Engine with PythonBrian Lyttle
 
Building Smart Workflows - Dan Diebolt
Building Smart Workflows - Dan DieboltBuilding Smart Workflows - Dan Diebolt
Building Smart Workflows - Dan DieboltQuickBase, Inc.
 

What's hot (20)

JSP- JAVA SERVER PAGES
JSP- JAVA SERVER PAGESJSP- JAVA SERVER PAGES
JSP- JAVA SERVER PAGES
 
Building a Backend with Flask
Building a Backend with FlaskBuilding a Backend with Flask
Building a Backend with Flask
 
DataBase Connectivity
DataBase ConnectivityDataBase Connectivity
DataBase Connectivity
 
Java Servlet
Java ServletJava Servlet
Java Servlet
 
Spring as a Cloud Platform (Developer Summit 2011 17-C-5)
Spring as a Cloud Platform (Developer Summit 2011 17-C-5)Spring as a Cloud Platform (Developer Summit 2011 17-C-5)
Spring as a Cloud Platform (Developer Summit 2011 17-C-5)
 
Database connect
Database connectDatabase connect
Database connect
 
Data Access with JDBC
Data Access with JDBCData Access with JDBC
Data Access with JDBC
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
Jsp
JspJsp
Jsp
 
uMobile Preconference Seminar
uMobile Preconference SeminaruMobile Preconference Seminar
uMobile Preconference Seminar
 
Dh2 Apps Training Part2
Dh2   Apps Training Part2Dh2   Apps Training Part2
Dh2 Apps Training Part2
 
RubyOnRails-Cheatsheet-BlaineKendall
RubyOnRails-Cheatsheet-BlaineKendallRubyOnRails-Cheatsheet-BlaineKendall
RubyOnRails-Cheatsheet-BlaineKendall
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5
 
CTS Conference Web 2.0 Tutorial Part 2
CTS Conference Web 2.0 Tutorial Part 2CTS Conference Web 2.0 Tutorial Part 2
CTS Conference Web 2.0 Tutorial Part 2
 
Rich Portlet Development in uPortal
Rich Portlet Development in uPortalRich Portlet Development in uPortal
Rich Portlet Development in uPortal
 
Spring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topicsSpring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topics
 
Spring (1)
Spring (1)Spring (1)
Spring (1)
 
Introduction to Google App Engine with Python
Introduction to Google App Engine with PythonIntroduction to Google App Engine with Python
Introduction to Google App Engine with Python
 
Building Smart Workflows - Dan Diebolt
Building Smart Workflows - Dan DieboltBuilding Smart Workflows - Dan Diebolt
Building Smart Workflows - Dan Diebolt
 
Spring MVC Basics
Spring MVC BasicsSpring MVC Basics
Spring MVC Basics
 

Viewers also liked

Strategic strategic capabilitiies 2003
Strategic strategic capabilitiies 2003Strategic strategic capabilitiies 2003
Strategic strategic capabilitiies 2003Sampath
 
Strategic capability - strategic human resource management
Strategic capability -  strategic human resource managementStrategic capability -  strategic human resource management
Strategic capability - strategic human resource managementmanumelwin
 
SM Exam Revision (Oct 2013)
SM Exam Revision (Oct 2013)SM Exam Revision (Oct 2013)
SM Exam Revision (Oct 2013)StratMgt Advisor
 
SM Lecture One : Introducing Strategy
SM Lecture One : Introducing StrategySM Lecture One : Introducing Strategy
SM Lecture One : Introducing StrategyStratMgt Advisor
 
SM Lecture Eight - Mergers, Acquisitions and Alliances
SM Lecture Eight - Mergers, Acquisitions and AlliancesSM Lecture Eight - Mergers, Acquisitions and Alliances
SM Lecture Eight - Mergers, Acquisitions and AlliancesStratMgt Advisor
 
SM Lecture Eleven - Leadership and Strategic Change
SM Lecture Eleven - Leadership and Strategic ChangeSM Lecture Eleven - Leadership and Strategic Change
SM Lecture Eleven - Leadership and Strategic ChangeStratMgt Advisor
 
SM Lecture Ten - Strategy Implementation, Strategy Control and Organizing
SM Lecture Ten - Strategy Implementation, Strategy Control and OrganizingSM Lecture Ten - Strategy Implementation, Strategy Control and Organizing
SM Lecture Ten - Strategy Implementation, Strategy Control and OrganizingStratMgt Advisor
 
SM Lecture Nine (B) - Strategy Development Process
SM Lecture Nine (B) - Strategy Development ProcessSM Lecture Nine (B) - Strategy Development Process
SM Lecture Nine (B) - Strategy Development ProcessStratMgt Advisor
 
SM Lecture Four : Strategic Purpose, Culture and Strategy
SM Lecture Four : Strategic Purpose, Culture and StrategySM Lecture Four : Strategic Purpose, Culture and Strategy
SM Lecture Four : Strategic Purpose, Culture and StrategyStratMgt Advisor
 
SM Lecture Seven - Strategy Evaluation
SM Lecture Seven - Strategy EvaluationSM Lecture Seven - Strategy Evaluation
SM Lecture Seven - Strategy EvaluationStratMgt Advisor
 
SM Lecture Five : Business Strategy
SM Lecture Five : Business StrategySM Lecture Five : Business Strategy
SM Lecture Five : Business StrategyStratMgt Advisor
 
SM Lecture Six : Corporate Strategy and Diversification
SM Lecture Six : Corporate Strategy and DiversificationSM Lecture Six : Corporate Strategy and Diversification
SM Lecture Six : Corporate Strategy and DiversificationStratMgt Advisor
 
SM Lecture Three : Strategic Capabilities
SM Lecture Three : Strategic CapabilitiesSM Lecture Three : Strategic Capabilities
SM Lecture Three : Strategic CapabilitiesStratMgt Advisor
 

Viewers also liked (14)

Strategic strategic capabilitiies 2003
Strategic strategic capabilitiies 2003Strategic strategic capabilitiies 2003
Strategic strategic capabilitiies 2003
 
Strategic capability - strategic human resource management
Strategic capability -  strategic human resource managementStrategic capability -  strategic human resource management
Strategic capability - strategic human resource management
 
SM Exam Revision (Oct 2013)
SM Exam Revision (Oct 2013)SM Exam Revision (Oct 2013)
SM Exam Revision (Oct 2013)
 
SM Lecture One : Introducing Strategy
SM Lecture One : Introducing StrategySM Lecture One : Introducing Strategy
SM Lecture One : Introducing Strategy
 
SM Lecture Eight - Mergers, Acquisitions and Alliances
SM Lecture Eight - Mergers, Acquisitions and AlliancesSM Lecture Eight - Mergers, Acquisitions and Alliances
SM Lecture Eight - Mergers, Acquisitions and Alliances
 
Strategic Capability
Strategic CapabilityStrategic Capability
Strategic Capability
 
SM Lecture Eleven - Leadership and Strategic Change
SM Lecture Eleven - Leadership and Strategic ChangeSM Lecture Eleven - Leadership and Strategic Change
SM Lecture Eleven - Leadership and Strategic Change
 
SM Lecture Ten - Strategy Implementation, Strategy Control and Organizing
SM Lecture Ten - Strategy Implementation, Strategy Control and OrganizingSM Lecture Ten - Strategy Implementation, Strategy Control and Organizing
SM Lecture Ten - Strategy Implementation, Strategy Control and Organizing
 
SM Lecture Nine (B) - Strategy Development Process
SM Lecture Nine (B) - Strategy Development ProcessSM Lecture Nine (B) - Strategy Development Process
SM Lecture Nine (B) - Strategy Development Process
 
SM Lecture Four : Strategic Purpose, Culture and Strategy
SM Lecture Four : Strategic Purpose, Culture and StrategySM Lecture Four : Strategic Purpose, Culture and Strategy
SM Lecture Four : Strategic Purpose, Culture and Strategy
 
SM Lecture Seven - Strategy Evaluation
SM Lecture Seven - Strategy EvaluationSM Lecture Seven - Strategy Evaluation
SM Lecture Seven - Strategy Evaluation
 
SM Lecture Five : Business Strategy
SM Lecture Five : Business StrategySM Lecture Five : Business Strategy
SM Lecture Five : Business Strategy
 
SM Lecture Six : Corporate Strategy and Diversification
SM Lecture Six : Corporate Strategy and DiversificationSM Lecture Six : Corporate Strategy and Diversification
SM Lecture Six : Corporate Strategy and Diversification
 
SM Lecture Three : Strategic Capabilities
SM Lecture Three : Strategic CapabilitiesSM Lecture Three : Strategic Capabilities
SM Lecture Three : Strategic Capabilities
 

Similar to RailsConf 2010: From 1 to 30 - How to refactor one monolithic application into an application ecosystem

Java Technology
Java TechnologyJava Technology
Java Technologyifnu bima
 
Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01Tony Frame
 
Building Large Scale PHP Web Applications with Laravel 4
Building Large Scale PHP Web Applications with Laravel 4Building Large Scale PHP Web Applications with Laravel 4
Building Large Scale PHP Web Applications with Laravel 4Darwin Biler
 
Advanced Web Development
Advanced Web DevelopmentAdvanced Web Development
Advanced Web DevelopmentRobert J. Stein
 
The Magic Of Application Lifecycle Management In Vs Public
The Magic Of Application Lifecycle Management In Vs PublicThe Magic Of Application Lifecycle Management In Vs Public
The Magic Of Application Lifecycle Management In Vs PublicDavid Solivan
 
A Complete Tour of JSF 2
A Complete Tour of JSF 2A Complete Tour of JSF 2
A Complete Tour of JSF 2Jim Driscoll
 
Exploring Symfony's Code
Exploring Symfony's CodeExploring Symfony's Code
Exploring Symfony's CodeWildan Maulana
 
The Web on OSGi: Here's How
The Web on OSGi: Here's HowThe Web on OSGi: Here's How
The Web on OSGi: Here's Howmrdon
 
Having Fun Building Web Applications (Day 1 Slides)
Having Fun Building Web Applications (Day 1 Slides)Having Fun Building Web Applications (Day 1 Slides)
Having Fun Building Web Applications (Day 1 Slides)Clarence Ngoh
 
Overview of entity framework by software outsourcing company india
Overview of entity framework by software outsourcing company indiaOverview of entity framework by software outsourcing company india
Overview of entity framework by software outsourcing company indiaJignesh Aakoliya
 
Spstc2011 managed metadata real world
Spstc2011 managed metadata real worldSpstc2011 managed metadata real world
Spstc2011 managed metadata real worldAtul Chhoda
 
Spstc2011 managed metadata real world
Spstc2011 managed metadata real worldSpstc2011 managed metadata real world
Spstc2011 managed metadata real worldAtul Chhoda
 
Having Fun Building Web Applications (Day 2 slides)
Having Fun Building Web Applications (Day 2 slides)Having Fun Building Web Applications (Day 2 slides)
Having Fun Building Web Applications (Day 2 slides)Clarence Ngoh
 
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesJBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesTikal Knowledge
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalystdwm042
 
Example Of Import Java
Example Of Import JavaExample Of Import Java
Example Of Import JavaMelody Rios
 
The 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaThe 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaDavid Chandler
 
Apache Aries Blog Sample
Apache Aries Blog SampleApache Aries Blog Sample
Apache Aries Blog SampleSkills Matter
 
"Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin "Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin Vasil Remeniuk
 

Similar to RailsConf 2010: From 1 to 30 - How to refactor one monolithic application into an application ecosystem (20)

Java Technology
Java TechnologyJava Technology
Java Technology
 
Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01Googleappengineintro 110410190620-phpapp01
Googleappengineintro 110410190620-phpapp01
 
Building Large Scale PHP Web Applications with Laravel 4
Building Large Scale PHP Web Applications with Laravel 4Building Large Scale PHP Web Applications with Laravel 4
Building Large Scale PHP Web Applications with Laravel 4
 
Advanced Web Development
Advanced Web DevelopmentAdvanced Web Development
Advanced Web Development
 
.Net template solution architecture
.Net template solution architecture.Net template solution architecture
.Net template solution architecture
 
The Magic Of Application Lifecycle Management In Vs Public
The Magic Of Application Lifecycle Management In Vs PublicThe Magic Of Application Lifecycle Management In Vs Public
The Magic Of Application Lifecycle Management In Vs Public
 
A Complete Tour of JSF 2
A Complete Tour of JSF 2A Complete Tour of JSF 2
A Complete Tour of JSF 2
 
Exploring Symfony's Code
Exploring Symfony's CodeExploring Symfony's Code
Exploring Symfony's Code
 
The Web on OSGi: Here's How
The Web on OSGi: Here's HowThe Web on OSGi: Here's How
The Web on OSGi: Here's How
 
Having Fun Building Web Applications (Day 1 Slides)
Having Fun Building Web Applications (Day 1 Slides)Having Fun Building Web Applications (Day 1 Slides)
Having Fun Building Web Applications (Day 1 Slides)
 
Overview of entity framework by software outsourcing company india
Overview of entity framework by software outsourcing company indiaOverview of entity framework by software outsourcing company india
Overview of entity framework by software outsourcing company india
 
Spstc2011 managed metadata real world
Spstc2011 managed metadata real worldSpstc2011 managed metadata real world
Spstc2011 managed metadata real world
 
Spstc2011 managed metadata real world
Spstc2011 managed metadata real worldSpstc2011 managed metadata real world
Spstc2011 managed metadata real world
 
Having Fun Building Web Applications (Day 2 slides)
Having Fun Building Web Applications (Day 2 slides)Having Fun Building Web Applications (Day 2 slides)
Having Fun Building Web Applications (Day 2 slides)
 
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesJBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalyst
 
Example Of Import Java
Example Of Import JavaExample Of Import Java
Example Of Import Java
 
The 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaThe 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for Java
 
Apache Aries Blog Sample
Apache Aries Blog SampleApache Aries Blog Sample
Apache Aries Blog Sample
 
"Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin "Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin
 

Recently uploaded

React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 

Recently uploaded (20)

React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 

RailsConf 2010: From 1 to 30 - How to refactor one monolithic application into an application ecosystem

  • 1. From 1 To 30 How To Disassemble One Monster App Into An Ecosystem Of 30 Jonathan Palley, CTO/COO Guo Lei, Chief Architect © 2010 Idapted, Ltd.
  • 3. A Tale of Two Buildings
  • 4. Shanghai Lotus Riverside Community 1909 Beijing Forbidden City
  • 7. The entire web application/system/platform runs as one single rails application (We are talking about really large systems. Multiple different types of clients/functions)
  • 8. Problems Confused new staff Hard to test/extend/scale
  • 10. A ecosystem of applications
  • 13.
  • 15. Technology (im)maturity safetyAPPEAL TO DEVELOPER LAZINESS
  • 16. What’s the mystery of the forbidden city?
  • 17. Consistent UI Shared CSS/JS/Styleguide Common Helpers in Shared Gem Safely try new things
  • 18. interface All applications use the same base CSS/JS Keep all the application the same style <%=idp_include_js_css%> # => <script src ="/assets/javascripts/frame.js" type="text/javascript"></script> <link href="/assets/stylesheets/frame.css" media="screen" rel="stylesheet" type="text/css" />
  • 20. interface Abstract Common Helpers to Gem Search function for models
  • 21. interface Common Helpers: Combo search (cont) View: <%= search_form_for(HistoryRecord, :interaction_id, :released,[:rating, {:collection=>assess_ratings}],[:mark_spot_num,{:range=>true}], [:created_at, {:ampm=>true}]) %> Controller: @history_records= HistoryRecord.combo_search(params)
  • 22. interface Common Helpers: List table well formatted with pagination sortable customizable
  • 23. interface Common Helpers: List table (cont) <%= idp_table_for(@history_records,:sortable=>true,:customize => "history_records") do |item, col| col.add:id, link_to(item.id, admin_history_record_path(item)),:order=>:id col.build:duration, :waiting_time, :review_time col.add:scenario, item.scenario_title, :order => :scenario_title col.add:mark_spot_num end %>
  • 24. interface Development Lifecycle Implement new View code/plugin in a second application Abstract intoplugin using existing “idp” helpers Put it into main view gem
  • 26.
  • 28.
  • 29. Purchase App data Requirement: List course packages for user to select to purchase but The course package data is stored in the “course” application
  • 30. Solution data readonly db connection course
  • 31. Code data Model: class CoursePackage< ActiveRecord::Base acts_as_readonly:course end View: <ul> <%CoursePackage.all.eachdo |package| %> <li><%= package.title %> <%= package.price %></li> <%end %> </ul>
  • 32. data Why doesn’t this break the rule of loose coupling?
  • 33. data acts_as_readonly in Depth def acts_as_readonly(name, options = {}) config = CoreService.app(name).database establish_connectionconfig[Rails.env] set_table_name(self.connection.current_database + (options[:table_name]||table_name).to_s) end
  • 34. data acts_as_readonly in Depth def acts_as_readonly(name, options = {}) config = CoreService.app(name).database establish_connectionconfig[Rails.env] set_table_name(self.connection.current_database + (options[:table_name]||table_name).to_s) end
  • 35. data Core service classCoreService < ActiveResource::Base self.site = :user defself.app(app_name) CoreService.find(app_name) end end
  • 36. data Centralized configuration How does Core know all the configurations?
  • 37. data Each app posts its configuration to core when it is started
  • 38. data config/site_config.yml app: course api: course_list: package/courses config/initializers/idp_initializer.rb CoreService.reset_config
  • 39. data core_service.rb in idp_lib APP_CONFIG = YAML.load(Rails.root.join(“config/site_config.yml”)) defreset_config self.post(:reset_config, :app => { :name => APP_CONFIG["app"], :settings => APP_CONFIG, :database => YAML.load_file( Rails.root.join("config/database.yml"))}) end
  • 40. data
  • 41. data Again, implemented in gem config/environment.rb config.gem ‘idp_helpers’ config.gem ‘idp_lib’
  • 43. data Web services for “write” interactions class CoursePackageService< ActiveSupport::Base self.site = :course end
  • 44. example data Roadmap needs to be generated after learner pays.
  • 45. codes data Course: app/controllers/roadmap_services_controller.rb def create Roadmap.generate(params[:user_id], params[:course_id]) end Purchase: app/models/roadmap_service.rb class RoadmapService < ActiveSupport::Base self.site = :course end Purchase: app/models/order.rb defactivate_roadmap RoadmapService.create(self.user_id, self.course_id) end
  • 46. data AJAX Loaded Composite View <div> <%=ajax_load(url_of(:course, :course_list)) %> </div> Ecosystem url_for Fetched from different applications
  • 48. Features of User Service user Registration/login Profile management Role Based Access Control
  • 49. Access Control user Each Controller is one Node * Posted to user service when app starts
  • 50. Access Control user before_filter:check_access_right defcheck_access_right unlessxml_request?orinner_request? access_deniedunlesshas_page_right?(params[:controller]) end end * Design your apps so access control can be by controller!
  • 51. user How to share?
  • 52. Step 1: User Auth user
  • 53. Step 1: User Auth user config/initializers/idp_initializer.rb ActionController::Base.session_store = :active_record_store ActiveRecord::SessionStore::Session.acts_as_remote:user, :readonly=> false
  • 54. Step 2: Access Control user Tell core its controllers structure CoreService. reset_rights defself.reset_rights data = load_controller_structure self.post(:reset_rights, :data =>data) end
  • 55. Step 2: Access Control user before_filter:check_access_right defcheck_access_right unlessxml_request?orinner_request? access_deniedunlesshas_page_right?(params[:controller]) end end
  • 56. Step 2: Access Control user has_page_right? Readonly dbconn again
  • 57. Step 2: Access Control user class IdpRoleRight < ActiveRecord::Base acts_as_readonly:user, :table_name=> "role_rights" end def has_page_right?(page) roles = current_user.roles roles_of_page = IdpRoleRight.all(:conditions => ["path = ?", page]).map(&:role_id) (roles - (roles - roles_of_page)).size > 0 end
  • 58. user Again, gems! config/environment.rb config.gem ‘idp_helpers’ config.gem ‘idp_lib’ config.gem ‘idp_core’
  • 60. service Support applications File Mail Comet service
  • 61. File class Article < ActiveRecord::Base has_files end Specify Class that Has Files Upload File in Background to FileService Idp_file_form Store with app_name, model_name, model_id Use readonly magic to easily display @article.files.first.url
  • 62. service Comet classChatRoom < ActiveRecord::Base acts_as_realtime end <%= realtime_for(@chat_room, current_user.login) %> <%= realtime_data(dom_id, :add, :top) %> @chat_room.realtime_channel.broadcast(“hi world", current_user.login)
  • 63. service mail Mail services MailService.send(“test@idapted.com”, :welcome, :user => “test”)
  • 64. Host all in one domain Load each rails app into a subdir, we use Unicorn  unicorn_rails --path /user  unicorn_rails --path /studycenter  unicorn_rails --path /scenario
  • 65. Host all in one domain use Nginx as a reverse proxylocation /user {    proxy_pass http://rails_app_user; } location /studycenter {    proxy_pass http://rails_app_studycenter; }
  • 66. Host all in one domain All you see is a uniform URL   www.eqenglish.com/user   www.eqenglish.com/studycenter   www.eqenglish.com/scenario
  • 67.
  • 69. How to split one into many?
  • 70. By Story Each App is one group of similar features. By Data Each App writes to the same data
  • 71. Example User Management Course package Purchase Learning process …
  • 73. Be adventurous at the beginning. Split one into as many as you think is sensitive
  • 74. Then you may find Some applications interact with each other frequently. Lots of messy and low efficiency code to deal with interacting.
  • 76. Measurement Critical and core task of single app should not call services of others. One doesn’t need to know much about others’ business to do one task (or develop). Independent Stories
  • 77. Pitfalls Applications need to be on the same intranet. No “right place” for certain cases.
  • 78.
  • 80. Safer
  • 83.

Editor's Notes

  1. New staff “Agile web development with rails”
  2. Make it easier to do something than not.
  3. Services are too slow.Svn:externals
  4. Use webservice. SLOW.Facebook stuff.Thrift
  5. Discovery. HUGE PAIN: Configuring each app to know about each other app.
  6. Interacting with Erlang
  7. Easy.BackupLike “one application”. But shared between many.Polymorphic Connection!MySQL constraints!
  8. Resources – Memory consumption. One app used a lot. Others not much. Memory is cheap.