Appcelerator Titanium: Patterns and Best Practices


Appcelerator Titanium: Patterns and Best Practices
eBook: $14.99
Formats: PDF, PacktLib, ePub and Mobi formats
$12.74
save 15%!
Print + free eBook + free PacktLib access to the book: $39.98    Print cover: $24.99
$24.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Support
Sample Chapters
  • Full step-by-step approach to help structure your apps in an MVC style that will make them more maintainable, easier to code and more stable
  • Learn best practices and optimizations both related directly to JavaScript and Titanium itself
  • Learn solutions to create cross-compatible layouts that work across both Android and the iPhone

Book Details

Language : English
Paperback : 110 pages [ 235mm x 191mm ]
Release Date : February 2013
ISBN : 184969348X
ISBN 13 : 9781849693486
Author(s) : Boydlee Pollentine , Trevor Ward
Topics and Technologies : All Books, Mobile Application Development, Mobile

Table of Contents

Preface
Chapter 1: Understanding JavaScript Patterns
Chapter 2: Titanium Best Practices
Chapter 3: Building an Application Using CommonJS and the MVC Pattern
Chapter 4: Cross-platform Design Methods
Chapter 5: Using JSONDB as an Alternative to SQLite
Index
  • Chapter 1: Understanding JavaScript Patterns
    • It's all object(ive)
    • Understanding scope and the global object
      • The global object
    • Code structure and formatting
      • Use semicolons and curly brackets
      • eval is evil
      • The curly bracket position
      • Not all operators are created equal
      • Formatting, commenting, and naming conventions
    • Prototype
    • Micro optimizations
      • Declaring variables outside the for statements
      • Using forEach instead of for loop
      • Using shortcuts for simple if statements
    • Summary
    • Chapter 2: Titanium Best Practices
      • CommonJS
      • Code formatting
      • Code validation
      • Comment meaningfully
      • Do not pollute the global object
      • JavaScript instance
      • CommonJS modules
      • CommonJS best practices
      • Managing memory
      • Summary
      • Chapter 3: Building an Application Using CommonJS and the MVC Pattern
        • Standards
        • Frameworks
        • The architecture
          • CommonJS
        • The bootstrap
        • Multilingual
        • Directory structure
          • Android
          • iPhone and iPad
          • Control
          • Model
            • Services
            • Data
          • UI
          • Tools
        • Naming
        • The application
        • The controller
        • Tools (helpers)
        • CommonJS require
        • Callbacks
        • Model
        • UI
          • The layout module
          • The custom menu
          • Common elements
          • Windows
        • The controller updated
        • Fail gracefully
        • Summary
        • Chapter 4: Cross-platform Design Methods
          • The difference between DPs and PXs
          • Understanding Ti.UI.SIZE and Ti.UI.FILL
            • Ti.UI.SIZE
            • Ti.UI.FILL
          • Choosing a cross-platform layout method
            • Using Ti.Platform.osname statements
            • Developing with separate UI files
            • Importing component styles from external files
            • Building a JavaScript stylesheet CommonJS module
            • Using the Stylesheet CommonJS module in your app
            • Extending the Stylesheet module for page-specific styles
          • Summary

            Boydlee Pollentine

            Boydlee Pollentine is a keen mobile developer who has created numerous apps for the iTunes and Android store and a number of indie games. He is passionate about mobile development and in particular the Appcelerator Titanium platform, and is both a Titanium-certified application developer and a member of the Titans evangelist group. He is also the organizer of Europe's first Titanium mobile development conference, tiConf EU (http://ticonf.eu). Boydlee has been a software engineer and programmer for the last 10 years, primarily focused on web technologies and Microsoft's .NET platform, and during that time has worked for numerous small and large organizations, those of particular note including a number of Australian federal government departments, state departments, banks, and media organizations. He currently lives in Norfolk and works as a freelance Titanium developer via his own digital agency, Tipsy & Tumbler Limited (http://www.tipsyandtumbler.co.uk), and runs a small blog dedicated to mobile development at http://boydlee.com.

            Trevor Ward

            Trevor Ward has been developing business applications for over 20 years. Starting as a Cobol Developer, he has worked on various large scale projects that included the Y2K issues. Moving into web development in the late 90s using Perl, HTML, JavaScript, and Oracle, he was a part of the team that developed internal business applications for Jaguar cars.

            After moving on, he was able to update his skills for Ruby on Rails and Adobe Flex, before 18 months ago picking up on the mobile development platform. He uses Titanium exclusively for mobile development and is an Appcelerator Titan (community expert), TCAD and TCE qualified, and spends as much time as possible, answering questions on the forums.

            Sorry, we don't have any reviews for this title yet.

            Code Downloads

            Download the code and support files for this book.


            Submit Errata

            Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


            Errata

            - 2 submitted: last submission 05 Jun 2013

            Errata type: Code | Page numbers: 47 and 60

            The term removeAppNavListener should be removeEventListener.

            Errata type: Code    Page No: 36
            The bootstrap
            control.startTheApplication(); should be control.startApp()

            Errata type: Code    Page No: 55
            The layout module
            height : '51dp'
            width : '100%'
            background : '#000000' } };

            should be
            height : '51dp',
            width : '100%',
            background : '#000000' } };

            Errata type: Code    Page No: 55
            The custom menu
            var menuBarWin = Ti.UI.createView({
            height : layout.params.menu.height,
            width : layout.params.menu.width,
            bottom : 0
            });

            should be
            var menuBarWin = Ti.UI.createView({
            height : layout.params.menu.height,
            width : layout.params.menu.width,
            backgroundColor: layout.params.menu.background;
            bottom : 0
            });

             

            Errata type: Typo    Page No: 56
            memuButtonA.addEventListener('click', processButA); should read menuButtonA.addEventListener('click', processButA);

             

            Errata type: Code    Page No: 55
            In loadMenuBar(inParam) add the line menuBarWin.add(menuButtonA);

             

            Errata type: Code    Page No: 56
            line2. ')}' should read '})'

            Errata type: Code    Page No: 57
            Line newWin.add(newWinDisplay) is missing in loadHomeWindow() to add the display to the window.

            Errata type: Code    Page No: 57
            The lines:
            // include the menu
            var mainMenu = require('/ui/common/menu');
            newWin.add(mainMenu);
            needs to be changed to:
            // include the menu
            var mainMenu = require('/ui/common/menu');
            mainMenuBar = mainMenu.loadMenuBar();
            newWin.add(mainMenuBar);

            Errata type: Code    Page No: 59
            Extra '}' at end of processBackButton(inParam) function so it should be:
            function processBackButton(inParam) {
            var iPos = ((backArray.length - 2) < 0) ? 0 : (backArray.length - 2);
            if (iPos >= 0) {
            ...............
            common.navHandler(tmpParams);
            }
            }

            Errata type: Code    Page No: 60
            The function removeAppNavListener()
            should be
            Ti.App.removeEventListener('APPNAV', appNavigation);

            Errata type: Code    Page No: 60
            Missing ';' at end of line addAppNavListener() in startApp() function
            Note:The presence or absence of the semicolon won't make any difference to the code.

            Sorry, there are currently no downloads available for this title.

            Frequently bought together

            Appcelerator Titanium: Patterns and Best Practices +    Appcelerator Titanium Business Application Development Cookbook =
            50% Off
            the second eBook
            Price for both: £16.14

            Buy both these recommended eBooks together and get 50% off the cheapest eBook.

            What you will learn from this book

            • Make your apps easier to maintain and more memory efficient with CommonJS
            • Understand JavaScript best practices and prototypal inheritance
            • Learn to structure your app in an MVC style pattern with special consideration given to memory management, localization and app layout
            • Understand and implement the new Appcelerator Cloud Services" needs to be completely removed
            • Learn ways to generate and implement cross platform layouts
            • Find alternatives to standard SQLite databases, including JSONDB
            • Learn how to implement a series of Titanium API and JavaScript optimizations
            • Get solutions to creating cross-compatible layouts that work across both Android and the iPhone

            In Detail

            Titanium Mobile has quickly become the platform of choice for many mobile developers and is growing and changing at a rapid rate. From the implementation of CommonJS,  MVC design patterns and more, the last year in Titanium development has been a rollercoaster of change for the better. With this knowledge at your disposal you’ll be creating top quality, highly capable and stable apps in no time.

            This book shows you exactly how to implement all the latest Titanium Mobile best practices into your apps, from a thorough explanation of CommonJS with plenty of examples, through to structuring a complete MVC style codebase. With advanced topics such as implementing patterns and utilizing ACS, through to a thorough investigation of CommonJS and prototype, this book will take you from Titanium Novice to Titanium Ninja in no time!

            "Appcelerator Titanium: Patterns and Best Practices" starts off with some explanations on JavaScript practices and advanced topics, before getting stuck into the new CommonJS pattern and using that to implement MVC-style architectures for your application. It continues in a practical, hands on manner, explaining how to perform cross device layouts with different techniques, and how to implement SQL alternatives such as JSONDB.

            The book discusses some of the major advanced JavaScript topics, such as prototype and micro optimizations, before leading the developer into a thorough explanation of the CommonJS pattern, MVC implementation and advanced topics such as SQL alternatives and implementing designs for cross device layouts.

            Approach

            The book takes a step-by-step approach to help you understand CommonJS and Titanium architecture patterns, with easy to follow samples and plenty of in-depth explanations.

            Who this book is for

            If you're an existing Titanium developer – or perhaps a new developer looking to start off your Titanium applications "the right way", then this book is for you. With easy to follow examples and a full step-by-step account of architecting a sample application using CommonJS and MVC, you'll be implementing enterprise grade Titanium solutions in no time.

            You should have some JavaScript experience and familiarity with the Titanium development environment, along with a basic knowledge of the development lifecycle and packaging for Android and iOS devices.

            Code Download and Errata
            Packt Anytime, Anywhere
            Register Books
            Print Upgrades
            eBook Downloads
            Video Support
            Contact Us
            Awards Voting Nominations Previous Winners
            Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
            Resources
            Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software