際際滷

際際滷Share a Scribd company logo
油
Why you can  believe me 4 years of experience
Agenda Development Design MVC Other important questions  Code optimization The most popular mistakes!
Joomla Components development
Model-View-Controller
How many times did you see this? Model View Controller User updates manipulates sees uses
An application is split by 3 departments which  collaborate with each other  to bring you the best results, but they  dont disturb each other  at the same time!
油
MVC Controller
The controller is the boss!
You should use  a controller for Getting request data; Getting model & view instances; Updating model states; Calling model action methods (e.g. delete, save, remove); Calling view methods to render a template.
You should not use  a controller for Database task; Manipulating model data; Rendering templates. model & view tasks
A Controller in Joomla
JController
display() method revealed /libraries/joomla/application/component/controller.php Gets view instance Gets model instance Injects model into view Calls views display() method
Bad approaches for using controllers in Joomla
Good approaches for using controllers in Joomla
Bad approaches for using controllers in Joomla
Good approaches for using controllers in Joomla
MVC Model
A model is a hard worker!
You should use  a model for Storing a state; Performing database tasks; Formatting data; All other data task.
You should not use  a model for Getting request data; Rendering templates. controller & view tasks
A Model in Joomla
JModel The most  unused  model methods & properties. Why? $this->_db $this->_state $this->getDBO(); $this->setState($property, $value); $this->getState($property);
Bad approaches for using models in Joomla
Good approaches for using models in Joomla
Fat Model, Skinny Controller http://blog.astrumfutura.com/archives/373-The_M_in_MVC_Why_Models_are_Misunderstood_and_Unappreciated.html
MVC View
A view is a stylist!
You should use  a view for Rendering templates; Rendering templates; Rendering templates.
You should not use  a view for Database tasks; Database tasks; Database tasks. model tasks
A view in Joomla
JView lies between a model and a template View Data Template
You should use  a Joomla view class for Getting data from models; Rearranging data (if needed); Assigning variables to templates; Rendering templates.
Dont put everything you have into a view!
Keep your view methods small!
You shouldnt use PHP in template files like this
You should use it like this
Dont use variables in view templates other than the ones you assigned to
Keep your templates clear, assign all variables in view classes!
Add CSS and JS in the view template file   in this case they can be overwritten in a Joomla template
Joomla MVC revealed
Joomla MVC default task as it is Main components file request  data calls Controller default task calls JControllers display() Model & view objects gets inserts Model into view calls JViews display() gets Model data renders Template
The best way to figure out the Joomla framework is to dig into the code!
No, seriously Just dig into the code
After digging JController methods you can find out /libraries/joomla/application/component/controller.php How  to insert other than the default model into your view class How to add another location for your model & view files How to set a default model state  and many more
Joomla MVC structures possible variants
油
油
油
Base controller approach
Base controller approach: main component file
Code Optimization
Code Optimization Write code Go! Write a bit more code Think over
A simple optimization Edit, publish, unpublish, save order, order up, order down, cancel, save, remove Base admin model Base admin controller Base admin view Helper classes Get ordering, save order, move, check out, check in,  publish,  remove The most used variables: option, document, view, controller, layout, etc. Everything that can be reused in templates
Code Documentation
Document your code http://www.phpdoc.org/ http://code.google.com/p/jsdoc-toolkit/ Every file, class, class property and method
油
Filter input, escape output! http://shiflett.org/blog/2005/feb/my-top-two-php-security-practices http://developer.joomla.org/security.html http://developer.joomla.org/security/articles-tutorials/258-preventing-sql-injections.html
Joomla Components design
We are developers, we dont do design!
!!!!! We  are  developers, we  dont do  design  !!!!
Design principles for developers Set proper CSS classes & IDs, but leave design for template designers Thats all!
Thanks for coming! http://twitter.com/onesterov http://onesterov.com http://jookungfu.org http://mindk-lab.com [email_address]
Ad

Recommended

Joomla Frameworks Kung Fu
Joomla Frameworks Kung Fu
Oleg Nesterov
How to Develop Your First Ever Joomla Template?
How to Develop Your First Ever Joomla Template?
damienwoods
JavaScript and Accessibility
JavaScript and Accessibility
Joseph Dolson
Structuring a Client-Side App
Structuring a Client-Side App
Eirik Bakke
Plugging into plugins
Plugging into plugins
Josh Harrison
Html Server Button Control VB
Html Server Button Control VB
sunmitraeducation
Html Server Image Control VB
Html Server Image Control VB
sunmitraeducation
ASP.NET MVC 3
ASP.NET MVC 3
Buu Nguyen
MVC From Beginner to Advance in Indian Style by - Indiandotnet
MVC From Beginner to Advance in Indian Style by - Indiandotnet
Indiandotnet
Spec & Test Helper
Spec & Test Helper
grosser
Introduction to Mantis
Introduction to Mantis
rashid4best
Joomla Custom Fields - the next level
Joomla Custom Fields - the next level
Hans Kuijpers
Html Server Image Control CS
Html Server Image Control CS
sunmitraeducation
Design your tests to behave - An introduction To BDD!
Design your tests to behave - An introduction To BDD!
Aparna A Gopalakrishnan
Joomla Day India 2009 Business Logic With The Mvc
Joomla Day India 2009 Business Logic With The Mvc
Amit Kumar Singh
Simple module Development in Joomla! 2.5
Simple module Development in Joomla! 2.5
Vishwash Gaur
MVC Training Part 2
MVC Training Part 2
Lee Englestone
Techgig Webinar: Joomla Introduction and Module Development June 2012
Techgig Webinar: Joomla Introduction and Module Development June 2012
Vishwash Gaur
Customizing the Django Admin
Customizing the Django Admin
Lincoln Loop
Modules and Components Introduction in Joomla! 2.5
Modules and Components Introduction in Joomla! 2.5
Vishwash Gaur
Introduction to Angular Js
Introduction to Angular Js
Professional Guru
Develop Basic joomla! MVC component for version 3
Develop Basic joomla! MVC component for version 3
Gunjan Patel
"Umbraco MVC - a journey of discovery" - Lotte Pitcher
"Umbraco MVC - a journey of discovery" - Lotte Pitcher
lottepitcher
Introduction to Angularjs
Introduction to Angularjs
Manish Shekhawat
Introduction to Angularjs : kishan kumar
Introduction to Angularjs : kishan kumar
Appfinz Technologies
Get things done with Yii - quickly build webapplications
Get things done with Yii - quickly build webapplications
Giuliano Iacobelli
BackboneJS Training - Giving Backbone to your applications
BackboneJS Training - Giving Backbone to your applications
Joseph Khan
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Rails
codeinmotion
Some ways to DRY in Rails
Some ways to DRY in Rails
Framgia Vietnam
ASP.MVC Training
ASP.MVC Training
Mahesh Sikakolli

More Related Content

What's hot (6)

MVC From Beginner to Advance in Indian Style by - Indiandotnet
MVC From Beginner to Advance in Indian Style by - Indiandotnet
Indiandotnet
Spec & Test Helper
Spec & Test Helper
grosser
Introduction to Mantis
Introduction to Mantis
rashid4best
Joomla Custom Fields - the next level
Joomla Custom Fields - the next level
Hans Kuijpers
Html Server Image Control CS
Html Server Image Control CS
sunmitraeducation
Design your tests to behave - An introduction To BDD!
Design your tests to behave - An introduction To BDD!
Aparna A Gopalakrishnan
MVC From Beginner to Advance in Indian Style by - Indiandotnet
MVC From Beginner to Advance in Indian Style by - Indiandotnet
Indiandotnet
Spec & Test Helper
Spec & Test Helper
grosser
Introduction to Mantis
Introduction to Mantis
rashid4best
Joomla Custom Fields - the next level
Joomla Custom Fields - the next level
Hans Kuijpers
Html Server Image Control CS
Html Server Image Control CS
sunmitraeducation
Design your tests to behave - An introduction To BDD!
Design your tests to behave - An introduction To BDD!
Aparna A Gopalakrishnan

Similar to Joomla Extensions Kung Fu (20)

Joomla Day India 2009 Business Logic With The Mvc
Joomla Day India 2009 Business Logic With The Mvc
Amit Kumar Singh
Simple module Development in Joomla! 2.5
Simple module Development in Joomla! 2.5
Vishwash Gaur
MVC Training Part 2
MVC Training Part 2
Lee Englestone
Techgig Webinar: Joomla Introduction and Module Development June 2012
Techgig Webinar: Joomla Introduction and Module Development June 2012
Vishwash Gaur
Customizing the Django Admin
Customizing the Django Admin
Lincoln Loop
Modules and Components Introduction in Joomla! 2.5
Modules and Components Introduction in Joomla! 2.5
Vishwash Gaur
Introduction to Angular Js
Introduction to Angular Js
Professional Guru
Develop Basic joomla! MVC component for version 3
Develop Basic joomla! MVC component for version 3
Gunjan Patel
"Umbraco MVC - a journey of discovery" - Lotte Pitcher
"Umbraco MVC - a journey of discovery" - Lotte Pitcher
lottepitcher
Introduction to Angularjs
Introduction to Angularjs
Manish Shekhawat
Introduction to Angularjs : kishan kumar
Introduction to Angularjs : kishan kumar
Appfinz Technologies
Get things done with Yii - quickly build webapplications
Get things done with Yii - quickly build webapplications
Giuliano Iacobelli
BackboneJS Training - Giving Backbone to your applications
BackboneJS Training - Giving Backbone to your applications
Joseph Khan
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Rails
codeinmotion
Some ways to DRY in Rails
Some ways to DRY in Rails
Framgia Vietnam
ASP.MVC Training
ASP.MVC Training
Mahesh Sikakolli
Thin Controllers Fat Models - How to Write Better Code
Thin Controllers Fat Models - How to Write Better Code
Dr. Syed Hassan Amin
ASP.NET MVC Presentation
ASP.NET MVC Presentation
Volkan Uzun
MVC in PHP
MVC in PHP
Vineet Kumar Saini
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
Senturus
Joomla Day India 2009 Business Logic With The Mvc
Joomla Day India 2009 Business Logic With The Mvc
Amit Kumar Singh
Simple module Development in Joomla! 2.5
Simple module Development in Joomla! 2.5
Vishwash Gaur
MVC Training Part 2
MVC Training Part 2
Lee Englestone
Techgig Webinar: Joomla Introduction and Module Development June 2012
Techgig Webinar: Joomla Introduction and Module Development June 2012
Vishwash Gaur
Customizing the Django Admin
Customizing the Django Admin
Lincoln Loop
Modules and Components Introduction in Joomla! 2.5
Modules and Components Introduction in Joomla! 2.5
Vishwash Gaur
Introduction to Angular Js
Introduction to Angular Js
Professional Guru
Develop Basic joomla! MVC component for version 3
Develop Basic joomla! MVC component for version 3
Gunjan Patel
"Umbraco MVC - a journey of discovery" - Lotte Pitcher
"Umbraco MVC - a journey of discovery" - Lotte Pitcher
lottepitcher
Introduction to Angularjs
Introduction to Angularjs
Manish Shekhawat
Introduction to Angularjs : kishan kumar
Introduction to Angularjs : kishan kumar
Appfinz Technologies
Get things done with Yii - quickly build webapplications
Get things done with Yii - quickly build webapplications
Giuliano Iacobelli
BackboneJS Training - Giving Backbone to your applications
BackboneJS Training - Giving Backbone to your applications
Joseph Khan
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Rails
codeinmotion
Some ways to DRY in Rails
Some ways to DRY in Rails
Framgia Vietnam
Thin Controllers Fat Models - How to Write Better Code
Thin Controllers Fat Models - How to Write Better Code
Dr. Syed Hassan Amin
ASP.NET MVC Presentation
ASP.NET MVC Presentation
Volkan Uzun
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
Senturus
Ad

Recently uploaded (20)

Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
ICT Frame Magazine Pvt. Ltd.
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Alliance
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Priyanka Aash
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
Connecting Data and Intelligence: The Role of FME in Machine Learning
Connecting Data and Intelligence: The Role of FME in Machine Learning
Safe Software
MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
OpenPOWER Foundation & Open-Source Core Innovations
OpenPOWER Foundation & Open-Source Core Innovations
IBM
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
Key Requirements to Successfully Implement Generative AI in Edge DevicesOpt...
Key Requirements to Successfully Implement Generative AI in Edge DevicesOpt...
Edge AI and Vision Alliance
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
Fwdays
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Safe Software
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
ICT Frame Magazine Pvt. Ltd.
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Alliance
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Priyanka Aash
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
Connecting Data and Intelligence: The Role of FME in Machine Learning
Connecting Data and Intelligence: The Role of FME in Machine Learning
Safe Software
MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
OpenPOWER Foundation & Open-Source Core Innovations
OpenPOWER Foundation & Open-Source Core Innovations
IBM
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
Key Requirements to Successfully Implement Generative AI in Edge DevicesOpt...
Key Requirements to Successfully Implement Generative AI in Edge DevicesOpt...
Edge AI and Vision Alliance
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
Fwdays
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Safe Software
Ad

Joomla Extensions Kung Fu