Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Android Design Patterns and Best Practice

You're reading from   Android Design Patterns and Best Practice Create reliable, robust, and efficient Android apps with industry-standard design patterns

Arrow left icon
Product type Paperback
Published in Dec 2016
Publisher Packt
ISBN-13 9781786467218
Length 370 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Kyle Mew Kyle Mew
Author Profile Icon Kyle Mew
Kyle Mew
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Design Patterns FREE CHAPTER 2. Creational Patterns 3. Material Patterns 4. Layout Patterns 5. Structural Patterns 6. Activating Patterns 7. Combining Patterns 8. Composing Patterns 9. Observing Patterns 10. Behavioral Patterns 11. Wearable Patterns 12. Social Patterns 13. Distribution Patterns

Chapter 1. Design Patterns

Design patterns have long been considered some of the most reliable and useful approaches to solving common software design problems. Patterns provide general and reusable solutions to frequently occurring development issues, such as how to add functionality to an object without changing its structure or how best to construct complex objects.

There are several advantages to applying patterns, not least the way that this approach assists the developer in following best practices and how it simplifies the management of large projects. These benefits are achieved by providing overall software structures (patterns) that can be reused to solve similar problems. This is not to say that code can be simply cut and pasted from one project to another but that the concepts themselves can be used over and over again in many different situations.

There are a good many other benefits to applying programming patterns, all of which will be covered at some point in the book, but here are one or two that are worthy of mention now:

  • Patterns provide an efficient common language between developers working in teams. When a developer describes a structure as say, an adapter or a facade, other developers will understand what this means and will immediately recognize the structure and purpose of the code.
  • The added layers of abstraction that patterns provide make modifications and alterations to code that is already under development much easier. There are even patterns designed for these very situations.
  • Patterns can be applied at many scales, from the overall architectural structure of a project right down to the manufacturing of the most basic object.
  • The application of patterns can vastly reduce the amount of inline commentary and general documentation required, as patterns also act as their own description. The name of a class or interface alone can explain its purpose and place within a pattern.

The Android development platform lends itself nicely to the employment of patterns, as not only are applications created largely in Java, but the SDK contains many APIs that make use of patterns themselves, such as factory interfaces for creating objects and builders for constructing them. Simple patterns such as Singletons are even available as a template class type. In this book, we shall see not only how to put together our own, large-scale patterns but also how make use of these built-in structures to encourage best practice and simplify coding.

In this chapter, we will begin by taking a brief look at how the book as a whole will pan out, the patterns we will be using, the order in which we will approach them, and the demonstration app that we will be building to see how patterns can be applied in real-world situations. This will be followed by a quick examination of the SDK and which components will best assist us on our journey, in particular, the role that the support library provides, enabling us to develop for many platform versions at once. There is no better way to learn than actual experience, and so the rest of the chapter will be taken up by developing a very simple demonstration app and employing our first pattern, the factory pattern, and its associated abstract factory pattern.

In this chapter, you will learn the following:

  • How patterns are categorized and which patterns are covered here
  • The purpose of the book's demonstration app
  • How to target platform versions
  • What support libraries do
  • What a factory pattern is and how to construct one
  • How to follow a UML class diagram
  • How to test an app on both real and virtual devices
  • How to monitor an app during runtime
  • How to use simple debugging tools to test code
  •  What an abstract factory pattern is and how to use one
You have been reading a chapter from
Android Design Patterns and Best Practice
Published in: Dec 2016
Publisher: Packt
ISBN-13: 9781786467218
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image