organised around objects rather than actions and data rather than logic. Historically, a program has been viewed as a logical procedure that takes input data, processes it, and produces output data. — Google
as a template/blue print that describes the behaviors/states that object of its type support. • Object: Objects have states and behaviors. Example: A dog has states - color, name, breed as well as behaviors - wagging, barking, eating. An object is an instance of a class.
Object: อีแดง หมาพันธุ์ไทยหลังอาน ชอบเห่า จะหมุนตัวเวลาคลุกขี้ ขอมือจะกัด public class Dog{ private String name, bark, spin, giveHand; private int legs; } Dog อีแดง = new Dog();
method/class) from external class. • private: No entry. • protected: Accessible via Child class. • public: Accessible from everywhere. • default: Accessible via classes within the same package.
a template that defines the state and behaviour common to objects of a certain kind. A class can be defined in terms of other classes. For example, a truck and a racing car are both examples of a car. Some famous example, car-truck, canine-dog-wolf. Still confused?
on another object or class, using the same implementation (inheriting from a class) or specifying implementation to maintain the same behaviour (realizing an interface; inheriting behavior). The relationships of objects or classes through inheritance give rise to a hierarchy.
to other objects. The collection interfaces declare the operations that can be performed on each type of collection. You can NOT create fully functional app without using some form of Collection.
programmed instructions that can be managed independently by a scheduler. In mobile world, there's always one main thread (aka UI thread). Any long duration or intensive process should be ran on background thread only. This is to ensure UI thread get all the cycle it wants to draw the screen.
the occurrence, during computation, of exceptions – anomalous or exceptional conditions requiring special processing. There are three main components involved in Exception Handling in Java, Throwable, Exception, Error.
My job is to control components for the view private ViewBinder binder; // Let me handle the binding then public void bindData(Data data) { binder.bind(data); } }
binData(Data d) { ... } } public class PrettyViewBinder extends ViewBinder { @Override public void binData(Data d) { // By doing this we ensure ViewBinder still working properly ... prettify(); } }
void binData(Data d) { ... } } public class PrettyViewBinder extends ViewBinder { @Override public void binData(Data d) { if(isLoading) { // Use placeholder instead of loading image } ... // These task will be execute regardless. // This ensure you get the view with data binded just like inside ViewBinder } }
View bindData(Data d); } public interface IDataLoader { public Data loadData(String url); } public interface IViewInteract { public void onViewClick(); public void onViewSwipe(); }