Sencha MVC Architecture
Copyright 2012 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: November 2012
Production Reference: 1011112
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-84951-888-8
www.packtpub.com
Cover Image by Asher Wishkerman ( <>
)
Credits
Author
Ajit Kumar
Reviewers
Dave Kinsella
Deepak Vohra
Acquisition Editor
Usha Iyer
Commissioning Editor
Meeta Rajani
Technical Editors
Rohit Rajgor
Nitee Shetty
Copy Editor
Alfida Paiva
Project Coordinator
Michelle Quadros
Proofreader
Maria Gould
Indexer
Hemangini Bari
Graphics
Aditi Gajjar
Valentina Dsilva
Production Coordinator
Melwyn D'sa
Cover Work
Melwyn D'sa
About the Author
Ajit Kumar started his IT career with Honeywell, Bangalore in the field of embedded systems and moved on to enterprise business applications (such as ERP) in his 12 year career. From day one, he has been a staunch supporter and promoter of Open Source and believes strongly that Open Source is the way for a liberal, diversified, and democratic setup, like India.
He dreams and continuously endeavors that the architecture, frameworks, and tools facilitate the software development at the speed of thought.
He has done his B.E. in Computer Science and Engineering from the Bihar Institute of Technology and co-founded Walking Tree, which is based out of Hyderabad, India. Here he plays the role of CTO and works on fulfilling his vision.
I would like to thank my wife, Priti, and my sons, Pratyush and Piyush, for their support and encouragement, and all the people behind the Sencha products and other Open Source projects.
About the Reviewers
Dave Kinsella has been a professional web developer since 1996. Over the years, he has worked with many different technologies on projects ranging from public websites and web applications to large intranet content management systems. He has never considered himself to be a specialist in any particular field other than the general topic of "Web Technology" and spends a lot of his spare time trying out new ideas and techniques. Many of these can be found on his blog: webdeveloper2.com.
He is currently employed by Quantiv Limited as the Head of Interactive Design, where he is designing and building flexible web-based interfaces for complex data-processing applications using ExtJS and Sencha Touch.
Deepak Vohra is a consultant and a principal member of the NuBean.com software company. He is a Sun Certified Java Programmer and Web Component Developer, and has worked in the fields of XML and Java programming and J2EE for over five years. He is the co-author of the book Pro XML Development with Java Technology, Apress and was the technical reviewer for the book WebLogic: The Definitive Guide, O'Reilly . He was also the technical reviewer for the book Ruby Programming for the Absolute Beginner , Course Technology PTR and the technical editor for the book Prototype and Scriptaculous in Action,Manning Publications . He is also the author of the Packt Publishing books JDBC 4.0 and Oracle JDeveloper for J2EE Development , Processing XML documents with Oracle JDeveloper 11g , and EJB 3.0 Database Persistence with Oracle Fusion Middleware 11g .
www.PacktPub.com
Support files, eBooks, discount offers and more
You might want to visit www.PacktPub.com for support files and downloads related to your book.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at > for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
http://PacktLib.PacktPub.com
Do you need instant solutions to your IT questions? PacktLib is Pack's online digital book library. Here, you can access, read and search across Pack's entire library of books.
Why Subscribe?
- Fully searchable across every book published by Packt
- Copy and paste, print and bookmark content
- On demand and accessible via web browser
Free Access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.
Preface
Model-View-Controller is a popular architecture among the software developers to build scalable and maintainable applications. While most of the time we use the server-side MVC architecture, with the complexity increasing in the Rich Application Development, a similar architecture is needed on the client-side, as well. The client-side MVC architecture allows us to de-couple the presentation from the model and the controller logic. The newly introduced client-side MVC architecture in Sencha's two frameworks ExtJS and Touchoffers a great way to model applications where we can leverage the benefits of the architecture, and also with the Sencha SDK Tools we can manage the complete projectfrom creation to build and packagingeffectively. This, on one side, helps us to develop an application by following the MVC architectural principles, project structure, and coding guidelines while, on the other side, it optimizes our build and packaging for the Web.
What this book covers
, Sencha MVC Architecture : This chapter describes the MVC architecture and outlines the need of having an MVC architecture implemented on the clientside, which runs inside a browser. The chapter shows how to model an application without using Sencha MVC architecture and look at the demerits of that modeling. It then reviews the benefits that one can get by following Sencha MVC architecture. Subsequently, it visits the classes in ExtJS as well as Sencha Touch, which map to the model, view, and controller.
, Creating an Application : In this chapter we look at a sample application and learn how to model it as per the MVC architecture and map the different building blocks to the classes provided by ExtJS and Sencha Touch. The application development involves how to identify the views, models, and controllers in an application, how to make use of multiple controllers within an application and pass the data and control between them to achieve the overall application behavior. At the end, we look at some of the rules related to class naming convention, folder structure, and so on, which is required to get the application up and running.