Binders Design Patterns in Android - Proxy,Mediator and Bridge Pattern? - android

I come from C Background and have knowledge on C++(at least I know virtual functions, INheritance, Code -reuse and some OOPS concept), But still I am having hard time understanding the Design Patterns in C++/Java.I guess Binders Design Patterns are based on C++ Design pattern(correct me).
DO i have to understand UML as well to understand them.
Plz explain or direct a link with test source code on the above.
PS: I am trying to understand this blog by Tetsuyuki Kobayashi and i am in no way related to him.

I wouldnt say that C++ Binders are a design pattern. I put a link here explaining them.
I would also say that Design patterns arent really language specific, they can basically be implemented in any (most) programming languages. Languages that support OOP typically make implementing design patterns easier, but that could be argued.
The Gang of Four design patterns book uses UML to explain design patterns, but I wouldnt say you would have to be a UML expert to understand design patterns. If UML is bothering you, try the Head First Design Patterns book, its much easier to understand.

Related

Android themes and styles: how can I find my way in this jungle?

I have been wrestling for at least one year with trying to understand how to master/get insight into Themes and Styles, but haven't come further than grasping parent relationships (and I think I read somewhere that such relations behave more like macro's rather than like true inheritance.)
To give a simple example: this nice looking SO answer frustrates me: what is the relationship between themes, styles, platforms, support library, API levels, etc... (and not speaking of the fact that custom styles don't need to use "parent", a dot notation suffices - why is this so different?)
The link talks about beasts such as ThemeOverlay, "?attr/colorPrimary", "app:popupTheme", device themes, native themes; where are all those beasts? How can I use them? What do they mean?
Android dev doc admits that this is all poorly documented, and suggest to dive into the source code. but I don't feel much to explore the link they give. I mean - I'm sure I will find out if I dive into the source code, but I have better things to do than debug AOSP... And if I look at eg this, all I get is a totally useless literal.
I'm aware this sounds daunting, but I can't get to reach my arms around this "big mama"... It feels like if one was not part of the AOSP movement from the beginning, it's very difficult to catch up.

Design patterns for Android development

Going through job openings, I sometimes see the phrase "design patterns" listed as a requirement. The phrase "design pattern" is rather too generalized. When I think of design patterns, I often think of something like MVC (Model View Controller) but MVC doesn't really fit in well with Android, whereas it does fit in well with web applications.
If someone in a job interview asks me what design patterns do I know of for Android, I would be stumped. Can you indicate any major design patterns that Android developers might use so that I can get familiar with them? Thanks a million!
There are couple of design patterns being used by developer weather they are aware of it or not, below is the list of the most used
Observer pattern
Singeton Pattern
Factory Pattern
State Pattern
Filter Pattern
Iterator Pattern
Template Pattern
Adapter Pattern

Starting point for app creating, where to start

I am looking to start writing apps for mobile devices. I know a little about this subjec, and I am proficient in both java and python. However, before jumping into creating apps I wanted to get the community's input on a question I have not yet found the answer to:
How/Where should I begin?
I understand this question is fairly general/basic for a community that focuses on solving/debugging complex programs, but if there is a recommended tutorial (or specific platform) that will help a beginner(such as myself), it would greatly reduce the frustration and amount of monotonous questions asked on this forum and others.
Regards
Coursera is offering 3 courses all using android development which started last week. That would be an excellent starting point for anyone:
https://www.coursera.org/specialization/mobilecloudcomputing/2
How/Where should I begin?
I don't know about you, but I often learn by example more than reading. You mentioned that you're proficient in java so thats a great start. After you understand the Android SDK it's really only the UI good practices you need to learn. So here's my suggestion.
Start off with something super simple. Let's say, create your own version of a calculator. Something that can add, subtract, multiply, and divide. This should be dirty, ugly, but works correctly.
After doing this, take a look at some other android calculators on the play store. Check out Simple Loan Calculator. I use this example because it offers a lot of android UI components. ViewPager, ActionBar, etc. Download this app, take a look at it, and try to mimic it. This should provide an idea on how to work with the android UI components.
What's next? After you have done these two apps you should be relatively ready to tackle your own project.
HTML apps are easy to port across multiple mobile platforms. I have set up an Android HTML template as a starting point. You can just import this project into Eclipse and take a look at that.
https://github.com/jakewp11/HTML5_Android_Template
Here is my experience for ios,
There are three things that I consider as pillars
Objective C
Memory managment
Design patterns
The first one looks obvious but I'd stress on learning concepts like protocols, categories, extensions. As a beginner I thought that learning the syntax was enough, but time and again I had to jump back to the language concepts to understand what's going.
The memory managment , the most talked and confusing subject and now since we have automatic referenc counting to make things simpler and often new Dev skips learning memory concepts (I did it). So I suggest you to have an idea what actually happens under the hood of arc " the manual memory managment"
The design patters,
When I started off , to pass data and control , what I used to do was achieve every thing through the only design patten I knew (target action) . I lack the knowledge of design patters didn't how easily I could achive better results with less code.
Some resources:
Dev.apple.com
http://www.raywenderlich.com (one of my best tutorials are here, you can find one on design patterns)
http://rypress.com/tutorials/objective-c/
And yes , the sample projects at Dev.apple are the best tutors.

Design pattern for fragments in android

I am reading a book and it says like this
"Right now, fragments are very new, so there are few well-established
patterns to follow"
But I do not know where to read more about the design patterns for fragments at all.
I want to make an application with a lot of different screens and the app should be available for a tablet and for a phone, so the fragments will help me a lot here. But as I said this is big one and I am about to start designing it. So I really need good design. And before I start I want to see some design patterns guidelines for fragments in android.
I there something like best practices or something ?
I read a lot about fragments their usage and all those stuff, but I didn't find some well established design pattern for making app for phones and tablets.
I really need advanced chapter about this.
Thanks
You've probably read this but just in case, the Android Reference Document on Fragments quite nicely explains how to separate your UI and the Example right at the bottom of the page shows a reasonable way of how a UI using fragments can include more or less fragments given a change in orientation.

Design patterns used in Android apis

We have a class home work for design pattern class. In that we have to explain anyone design pattern used in any api/framework. I was thinking if I could do the same using Android apis. I know that android uses some command, observer, template method patterns and many more but it would be great if someone could point me to the starting reference document or so.
Thank you so much in advance.
Frameworks almost by definition tend to implement high-level patterns such as MVC or ORM patterns. These are not covered in the GOF text, although you will find them in other pattern books such as Martin Fowler's Patterns of Enterprise Application Architecture. Some GOF patterns are implemented at the framework or even language-level (like C# events/delegates as an example of the Observer pattern), but mostly GOF patterns are left to the individual developer to implement as needed, as the details tend to be application or domain-specific.
Android is the same way. It has a specific flavor of Model-View-Controller built in, but not too many GOF-specific patterns. You might consider the Activity lifecycle callbacks (onStart, onResume, etc.) as a kind of Observer pattern, although with only one dedicated subscriber.
Another example might be AsyncTask, which could be considered a species of the Command Pattern. I'll leave it to you to make the connection. It is homework after all.
This link show How extensive is the use of design patterns in Java core. I will expect the android to use them extensively as well.
Examples of GoF Design Patterns in Java's core libraries
And see how Adapter pattern Specifically is being used in the Android frame (second example is from Android's source code)
http://javatechig.com/design-patterns/adapter-design-pattern-in-java
http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.1.1_r1/android/widget/Adapter.java?av=f
Design Patterns are just conventions which made to simplify coding. And make it more clear so you should make sure that is what they do and not obscurify your code structure.

Categories

Resources