Buy @ Amazon

Search This Blog

August 21, 2017

Book Review - The Checklist Manifesto



It's a well written book shedding light on the importance of Checklists at work even if it is very critical with regards to time, cost, size of team/project etc. The author shares stories and anecdotes on how right kind of checklists can avert serious damages/mistakes.

I particularly like the way the author catches the attention of the reader in the beginning of the book. As the book gets to the later chapters, it gets dense in the domain that may or may not interest the reader.

I would recommend you get your copy from Amazon for cheaper price. Have fun reading it..

When do you use map vs flatMap in RxJava?

 Learning RxJava is an overwhelming exercise because it is a paradigm shift in the way you solve your coding problems. During this learning process, of the many doubts you'll have, one such would be, "When do you use map vs flatMap in RxJava?".

ProTip : Get used to understanding the Marble Diagram for understanding the basic concepts of Reactive Extensions.


Here is a simple thumb-rule that I use help me decide as when to use flatMap() over map() in Rx's Observable.

Once you come to a decision that you're going to employ a map transformation, you'd write your transformation code to return some Object right? If what you're returning as end result of your transformation is:
  • a non-observable object then you'd use just map(). And map() wraps that object in an Observable and emits it.
  • an Observable object, then you'd use flatMap(). And flatMap() unwraps the Observable, picks the returned object, wraps it with its own Observable and emits it.

Say for example we've a method titleCase(String inputParam) that returns Titled Cased String object of the input param. The return type of this method can be String or Observable<String>.
  • If the return type of titleCase(..) were to be mere String, then you'd use map(s -> titleCase(s))
  • If the return type of titleCase(..) were to be Observable<String>, then you'd use flatMap(s -> titleCase(s))

Hope that clarifies. And if this post helped you pick the concept, I'd appreciate you share the post and upvote this answer in StackOverflow.

August 20, 2017

Book Review - Scalability Rules

 Scalability Rules

A book for Scalability enthusiasts

A good book that should serve as ready reference or guidance for anyone interested in the topic of availability and scaleability. Even though, the guidance/rules that this book mentions, seem  simple and seemingly intuitive, in the real-world situations you'll find violating these giving whatever excuse it be. Reading books like this re-affirms our own intuition and awakens you of risks the next time you come across situations that warrants you to apply these rules where appropriate.

The later chapters could have been better explained with examples. For instance, in the chapter on "Avoid or distribute scale", the author could have explained situations where these rules can be applied and where it does not. In the absence situational examples or use-cases, the reader might likely remain confused or worse with false sense of knowledge. The same applies in the chapter on async communication with Message Buseses, where the author talks about cost of data. Some real-world examples/use-cases would really make this book a rich resource for the reader. 

All said, this book deserves a place in the book-shelf of a developer, manager, architect or a CTO.

August 5, 2017

Book Review - Reactive Android programming


I read this book from SafariOnline. The book is a fantastic read, ridden with examples. The reader typically learns by example. It's a no fluff, just stuff to the point that saves you a lot of time. The book covers employing contemporary 3rd-party libraries where required depending on the use-cases, all blending well with the respective topic/situation.

I'd say this book is from one pragmatic programmer to a busy, impatient and hungry programmer wanting to get his hands dirty.

July 11, 2017

Android Development ProTips To Prevent Memory Leaks

Memory Leaks are not apparent during development
This post is for those impatient Android developers who are seeking a checklist of tips to remember during development, in order to avoid the nasty Memory Leaks in the app thus leading to poor app performance. Poor app performance results in bad user experience that leads to poor ratings in the Play Store.

Let's get the basics right. As much as we'd like to think of Java's Garbage Collector as our reliable agent to cleanse heap of stale objects, it's not hundred percent fool-proof, in that some of the overlooked coding gotchas can trip its reliability. For instance, a WeakReferenced object gets garbage collected quickly over its Strongly Referenced object. But that said, using WeakReferenced object comes in the way of elegant coding. So, typically you look for for areas where you can introduce WeakReference.

ProTip #1: Where possible, use the context-application instead of a context-activity. Look for opportunities where the Application-context is sufficient, instead of the Activity-context.

ProTip #2: Have ImageViews in Activity/Fragment? Use WeakReference to hold the ImageView, so that when the Activity/Fragment is destroyed, the ImageView is readily Garbage Collected.

ProTip #3: Replace non-static anonymous inner-classes (whose life-cycle is not in your control) with static inner-classes. In Java, the non-static inner-classes, hold an implicit reference to its containing class. So imagine you use a non-static inner class inside of your activity. Even after the activity is past the onDestroy life-cycle, it wouldn't be garbage collected, because the non-static inner class holds an implicit reference to it.

ProTip #4: Using Handler? Then don't forget to call removeCallbacksAndMessages(null) or removeCallbacks(mRunnable) in the onDestroy() lifecycle method of the class containing it.

ProTip #5: Using any Listeners? Remember to unregister those listeners.

ProTip #6: Using Eventbus? If you cared to use register(this) then also do care to use unregister(this) in the appropriate lifecycle method definition.

ProTip #7: Employed MVP design-pattern for your code-structure? Passing View implementation as constructor argument to your Presenter implementation? Then ensure to wrap your View in WeakReference.

ProTip #8: Using Threads? Then double-check to see if you have control over its death and are in-fact stopping it at some point in time. Threads in Java are GC roots. Therefore, the Dalvik Virtual Machine (or the DVM) keeps hard references to all active threads in the runtime system, and as a result, threads that are left running will never be eligible for garbage collection.

For detailed and informative reading do care to refer the following posts/articles/books


July 9, 2017

Notes from TED Talk - Why do ambitious women have flat heads?


Watch it in TED

Speaker Profile
In 1962, Dame Stephanie "Steve" Shirley founded Freelance Programmers, a software firm with innovative work practices -- and (mainly) women employees. 
She is a successful million-dollar entrepreneur, Philanthropist and a business-woman in technology. 
She is author of the book (memoir) titled, "Let it Go: The Entrepreneur Turned Ardent Philanthropist"


Secrets to success
  • Surround yourself with first-class people and people that you like. 
  • And choose your partner very very carefully.

Startup Entrepreneurship
It's one thing to have an idea for an enterprise. Making it happen is a very difficult thing. It demands:
  • extra-ordinary energy, self-belief, and determination 
  • the courage to risk family and home 
  • a 24/7 commitment that borders on the obsessive.

Work : "So it's just as well, I'm a workaholic. I believe in the beauty of work when we do it properly and in humility. Work is not just something I do when I'd rather be doing something else."

Life Lesson : We live our life forward. So what has all that taught me? I learned that tomorrow is never going to be like today, and certainly nothing like yesterday. And that made me able to cope with change, indeed eventually to welcome change, though I'm told I'm still very difficult. (Laughter)

July 5, 2017

Colorful Android Logs for Better Productivity

This post assumes you're using Android Studio, if not you better do ;)

It's very common to keep an eye on the logs in Android Studio, every time we deploy the app-under-development into a device/emulator. And it hurts our eyes and our peace for the increased attention we tend to keep on the rolling logs in the Android Studio hunting for the required pieces of information.

Is there a better way to be a little productive so that you can quickly focus on required logs? There is. By simply color styling your logs based on the log's severity level.

This way, you don't miss on that error log or important debug log amongst the continuously rolling logs since your app is deployed.

The good news is, it's a simple configuration change that you'll have to make in your Android Studio Editor like below and you're done.

Android Studio Preferences -> Search for 'logcat' in the search bar



Define your own color coding for different log severity levels or alternatively feel free to use the one that I ended up copying from.

Assert: 9C27B0
Debug: 2196F3
Error: F44336
Info: 4CAF50
Warning: FFC107

Confession: I've shamelessly copied this technique from one of the StackOverflow answers.

Book Recommendation: If you're a beginner Android developer, don't miss out in grabbing a copy of Android Programming: The Big Nerd Ranch Guide. The authors have done justice in teaching stuff with care wearing the hat of a beginner Android developer. It's worth your time. Happy learning!

June 12, 2017

Book Review - Agile Android by Godfrey Nolan


Agile Android by Godfrey Nolan

This blog post is a candid review of the book titled, "Agile Android", authored by Godfrey Nolan

This book is very concise and is a very high level overview of writing tests for native Android development project. It gives you a taste of the tools that you can use to write tests and aid writing more tests.

Who does this help? If you're a novice developer wondering what tools to use and how to get started using those, then this book is for you. You could perhaps be that curious Manager who is wanting to wrap his/her head on the tools that your Android development teams use.

March 15, 2017

Book Review - The One Minute Negotiator


Book Cover - The One Minute Negotiator

This is a good book that gives real, practical and genuine advice on negotiating - starting from the very definition of what a negotiation is.

While the content it less, the author made it enjoyable to read, pause and ponder about his advices as the book progresses. 

Read this book, and you might likely want to attend a workshop on this topic by this author.

Get your copy from Amazon now.