Skip to main content

Posts

Showing posts from June, 2012

Using Objective C files in C++ files (mm)

If you're using .mm files (C++) in your project, when you include the header files in .mm files header you may get below mentioned error (Even though you have all the right linker flags set): 1. linker failed with exit code 1 2. directory not found Solution: 1. Try adding the file to .mm file directly (not to .h file for .mm) 2. Try adding the file as extern extern "C" { #import "DetectDevice.h" }

Inversion of control - Part 1

When an object of a type depends on an object of another type we say that the types are coupled. This is because change in one can lead to a change in second. This will hamper the extensibility and modification in design. In a more complex system lot of classes interact with each other and this will lead to a very brittle design. Let's take an example:    class Program     {         static void Main(string[] args)         {             List<Employee> employees = new List<Employee>();             EmployeeController employeeController = new EmployeeController();             employees = employeeController.GetAllEmployees();         }     } Program depends on EmployeeController to fetch Employee(s).  Inversion of control Logically Inversion means rearrangement. ...