FAU Android

FAU's local android experts!

Best practices and guidelines for writing efficient, well-designed Java programs

Posted by Georgiana Carvalho April - 19 - 2010 - Monday Comments Off

This section covered several practices and guidelines for writing efficient, well-designed Java applications, specifically for the Android platform. These guidelines are not only for improving the efficiency and speed of an application but also for making it more reliable, robust (less error prone and more secure), reusable and maintainable. 

To view the material covered in class please see Java – Best Practices.

To view the class recording see: Part 1 and Part 2.

References:

  1. Effective Java, Joshua Bloch, Prentice Hall, 2008 (ISBN-10: 0321356683)
  2. Best practices for coding your Android applications: http://developer.android.com/guide/practices/design/performance.html

Patterns and Refactoring in Android

Posted by Mihai April - 13 - 2010 - Tuesday Comments Off

In order to have high quality frameworks developed as part of their class projects, students were exposed to concepts such as patterns and refactoring. Although you could have an entire course on these subjects, we tried to compress the basic ideas into two lectures.

Patterns are a general and flexible way of solving a recurrent problem. The principles behind patterns are described in Bruce Eckel’s Thinking in Patterns book. In a nutshell:

  • A design is finished when you cannot take anything away from it
  • Duplication should be avoided
  • Occam’s razor: the simplest solution is the best

There are different types of patterns. Students were presented architectural patterns, such as Model-View-Controller (MVC), and Design Patterns (such as Factory method, Builder, Strategy).

For each of the patterns, a short description of it (in terms of its components, features, and principles behind it), together with an example written in Android were shown.

Refactoring is about “a change made to the internal structure of software to make it easier to understand and cheaper to modify without changing its observable behavior”, as mentioned in Refactoring: Improving the Design of Existing Code, by Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Roberts.  The class presentation and code were based on this book. We covered reasons for refactoring your code (like improving the design of the software, make it easier to understand, helps in finding bugs an develop code faster), and when one should consider refactoring (when adding a function, fixing a bug, etc). In addition, use cases of when and how were shown, such as when having duplicate code, or a long method/class/parameter list. Students were taken step by step through the process of applying refactoring methodologies (like extracting method, extracting class, replace parameter list with object, etc) in those cases.