Inherited views

Valikos Ostakh
Valikos OstakhRuby developer at Ecommerce, Inc.
Inherited views
When we are using MVC
frameworks only view layer does
not correspond to the OO
principles
What frameworks give us
from the box
• view rendering
• partial rendering
• support of helper methods
Biggest disadvantage of
the view layer
• does not support unit testing
Disadvantages of helpers
• do not allow inheritance
• methods are calling without a receiver
• collision between helpers with similar methods
We can replace helpers to
decorators and improve
presentation logic
Advantages of decorators
• allow inheritance
• allow encapsulation
• friendly for unit testing
• does not mutate decorated object
• does not change the behavior of decorated object
Decorators has
advantages over helpers
But decorators are not
developed for view layer
View Components
next generation of view layer
Cells
view-model layer
Advantages of ‘cells’
• basically a small MVC stack
• own render engine
• OOP features
• separate presentation from the view logic
Benefits for application
structure
• slim controllers
• clear views
• maintainability
When do we need
such approach?
Cells applicable for
• layouts
• generic views
• complex view logic
• widgets
Simple example
Typical situation
• duplicated views for some UI
part
• each view can render specific
partials
• each partial can build specific
content
Every new case expects
change of current condition
state and file structure
Somebody should
maintain this stuff
To avoid this painful we
can use the power of
components
Defining base logic
Defining base partials
Inheriting our component
Customizing our partials
Calling our component
Inherited views
Conclusions
• separated from presentation logic
• easy maintenance
• test coverage
• isolated dependencies
–Valentyn Ostakh
Thanks!
Questions?
1 of 29

Recommended

SPA, Scalable Application & AngularJS by
SPA, Scalable Application & AngularJSSPA, Scalable Application & AngularJS
SPA, Scalable Application & AngularJSMitch Chen
11.6K views15 slides
Spa with angular by
Spa with angularSpa with angular
Spa with angularDanny Vernovsky
1K views22 slides
How to customize views & menues of OpenERP online in a sustainable way. Frede... by
How to customize views & menues of OpenERP online in a sustainable way. Frede...How to customize views & menues of OpenERP online in a sustainable way. Frede...
How to customize views & menues of OpenERP online in a sustainable way. Frede...Odoo
59.1K views19 slides
Entity Framework: To the Unit of Work Design Pattern and Beyond by
Entity Framework: To the Unit of Work Design Pattern and BeyondEntity Framework: To the Unit of Work Design Pattern and Beyond
Entity Framework: To the Unit of Work Design Pattern and BeyondSteve Westgarth
211 views34 slides
MVVM and Prism by
MVVM and PrismMVVM and Prism
MVVM and PrismBilal Ahmed
2.4K views24 slides
MVP Clean Architecture by
MVP Clean  Architecture MVP Clean  Architecture
MVP Clean Architecture Himanshu Dudhat
2.9K views18 slides

More Related Content

Similar to Inherited views

Architecting, testing and developing an mvc application by
Architecting, testing and developing an mvc applicationArchitecting, testing and developing an mvc application
Architecting, testing and developing an mvc applicationMaxime Rouiller
240 views13 slides
Sitecore mvc by
Sitecore mvcSitecore mvc
Sitecore mvcpratik satikunvar
1.5K views16 slides
Reactive Cocoa && MVVM by
Reactive Cocoa && MVVMReactive Cocoa && MVVM
Reactive Cocoa && MVVMHai Feng Kao
356 views14 slides
01 introduction to struts2 by
01 introduction to struts201 introduction to struts2
01 introduction to struts2Smita B Kumar
642 views28 slides
I gotta dependency on dependency injection by
I gotta dependency on dependency injectionI gotta dependency on dependency injection
I gotta dependency on dependency injectionmhenroid
1.9K views34 slides

Similar to Inherited views(20)

Architecting, testing and developing an mvc application by Maxime Rouiller
Architecting, testing and developing an mvc applicationArchitecting, testing and developing an mvc application
Architecting, testing and developing an mvc application
Maxime Rouiller240 views
Reactive Cocoa && MVVM by Hai Feng Kao
Reactive Cocoa && MVVMReactive Cocoa && MVVM
Reactive Cocoa && MVVM
Hai Feng Kao356 views
01 introduction to struts2 by Smita B Kumar
01 introduction to struts201 introduction to struts2
01 introduction to struts2
Smita B Kumar642 views
I gotta dependency on dependency injection by mhenroid
I gotta dependency on dependency injectionI gotta dependency on dependency injection
I gotta dependency on dependency injection
mhenroid1.9K views
Android architectural components by Muhammad Ali
Android architectural componentsAndroid architectural components
Android architectural components
Muhammad Ali48 views
Architecture Principles CodeStock by Steve Barbour
Architecture Principles CodeStock Architecture Principles CodeStock
Architecture Principles CodeStock
Steve Barbour434 views
iOS architecture patterns by allanh0526
iOS architecture patternsiOS architecture patterns
iOS architecture patterns
allanh0526510 views
Refactoring Legacy Web Forms for Test Automation by Stephen Fuqua
Refactoring Legacy Web Forms for Test AutomationRefactoring Legacy Web Forms for Test Automation
Refactoring Legacy Web Forms for Test Automation
Stephen Fuqua5.3K views
CraftCamp for Students - Introduction to AngularJS by craftworkz
CraftCamp for Students - Introduction to AngularJSCraftCamp for Students - Introduction to AngularJS
CraftCamp for Students - Introduction to AngularJS
craftworkz518 views
Max Yekaterynenko - Magento Architecture, Next Steps by Meet Magento Italy
Max Yekaterynenko - Magento Architecture, Next StepsMax Yekaterynenko - Magento Architecture, Next Steps
Max Yekaterynenko - Magento Architecture, Next Steps
Meet Magento Italy421 views
MVC Website Pattern The Controller, Task, Repository, Command Pattern by andrewjutton
MVC Website Pattern The Controller, Task, Repository, Command PatternMVC Website Pattern The Controller, Task, Repository, Command Pattern
MVC Website Pattern The Controller, Task, Repository, Command Pattern
andrewjutton1.9K views

Recently uploaded

Unlocking the Power of AI in Product Management - A Comprehensive Guide for P... by
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...NimaTorabi2
12 views17 slides
ShortStory_qlora.pptx by
ShortStory_qlora.pptxShortStory_qlora.pptx
ShortStory_qlora.pptxpranathikrishna22
5 views10 slides
nintendo_64.pptx by
nintendo_64.pptxnintendo_64.pptx
nintendo_64.pptxpaiga02016
5 views7 slides
Gen Apps on Google Cloud PaLM2 and Codey APIs in Action by
Gen Apps on Google Cloud PaLM2 and Codey APIs in ActionGen Apps on Google Cloud PaLM2 and Codey APIs in Action
Gen Apps on Google Cloud PaLM2 and Codey APIs in ActionMárton Kodok
6 views55 slides
DSD-INT 2023 European Digital Twin Ocean and Delft3D FM - Dols by
DSD-INT 2023 European Digital Twin Ocean and Delft3D FM - DolsDSD-INT 2023 European Digital Twin Ocean and Delft3D FM - Dols
DSD-INT 2023 European Digital Twin Ocean and Delft3D FM - DolsDeltares
9 views23 slides
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra... by
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra....NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra...
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra...Marc Müller
40 views62 slides

Recently uploaded(20)

Unlocking the Power of AI in Product Management - A Comprehensive Guide for P... by NimaTorabi2
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
NimaTorabi212 views
Gen Apps on Google Cloud PaLM2 and Codey APIs in Action by Márton Kodok
Gen Apps on Google Cloud PaLM2 and Codey APIs in ActionGen Apps on Google Cloud PaLM2 and Codey APIs in Action
Gen Apps on Google Cloud PaLM2 and Codey APIs in Action
Márton Kodok6 views
DSD-INT 2023 European Digital Twin Ocean and Delft3D FM - Dols by Deltares
DSD-INT 2023 European Digital Twin Ocean and Delft3D FM - DolsDSD-INT 2023 European Digital Twin Ocean and Delft3D FM - Dols
DSD-INT 2023 European Digital Twin Ocean and Delft3D FM - Dols
Deltares9 views
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra... by Marc Müller
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra....NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra...
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra...
Marc Müller40 views
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ... by Donato Onofri
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Donato Onofri860 views
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with... by sparkfabrik
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...
sparkfabrik7 views
tecnologia18.docx by nosi6702
tecnologia18.docxtecnologia18.docx
tecnologia18.docx
nosi67025 views
Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI... by Marc Müller
Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI...Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI...
Dev-Cloud Conference 2023 - Continuous Deployment Showdown: Traditionelles CI...
Marc Müller41 views
Ports-and-Adapters Architecture for Embedded HMI by Burkhard Stubert
Ports-and-Adapters Architecture for Embedded HMIPorts-and-Adapters Architecture for Embedded HMI
Ports-and-Adapters Architecture for Embedded HMI
Burkhard Stubert21 views
AI and Ml presentation .pptx by FayazAli87
AI and Ml presentation .pptxAI and Ml presentation .pptx
AI and Ml presentation .pptx
FayazAli8712 views
Navigating container technology for enhanced security by Niklas Saari by Metosin Oy
Navigating container technology for enhanced security by Niklas SaariNavigating container technology for enhanced security by Niklas Saari
Navigating container technology for enhanced security by Niklas Saari
Metosin Oy14 views
Software evolution understanding: Automatic extraction of software identifier... by Ra'Fat Al-Msie'deen
Software evolution understanding: Automatic extraction of software identifier...Software evolution understanding: Automatic extraction of software identifier...
Software evolution understanding: Automatic extraction of software identifier...

Inherited views