Other than knowing Java, what Design Patterns I should learn bef开发者_开发技巧ore I start looking into Android SDK?
Edit: The reason why I am asking this question, because after looking at the sdk, I think, not sure about that, that it is heavily using adapter pattern and I was wondering if I can know what other Patterns it is using and it can help in my learning process.
Thanks.
One of the biggest jumps from going to desktop programming in Java to android programming is the use of XML to style and control interface layouts. I'd definitely take time to get comfortable with XML if you want to look into programming for the Android system. I'm not too familiar with exact design practices, but the model-view-controller system is very emphasized in iOS development, and I would not be surprised if the same goes for Android programs.
Of course, the developers site would be a great place to look too for any resources: http://developer.android.com/index.html
This article I found over the weekend while at a coding competition may also help get you going in the right path http://answers.oreilly.com/topic/1133-how-to-start-programming-in-android/
There is no need to learn any design pattern to start using Android SDK (may be knowing about the Observer/Listener pattern will help you getting familiar with event handling in Android).
Obviously knowing about them will help you understand the intentions behind some parts of the Api.
High level frameworks such as Android tend to follow a set of design patterns themselves. It's almost like you're learning the pattern(s) on the job. A great example is the publisher/subscriber model of the OnXXXListener interfaces. If you follow the lead that the framework sets forth, it really just comes to you (in my opinion, of course). For example, I created a color chooser View. I want consumers of the View (Activities) to be able to receive notifications like "color selected". I simply looked at how the SDK classes would do this, and follow their lead (created an OnColorSelectedListener interface with an onColorSelected method, expose this functionality through setOnColorSelectedListener in my color picker View, etc).
Coming from a .Net background to Android/Java, I really see the differences. .Net has a lot of different design patterns throughout which provide very good guidance for your custom classes. The good news is, the engineers behind the .Net BCL and the Android SDK did a great job of implementing some very common design patterns so there are great examples to follow.
In my opinion you can start writing code first, and when you find your code ugly or find yourself writing redundant code, you can look for design patterns to make your design better.
Opinions? Just start hacking. The Developers Guide can help guide you along the way.
I do not see how you can go wrong separating out your application algorithms (model) from the event handling code (ActivityClass) and presentation code (XML). The key ideas would be separation of concerns and loose coupling.
JAL
精彩评论