Monthly Archives: October 2017

Building a Saas application

This is a brainstorm post where I will jot down the ideas to build a saas application. Before we start, we have to go to basics.

What is a Saas?

Software as a service (Saas) is a software delivery model. In this model, software is served through subscription service. Saas has been popular for more than a decade now. In fact, the sales of such software has sky rocketed that building a simple software has become easier. From project management to ordering a healthy food, we can get any of these services through software with subscription.

Now what do we want to build and how do we start?

Of course, this is not an easy question to answer in a single post. Lot of times, there are lot of trial and errors you have to go through to build a viable product that people will use it. But also what and who are we targeting as an audience. There are lot of broader areas to think to build a product. That would make the entire process to build a software way too complex. So where do we start? The eternal question still remains. Human psychology over the years has progressed and helped technology to build lot of cool products. With AI has been knocking on our doors, what we build today, will be obsolete in next ten years. Based on own experience, what I have found, is that look into your own daily life. When you go for grocery shopping, when you talk to your friends, coworkers. The moment, you feel frustrated anything that is not in your control, that’s where you have something to build on.

I know it sounds ridiculously easy to write here in the post, but not easy when you are living the life. What I am trying to point is, look at problems you or other human face and if that problem can be solved through a software, you have got a viable product idea.  Every pain point, problem is an idea to build a product. Simple example – Elon Musk was driving on LA roads, he was caught in a traffic which didn’t move for long time. How do we improve our traffic? With increasing cars and population, this is almost going to be a night mare in future. He realized the problem and started a company called The Boring Company which will build underground tunnels for handling traffic.

Back to our idea storming session about building a solution for what problem. If you are like me who works in a software company, it is easy to see through this dilemma to build a solution that can help you and other developers equally. But in a larger context, you can always go through different Saas services and hear the feedback from those services’ users. Any negative feedback is your path to build a product. Assuming we got the idea to build a Saas product, so how do we proceed further?

Post-idea discussion

Once we have a solid idea, we can think about building a minimum viable product which gives customers chance to explore the product with minimum fuss. Less complex the product is for customers to use intuitively, better will be their experiences and happier they will be to recommend your product to others. So one of the major aspect you should work on after a solid idea, is to create a minimum viable design. This will be alpha version of the product. Getting alpha version out of the door in minimum time will give you better idea where to focus on scaling the product in future. This will also save time and money.

Technology and Frameworks

Once we have initial design of minimum product, we can think of what technology and framework to use. What kind of infrastructure to use? Considering less expensive option, cloud is very popular to use to build a Saas product. This reduces the management of infrastructure while giving high availability and scalability. Amazon, Google and Microsoft all these companies offer cloud solution to build your application. Also if you want to scale your application in future for data intensive, cloud is the best option to handle all kinds of load.

For backend, there are different frameworks available based on C#, Python or Java. Since I have worked on Java, I vouch for Spring which offers lot of flexibility and ease to add lot of code easily. Of course, there is a learning curve if you have never used spring before. For database, we have two major options, one is SQL based database or NoSQL. If it is data intensive application, NoSQL makes more sense.

On frontend side, angularjs offers lot of ease to build a modern user interface to interact with backend.


There are lot of other factors we have not considered in this discussion especially related to performance and health of the application. Also we didn’t discuss any major approach to build the application. I hope this brain storming post will give readers an idea what possibilities are out there to build something that is helpful.


How to implement a chatbot in Java

So we are back on our discussion about chatbots. I will not talk about basics of chatbots that I covered here. I will directly start showing how to implement a chatbot in Java. We are going to use AIML (Artificial Intelligence Markup Language) library for this implementation. This library is opensource and provided by google.

A maven project

As a first step, let’s create a maven project in eclipse with groupId com.betterjavacode and artifactId as chatbot. Once the project is created, we can add ab.jar to project by adding the respective dependency in maven pom.xml  like below:

Google library for AIML provides default AI rules to use to implement chatbot. We will add these rules in resources directory of our project. Copy bots folder from program-ab directory into resources folder.

Chatbot Program

Now we will write the chatbot program which will be part of main method. In simple terms, once we invoke this program through main method, it will be in an infinite loop. An input command will wait for user input and then based on our aiml library chatbot will answer to what an user had input.

Now if we run this program, it will show us input to ask a question to chatbot Mr. Chatter.


In this article, we showed how to add a chatbot. Similarly, we can enhance this program by adding custom patterns that chatbot can respond to.


Chatbot Implementation