Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
3  
where I feel like something is wrong but I can't put my finger on it -- It's written in Java? Kidding, KIDDING! –  Robert Harvey Apr 15 '11 at 17:23
    
@Robert is extremely offended. Sticks nose in the air and covers it with "Design Patterns for Dummies". –  Michael K Apr 15 '11 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. –  Robert Harvey Apr 15 '11 at 18:16
2  
@Robert, its like the next PHP! –  GrandmasterB Apr 15 '11 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 '11 at 18:24

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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