Posts

Showing posts from January 27, 2015

What is Dependency Injection & Polymorphism

Image
" Dependency injection is the way to decouple conventional dependency relationships between objects. " What is meant by Dependency ? Suppose there are two classes A and B. A can not carry out works without B and A can not be reused without re using B. For this kind of scenario we said " A depends on B " A – Dependant B – Dependency What Is meant by Decouple ? A and B classes are decoupled if A can be use without B and and B can be used without A. Lets assume creating a drawing application with Square , Triangle and Application classes. Square and Triangle class has same method name called draw() which draws square for a Square object and triangle for Triangle object. Polymorphism to rescue ! The Greek meaning of the word "polymorphism" is "having different forms". Same object having different object behaviors !  Added interface called Shape and the common method draw() for both

Basic git commands for beginners with examples

Image
Git is a popular version control system (VCS). Wait , what is a Version Control System ? " Version Control System keeps track of the records changes to a set of files over time "  Why we need Git or any other VCS ? Only to keep the code in a remote repository as a backup ? Is VCS a waste of time ? Lets find answers for these questions. When we are creating individual projects we may not want to use a VCS. But VCS is very useful for team projects. Imagine you are working on a team project without using a VCS. Each of your team members given individual tasks and plan is to combine those tasks at the end. But practically it would be a very difficult. There can be lots of redundant of codes, redundant of libraries,  sometimes combining costs lots of time and even may be unable to combine. Imagine a scenario in which everybody can work under a same framework, every one do there part and add to a common repository so that different indivi