Don’t give in to FOSS phobia

In business where there is risk, there is always an opportunity. Opportunists take calculated risks to gain higher profit where others are too faint hearted even to try. This article is about such an opportunity.

FOSS phobia

If you work for a small to medium scale (may be even large) enterprise software vendor you probably have experienced the disease known as FOSS phobia. This condition causes irrational behavior on the part of management when the company’s software requires third party software components to perform effectively and those components are available through a choice of commercial closed source offerings as well as free and open source software (FOSS) projects. FOSS phobic management fails to even consider this choice rationally and decides in favor of commercial closed source offerings. This is because the primary pathogen in this case, the marketing guy from the closed source component provider is offering a support contract that a free and open source software project cannot match. He also plants this idea of a need of a support contract deep in to managers’ mind so that he’ll decide against free & open source software at any given opportunity, effectively making him an victim of FOSS phobia. Common sense criteria such as licensing, performance, quality of software and stability won’t even come in to consideration after that.

The idea of this article here is not to promote the definite use of free and open source software at any such given opportunity, But rather to emphasize the point of conducting a proper risk vs. gain analysis of choosing either option on a case by case basis.

Rationale

First let’s consider the primary selling point from that marketing guy for their closed source software component, the expensive but comprehensive support contract. Why would you require support in the first place? Firstly this is to gain initial know how on configurations, setup and tuning for the component. Secondly support will be required in order to diagnose and fix a production fault or a malfunction with the given software component. You don’t have to think too much in order to understand the huge incentive the third party software component provider has, in order to make his software seem more complex and hard to learn as possible. This is particularly true of markets where there are only few dominant vendors (less competition) for the same component. Good examples for these kinds of vendors can be found in the enterprise database and application server markets. Naturally this abuse of power is one of the reasons why the FOSS movement came in to being in the first place. FOSS projects do not have an agenda to sell you software, but they do care about gaining popularity among users so that the project can thrive. Therefore you can bet on it that the more popular and successful a FOSS project is, the easier it’d be to learn, configure and adopt it for your own requirements and also less issues you’ll face while on production. You’d also observe that the more popular FOSS components have a great supportive community of followers as well as companies that are willing to provide support for it if needed. But I stress again this is not enough reason to make a general case for using FOSS software components or otherwise.

So how would you go about evaluating commercial software component vs. FOSS component to be used with your companies own software? As I mentioned earlier this would have to be done on a case by case basis. Following are some general rules of thumb for evaluation of FOSS components to be used with your software.

1)      Make sure the license is not infectious – Some FOSS licenses oblige you to open source your own code once you integrate the FOSS component in to your code. More popular non-infectious FOSS licenses are Apache license, Eclipse public license and MIT license.

2)      Check if the software component satisfies your requirements (functionality, performance etc.).

3)      Make sure there’s enough documentation online even for the core parts of the code that you might never even touch in the beginning.

4)      Get an understanding of how active their forums are, in terms of number of questions asked/answered as well as how active the core developers are in participating in the conversations. Higher the activity the better for you in finding answers for common problems as well as problems specific to you.

5)      Check if there’s commercial support available if you were to require some assistance in the future.

6)      If multiple FOSS components are available, compare/contrast between them using above criteria to select the better one.

7)      Finally compare/contrast with the available commercial closed source alternatives, if you can afford it. Authors’ personal experience is that FOSS components that filter through above rules of thumb beat commercial alternatives by a mile most of the time, even without considering the cost savings in using FOSS components.

Imagine you made the choice to go with the FOSS component even when there is a risk that you yourself might have to provide support for the component in the future without help from the original authors. You might even be using that component in one of the most mission critical parts of your software. But this might result in some huge opportunities for your company to profit from in the future.

Opportunity

First opportunity presents its self when the software developers of your company become familiar with that external FOSS component. This might result in better tuning of your software as well as that external component to suit your needs, making your software perform better in the future. This might also result in you being able to provide better support for your clients as well. Also you’ll not be constrained by an external party not to do any changes to the components as the business requirements change. A good example of this can be found in how Googles Android operating system is used by different software and hardware vendors. Some like Amazon have even managed to fork and customize it according their needs in their Kindle Fire product, revealing a great opportunity for profit.

Another way you stand to gain by your risky investment is when your company requires some vertical integration or diversification. With your software developers becoming experts on those FOSS components you use as support for your software instead of treating them as black boxes, you’ll be in a nice position to sell support for those components as well, profiting in turn from other peoples FOSS phobia. Or you may even be able to build a complete product over it, extracting a profit from that as well. If you look closely you can see this happening all over the enterprise software field right now. Some of the companies that do that already include RedHat with JBoss software and OpenStack, Mulesoft with Tcat application server, Pivotal with Hadoop and Liferay with their Portal solution and many more.

Conclusion

I hope this article has convinced you of the potential gain of adapting and integrating FOSS components in to your own software. Though you take a bit of risk in using some of the stuff without any support contracts, it’d still be better in the long run than spending money on support contracts that may end up being a burden to you as well as your clients.

More importantly if you do find a FOSS project useful in some way please make sure you do contribute back to it in whichever way you can as well.

Is it time for all religions to accept evolution?

Here’s another one of those religious debates over the validity of theory of evolution. I get shocked every time I come across one in youtube. Why is there any debate still as to whether the theory of evolution is true or not is incomprehensible to me. Why Is it too much of a leap of imagination to see that an organism that is better suited to an environmental change will survive and reproduce more? In the long term this is what creates differences between groups of organisms, creating all the diversity of species on earth.

Evolution is a body of knowledge acquired through solid reasoning and trying to understand evidence as it is. Just as all the other scientific theories are. So attacking it based on blind faith or morality is pointless.

Explorations into 3D surface plotting in the browser-1

These days I’m exploring ways of plotting 3D surfaces in the browser. Previously I have worked with some of the javascript based 2D plotting libraries out there like Flot, HighCharts, JqPlot, Google visualization API. And there seems to be many others supporting 2D data visualizations such as D3js. But when it comes to 3D stuff the options are very limited it seems. So much so that I’m thinking writing my own 3D plotting library. But before committing to any of that I’m going to have a go at all of the limited number of options already available. Following are the list of minimal requirements any library must support for me to be able to use it.

  • Panning, zooming and rotating.
  • Dynamic updating of data.
  • Axis labels and ticks.
  • Support all major browsers.
  • Free and open source with a liberal license.

With these in mind I’ll explore the different technologies and libraries available for 3D plotting in the browser. Basically there’s three technologies you can use to render 3D objects in a web browser(For your convenience I’ve also listed available libraries I could find which use those technologies).

  1. Java applets(surfaceplotter, jzy3d).
  2. Flash(Could not find any yet).
  3. WebGL(webgl-surface-plot).

Although an ancient technology compared to other web related technologies, The advantage of using Java applets is that you can leverage much power of Java technology for web client side programming. And also applets work the same way on all browsers which have Java plugin installed. Major disadvantages of these include the download times for the applet jars, the slowness of execution and having to install a plugin. May be download times is not that much of a problem now with broadband internet available in most places. Slowness of execution seem not to be a concern for this specific problem of 3D plotting because alternative solutions seem to suffer from the same problem too. Which leaves the problem of having to install a plugin. This can be a problem in some of the use environments I target.

In my next blog post in this series I’ll explain and share some code on 3D plotting with Java applets, Where I’ll also integrate these charts with Vaadin.

TaskRunner – A simple ordered concurrent taskset executor utility for Java

As a Java programmer how many times have you felt the need to have a way of executing a set of tasks(or more commonly ‘Runnable‘ s) so that some of them are executable concurrently and some sequentially? For example say you have 5 tasks you need to execute so that,

  • Every other task depends on task-1 being finished. So it needs to run first.
  • task-2 and task-3 are independent. So they can be run concurrently.
  • task-4 and task-5 are also independent but they both depend on task-2 and task-3 being completed.

Today I thought I’d solve this problem by coding something simple and light for me to use. And this blog post is about the thing I came up with(https://github.com/vimukthi-git/TaskRunner). The first requirement is to define a task so that the executor can identify the order of execution of the task. This is done by extending the Runnable interface to make it an orderly Task.

public interface Task extends Runnable {

        public String getTaskId();

        public Integer getOrder();
}

By defining a task this way the executor can determine order of execution as well as how to group the task sets which can run concurrently. Next the data structure which will hold the task sets to be executed called TaskMap.

public class TaskMap extends TreeMap<Integer, Set> {

	private int taskSetCount;

	public void addTask(Task task){
		if (containsKey(task.getOrder())){
			get(task.getOrder()).add(task);
		} else {
			taskSetCount++;
			Set temp = new HashSet();
			temp.add(task);
			put(task.getOrder(), temp);
		}
	}

	public int getTaskSetCount() {
		return taskSetCount;
	}
}

Only thing to note here is that the addTask method groups and orders Tasks using the getOrder() method in the Task interface. Ordering of task sets happens automatically in a TreeMap because it’s a sorted map. A Set structure is used to group the tasks by their order of execution inside the TreeMap. Having this data structure in place we can move on to the part where the actual execution takes place, the TaskRunner class.

public class TaskRunner {

	private TaskMap map;

	public TaskRunner(TaskMap map) {
		super();
		this.map = map;
	}	

	public void run() throws InterruptedException, ExecutionException {
		ExecutorService exec = Executors.newCachedThreadPool();
		for (Entry<Integer, Set> entry : map.entrySet()) {
			List<Future<?>> futures = new ArrayList<Future<?>>();

			for (Task task : entry.getValue()){
				futures.add(exec.submit(task));
			}

			for (Iterator<Future<?>> iterator = futures.iterator(); iterator.hasNext();) {
				Future<?> future = (Future<?>) iterator.next();
				if (future.get() == null);
			}
		}
		exec.shutdown();
	}
}

Here it takes in a TaskMap to be executed in the constructor. The execution happens in the run method where the TaskMap is iterated to extract and submit each set of tasks to the ExecutorService instance. A Future for each task in a task set is saved temporarily to make sure that all task in the set have finished executing before the next set of tasks in the TaskMap is submitted to the ExecutorService. Now the aforementioned problem of executing the 5 tasks can be solved as follows.

First create the 5 tasks using the Task interface.

  // create TaskMap 
  TaskMap tasks = new TaskMap();
  // create task 1
		Task task1 = new Task() {

			public void run() {
				System.out.println(getTaskId() + " started");
				try {
					TimeUnit.SECONDS.sleep(2);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				System.out.println(getTaskId() + " ended");
			}

			public String getTaskId() {
				return "Task-1";
			}

			public Integer getOrder() {
				return 1;
			}
		};
		tasks.addTask(task1);

  // create task 2
		Task task2 = new Task() {

			public void run() {
				System.out.println(getTaskId() + " started");
				try {
					TimeUnit.SECONDS.sleep(2);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				System.out.println(getTaskId() + " ended");
			}

			public String getTaskId() {
				return "Task-2";
			}

			public Integer getOrder() {
				return 2;
			}
		};
		tasks.addTask(task2);

  // create task 3
		Task task3 = new Task() {

			public void run() {
				System.out.println(getTaskId() + " started");
				try {
					TimeUnit.SECONDS.sleep(2);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				System.out.println(getTaskId() + " ended");
			}

			public String getTaskId() {
				return "Task-3";
			}

			public Integer getOrder() {
				return 2;
			}
		};
		tasks.addTask(task3);

Above code code demonstrates the creation of first 3 tasks. I have made the tasks sleep for 2 seconds in the run method to simulate running them. Note how the getOrder() method returns 1 for the Task-1 to make it run first. Then in the tasks 2 and 3 it returns 2 to make them run concurrently after Task-1. Same can be applied to tasks 4 and 5 where they’ll return 3 as the order to make them run concurrently after tasks 2 and 3. After having the TaskMap prepared the running of the tasks is easy.

  TaskMap tasks = createTaskMap();
  TaskRunner runner = new TaskRunner(tasks);
		long startTime = System.currentTimeMillis();
		try {
			runner.run();
		} catch (InterruptedException e) {
			e.printStackTrace();
		} catch (ExecutionException e) {
			e.printStackTrace();
		}
		long stopTime = System.currentTimeMillis();
		long elapsedTime = stopTime - startTime;

		System.out.println("Time taken - " + elapsedTime / 1000
				+ " seconds");

Just submit the TaskMap to a TaskRunner and call it’s run method. Complete example can be downloaded from here.

Aljazeera Fault Lines : Robot Wars

This a very insightful documentary by Aljazeera which analyses the growing trend in the unites states towards automating war. They’re going to spend 18 billion dollars over next five years on unmanned systems research. I wonder how much advancement they would have achieved if that kind of research money went in to renewable energy related research. They could have avoided many of the wars they fight just by having more alternatives to oil.

Anyway I like advanced robotics. It’s still an amazing technology to think about.