Posts

Polymorphism

Polymorphism is the third essential feature of an object-oriented programming language, after data abstraction and inheritance.  It provides another dimension of separation of interface from implementation, to decouple what from how. Polymorphism allows improved code organization and readability as well as the creation of extensible programs that can be “grown” not only during the original creation of the project, but also when new features are desired. Polymorphism is also called    dynamic binding or late binding or run-time binding  

Understanding the Delegate pattern

Delegation is a simple and powerful pattern in which one object in a program acts on behalf of, or in coordination with, another object. The delegating object keeps a reference to the other object—the delegate—and at the appropriate time sends a message to it. The message informs the delegate of an event that the delegating object is about to handle or has just handled. The delegate may respond to the message by updating the appearance or state of itself or other objects in the application, and in some cases it can return a value that affects how an impending event is handled. The main value of delegation is that it allows you to easily customize the behavior of several objects in one central object. The delegating object is typically a framework object, and the delegate is typically a custom controller object. In a managed memory environment, the delegating object maintains a weak reference to its delegate; in a garbage-collected environment, the receiver maintains a strong ref

Java 8 features

1. Adding   Foreach () method in iterables 2. Default and static methods in interfaces 3. Functional Interfaces & Lambda Expressions 4. Java Stream API for bulk data operations on collections 5. Java Time API 6. Collection API Improvements 7. Concurrency API Improvements 8. Java I/O Improvements

Creating a CardView View in your iOS App

So how do i achieve the material design CardView  component in an app being built for iOS. There's a lightweight swift Library which gives you a card view as  a simple UIView subclass with rounded corners and a drop shadow This Swift Library can be downloaded here... CardView Library on GitHub

Method Swizzling - Objective C hackery

Image
This is a new concept to me and it's quite arguably a feature that could haunt you the more your iOS app gets more complex. Objective C Method Swizzling is the process of changing the reference your method selector points to at runtime. It is made possible by Objective C's dispatch model. So let's say a method has a reference f(). In method swizzling you can point the method f() to another method at runtime. A simple example Lets say we wish to print a log statement whenever viewDidAppear() is called on a UIViewController. One solution could be to subclass UIViewController with a LoggingViewController and use that as our new base class for view controllers.

Simple fun with Closures

Image
So closures are self contained blocks of functionality which can be passed around and reused in various parts of your code. Closures are similar to lambda's in other languages.. A typical use case for employing closures is in iOS Grand Central Dispatch You can find a more detailed explanation here https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Closures.html#//apple_ref/doc/uid/TP40014097-CH11-ID94