Over a million developers have joined DZone.

What are design patterns and when to use them?

DZone's Guide to

What are design patterns and when to use them?

· Mobile Zone
Free Resource

Discover how to focus on operators for Reactive Programming and how they are essential to react to data in your application.  Brought to you in partnership with Wakanda

What is a design pattern?

Simply put a design patterns is well thought out solution to a common problem.

Design patterns has been around for a long time in software design. Ground breaking work was made by the "Gang of Four" in their book "Design Patterns". If you are a software developer you probably are familiar with the book.

UI design patterns

Similar approach can also work on user interface design. They can be especially useful in mobile UI design as problems with small screens can be emhasized.

UI design isn't exact science though. In my opinion UI design patterns are much more like frameworks for solving problems than ready solutions. They can sometimes be applied directly but more often than not they should be adapted to the needs of any particular UI that is being designed.

I've formalised the patterns in a bit different way from the Gang of Four book. I've selected problem, solution and consequences as the main properties of each pattern. See smartphone and tablet UI patterns.

When to use a design patterns?

A design pattern should never be applied without a reason to do so. You should never try to solve a problem that doesn't exists. For example Dashboard Android UI design pattern, that is very widely used, does not apply to every app. If the app in question, for example, only shows next departures of a nearby bus stop the design probably should not have a dashboard landing screen.
Never use a design pattern that that doesn't solve a problems you have.
Even if you have the exact problem described in a pattern description UI design patterns don't always work regardless of the app. It's always wise to evaluate use of any design pattern in the context of the app. 

Benefit of using UI design patterns

Many of the commonly used design patterns have been well tested and are widely used. They also get refined over time. Often these solutions are better and easier to implement than reinventing the wheel.

Using UI design pattens also bring consistency to the Android platform. Users know how Action Bars and Dashboards work.

Another big benefit is availability of free library projects that help the developers get started with implementation much faster.

Read more about design patterns

Learn how divergent branches can appear in your repository and how to better understand why they are called “branches".  Brought to you in partnership with Wakanda


Published at DZone with permission of Juhani Lehtimaki, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}