May we suggest...


Introducing Android code style guidelines at Buffer

Whenever you’re working solo on a project, chances are you’re writing in ‘your’ style – which often makes it easy to make all your code look and feel the same (but not necessarily clean). And when there’s more than one team member contributing to a project, it can be difficult to ensure that code is kept both clean and readable. Chances are that everyone has their own way of doing something, even when it comes down to things such as the way variables are named or the ordering of methods within a class – these may be small differences but they can quickly build up. The problem is, when code style differs between files it can cause a number of different problems. For example, it can take you longer to navigate through files when there is no organisation of methods, or it may take you longer to make amends to a class because you’re trying to stick to a style that you are not familiar so you can try to keep the code in there clean. And as a team grows, new developers could be writing code in another different style – the difference grows even more and the issues caused by unclean code grows more and more, in turn affecting things such as readability, consistency and more.

For a number of reasons, we’ve decided to document our new code style for our Android App at Buffer. All new code that we write will be written in this new style, with any backtracking being done as we refactor and re-implement features. These guidelines are about being mindful of both the projects health and your team members. They are not designed to be static – we will most definitely add to them, as well as return to certain areas that we may want to rethink ?


Consistency compliments all of the points in this list, without consistency all of these would suffer. Having guidelines allows our applications code-base to remain consistent during the development process. We can move between files and know that the both the look and feel of code is going to remain the same, regardless of who may have worked on it – no matter how far along the line in time.


These guidelines allow us to help ensure that our code remains readable, regardless of who may be developing on it. Readable code reduces cognitive load for the reader, rather than taking the time to decipher what a method name says, what a parameter is used for or what the variable ‘xyz’ is used for – we can get straight to concentrating on the task at hand. Again, the codes readability is again affected by the other points made within this list.


Having guidelines helps make it easier to both fix issues and add new features. Not only will we be more familiar with the structure and organisation of the code we may have not worked on, but we’ll also be creating code that will create the sense of maintainability for the other members on our team. These guidelines also help us to encourage the decoupling of responsibilities amongst classes, allowing us to both re-use components and reduce the complexity of others.


The time spent trying to find classes, methods or variables can quickly rack up if there are no conventions in place. And as a project grows, it can become harder to navigate around the files, especially for new team members who may join. Having guidelines in place can help our projects structure and files to become more navigable, this can be achieved by a combination of naming and ordering for files, methods and variables. Knowing that the interface will be located at the bottom of the class saves me having to scroll through the class file, knowing that the class is ordered by lifecycle methods allows me to quickly find the onDestroy method and using the method name searchUserId instead of findUserId for a search method makes it quicker to find when using my IDEs search functionality.


Meaningful code is both simpler and clearer, making it easier to understand what it is our code is meant to be doing. Variables should mean what they’re named, methods should only do what their name tells us and a class should be used for what its name entitles.

Saying that, I think it’s about time you took at look at our guidelines! We’d love to know what you think of our guidelines or if you’re using them in your own projects! ?

  • Beautiful! Love the write up. Great work ?

  • Sean Mac Gillicuddy

    Great to see this article and a big long guide but where is the formatter jar? In my project I set up 80% of these guidlines and then export the jar of my settings and put it in the root of the github project along with a that screams “IMPORT THE FORMATTER AND INSPECTION PROFILE”(also the macro for when you save, it rearranges/reformats/optimises imports) and then make sure they all get run on every commit for VCS changed file scope. Also you can throw the entire project through it so you at least get every unused import and other items of that scale eradicated also everything gets ordered correctly which just makes me happy.
    Just noticed the checkstyle/pmd/findbugs and though I am no expert on them it doesn’t look as though your rules are declared in them as stringently as they could be. Still curious to see the settings jar

  • Rom Shiri

    It’s great, thanks!
    Do you have any tool/formatter to force these guidelines you’ve integrate in your IDE (Android Studio)?

  • Elye Project
  • Vasiliy

    Thank you for sharing this, but I would advise against adopting this set of practices (or, at least, cherry-pick just a subset of them). The reason for my suggestion is that I think the following are counter-productive:

    1) “Private, non-static field names should not start with m” – this practice suggests that you don’t read your code outside IDE much, otherwise you wouldn’t recommend this. Pull/merge requests reviews outside IDE become much easier when all object’s fields are designated by “m” prefix (explicitly shows variable’s scope). Furthermore, “m” prefix is used in AOSP’s code, therefore it is de-facto standard for Android.

    2) Section 2.2.14 suggests usage of Log statements “guarded” by build type check. First of all you should not use Log statements in your app, but delegate to some non-static wrapper which you can mock for unit testing (I guess you don’t unit test your code, or test only with Robolectric, right?). Secondly, you should use Proguard and automatic scripts in order to remove logs from the code, instead of polluting it with these build type checks.

    I didn’t read any further, therefore I can’t comment on anything following section 2.2.14

  • Sveta Sm

    MVP (Minimum viable product) is the first live version of your product that is released on market.
    Why you need MVP:
    Saves your money from waste
    Reduces risks
    Opens communication with target audience
    Thunderrise is expert in development of MVPs for startups.

  • No matter if some one searches for his necessary thing,
    so he/she wants to be available that in detail, thus
    that thing is maintained over here.

  • Roshan Singh
  • Yeah…! Well Said it After Reading your Post We are able to Download Instagram Images & Video And Spotify Premium App

  • Certain general medicinal conditions, for example, diabetes and circulatory issues can be credited to erectile issues, and getting to the foundation of the issue is the best game-plan much of the time. If the body isn’t solid, poor flow is a side effect of different issues and using Cenforce 100 drugs for erectile dysfunction all things considered won’t work.

  • – – Now Login to Your AOL Mail and Manage Emails. You may also do AOL Mail Login, Create AOL Account, AOL Password Reset etc.

  • magellan roadmate update – Magellan Roadmate Update – Magellan Roadmate will Update Maps and Software directly on the Magellan Device. Get Your Magellan Maps Updated Here.

  • – In order to activate your Mcafee Antivirus, Visit and follow these steps – Enter your code>> Log in>> Get protected >> Enter your 25-digit activation code.

  • bt mail – BT Mail – Now you may do My BT Login or Btinternet Sign in to Manage BT Account and Access all the features including Compose Mail, etc.

  • thank you for sharing this . |

  • Trend Micro Login – Just Simply do Trend Micro Sign in at and Manage all service like Subscriptions, Billing etc.
    Trend Micro Login

  • MalwareBytes Support – Just Call MalwareBytes Phone Number and Instant Support related to Errors or Issues by calling MalwareBytes Customer Service.

  • Amrinder Singh

    Canon Printer offline

    Canon Printer offline problem is most regular issue looked by Canon Printer clients, on this blog entry you will get every one of the guidelines to fix Canon Printer offline problem.

  • Amrinder Singh

    [url=]Canon Printer offline[/url]

    Canon Printer offline problem is most regular issue looked by Canon Printer clients, on this blog entry you will get every one of the guidelines to fix Canon Printer offline problem.

  • anthonylio925

    Use the Malwarebytes Tech Support Number to address the queries related to the antivirus.

  • anthonylio925

    The Malwarebytes Customer Care Phone Number can be contacted to resolve from basic to advance issues.


    Install norton com setup and enjoy the best system security protection from online threats, viruses, malware and spywares. It protect your device and smartphone from any possible or existing viruses and does not make affect system performance in any manner.

    Setup Norton 360

  • zee webroot

    It is very helpful to secure your device and it is very light weighted antivirus product.
    Webroot secure anywhere offers a user-friendly interface which provides several functions & they all work together to make a system protected. To activate Webroot go to
    Webroot security is a great antivirus program, which amazingly lightweight tool with accurate URL blocking and powerful bonus features.

  • zee webroot

    Panda Antivirus is the best antivirus program for all your devices. It Protects your computer, tablet and smartphone against all types of viruses, malware and ransomware. Panda Antivirus Pro 2019 The new Panda Antivirus Pro provides the easiest-to-use and most intuitive protection for your computer. Install it and forget about viruses, spyware, root-kits, hackers and online fraud. Download Panda Antivirus for Windows, Mac by Visit URL.
    install panda antivirus

  • How to find the matching software for your model?

    1. To start with, move to the software update page
    2. Type the device name and version
    3. Make sure that the version that you use is compatible

    For HP Laserjet Pro m404n setup guide, speak to our customer support at the earliest. Start printing and you can print a network test page to verify and validate the settings

  • Thanks for sharing such information

80,000+ social media marketers trust Buffer

See all case studies