4

This question arises from seeing code where I feel like something is wrong but I can't put my finger on it while developing Android.

What are some red flags in Android development that says your application just may not be organized/programmed in the best way? What are some ways to fix these instances of code smell?

5
  • 3
    where I feel like something is wrong but I can't put my finger on it -- It's written in Java? Kidding, KIDDING! Apr 15, 2011 at 17:23
  • @Robert is extremely offended. Sticks nose in the air and covers it with "Design Patterns for Dummies".
    – Michael K
    Apr 15, 2011 at 17:33
  • This is merely anecdotal, but I have noticed on StackOverflow a large influx of newbie Android programmers who want to get rich making the next Angry Birds, but who struggle trying to figure out what a class is. Given this dynamic, it is not surprising that you are seeing code out there that is less than stellar quality. Apr 15, 2011 at 18:16
  • 2
    @Robert, its like the next PHP! Apr 15, 2011 at 18:18
  • @Robert Definitely. The issue is my coworker and I have been flying by the seat of our pants with Android and, even though I've been working on it for half a year, the best practices for larger applications in Android still do not seem obvious to me because there isn't as much good reference on more advanced Android topics online like there is other frameworks, such as iOS or RoR. It's all basic "How to I popup a dialog?" or "How do I add a subview to LinearLayout?"
    – AndrewKS
    Apr 15, 2011 at 18:24

1 Answer 1

2

Android development model will encourage some people to put most of the code in just a few classes. Your Activity1 and Activity2 code will be long and hard to read, full of anonymous classes. This type of development works in the beginning, when you are prototyping, but later on you may want to separate code into classes by Single Responsibility or and short methods.

Too many classes and objects can lead to lower performance, but I suggest you make your code work first, then make it readable, and only then look where/whether your performance needs to be improved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.