Category Archives: Java

Architecture of the web application

In my last post design, I discussed the idea that we are going to work on building a web application. I detailed the user flow, but I missed out on some points about security and session management. I will add the details of architecture of social KPI web application.

Name of the application

Before we discuss the application, we still haven’t decided on the name for the application. This web application will indicate the performance of a small business in social media. Basically, this is a free tool for marketing and depending on how small businesses use social media, they will be able to build a campaign for their business. If small businesses are not using social media, they are already at a disadvantage. This is just a pie in the big social world. That brings me to the purpose of the application to provide social key performance indicators (social KPIs) to businesses. So the name of the application will be SocialPie.

Security and Session Management

We will use Spring Boot. We will be using spring security elements to build authentication and authorization aspect of the application. I will definitely include the details of this component when we will start working on building the application. In a previous post spring security, I have discussed how to use spring security for authentication.

For managing a session, we will be using spring provided service based on Redis. We will also be using caching considering we will be connecting to Facebook, Twitter, and Instagram APIs, so we can keep the data in cache for pre-decided time. This will be beneficial from a performance perspective. We will be using Redis caching with our own cache manager to handle caching.

I will try to include all these elements in the architecture diagram that we will be building in this post.

Architecture

Architecture of web application Social KPI

 

Conclusion

In this post, we created an architecture for our web application Social KPI. In the next post, I will detail another user flow with some class diagrams and explain each service in detail. The application will be based on microservice architecture.

 

Design and discussion of an idea for Saas Application

In this post of building an application, we discussed what is a saas application and how it can be designed and built. There are possibly a few ideas that I had in my mind or that I came across on the internet. So, I will discuss an idea for the saas application here.

One of the ideas that I have chosen, is to build a web application for small businesses so they can monitor their social media progress. A report that can give details about how the business is performing. From the outside, the whole idea seems very simple – build a report. But there are a lot of complexities involved here if we will be connecting to multiple social media.

We will be discussing the design of this idea and see if we can make progress to build a final design.

Discussion of the idea for the saas application –

  1. A small business can subscribe to this application on two models. One model will be free and others will be paid.
  2. The free model will offer a basic report about the business’ performance in social media.
  3. The paid model will offer a detailed report along with an action plan to improve marketing ratings.
  4. Part of this architecture and development, first we will build a free model only. Depending on how long it is going to take me to build the entire product, we will plan the paid model.
  5. We will use Twitter, Instagram, and Facebook as the three main social media to connect to. All these three social services offer their APIs for developers.

A User flow

  1. If a small business is looking for a marketing tool as part of its social media strategy, they can subscribe to the application that I will be building herewith.
  2. A sign-up page. A user coming across this web application will have to sign up for an account to use the tool.
  3. Sign up will be unique for a business. At least for an alpha version of this tool, only a single user from a business can sign up/login. Maybe next versions or paid versions will give more flexibility to sign up or log in for multiple users from the same business.
    1. A sign-up page will ask for a business name, person’s name, contact number, email address.
    2. A person who is signing up will receive an email for confirmation with login details.
    3. Alpha version will have basic security to login and logout.
  4. Once the business has signed up, that person will access the web application to login.
  5. Alpha version will not deal with security policies at least.
  6. A user once logged into the application will see a dashboard to access the reports.
  7. There will be three reports available for the free subscription model and all three reports will give details about how a business is performing on social media. These three reports will correspond to Facebook, Twitter, and Instagram.
  8. There will be a logout button available for the user to logout. Logout will clear all the session cookies.
  9. Each report will fetch the live data from the respective social media services. Depending on the restrictions for APIs provided by Facebook, Twitter, and Instagram, fetching of new data will be developed.
  10. The report will also show a graphical representation of performance.

How will this help?

What’s the value of this application for small businesses? Of course, this is the basic question. I had to think about the answer if I had to design this application. That is going to be a unique selling point (USP) of this app.

  1. The tool will provide fact-based data about how the business is doing.
  2. It will provide strategies to improve social media presence.
  3. In turn, this will give an idea to small businesses to market themselves and improve customer satisfaction.

Technology Stack

we will be using Java, Spring Boot, MySQL, Github, and AngularJS.

References

The idea for this saas application was borrowed from here.

 

Top 5 Java Coding Practices

In this short post, we will discuss the top 5 Java coding practices. One reason I like to revisit best practices is to remind myself if I am following them or not. Another reason to verify if anything has changed with language. Even if I visit the best practices after a few years, it gives me a refreshing perspective to understand where I am and how I am improving or not. Everybody has their own way, but programming is a skill and over time, you can continue to improve it just like any other skill. So here we go with the top 5 Java best coding practices.

   1. Methods Naming Convention – 

The name of the method should reveal the intention of the method. Example calculateHeight but if you name your method height , it is just bad because that can be more of a variable name. A method should also do a single job. If it is doing more than one job, you can always refactor the code.

   2. Use a consistent style –

The syntax style you use while writing Java code should be consistent across any code you write.

   3.  Use logging –

There are a number of logging APIs available, but the most popular log4j is available as a blanket for logging APIs. While writing an enterprise application, it is of utmost importance to log. From a code review perspective, it is helpful to have logged in your code. Another advantage of logging is in production while resolving a lot of issues, logging is the only way to debug the code in a short amount of time.

    4.  Variable encapsulation –

Most variables when declared should be private . This ensures safety so that accidental usage of this variable does not change the state of it. Adding getter and setter for such variables is standard practice.

    5.   Use comments frequently –

As a programmer, your responsibility begins when you start coding and good code is easy to read with well-documented comments. If a new programmer or developer joins the team, he should be able to understand the code without much context. Also for this reason specifically, read and revisit open source code often.

Conclusion

In this post, I discussed top 5 Java coding practices. What are your favorite tips for Java? If you enjoyed this post, subscribe to my blog here.

References

 

Building a Saas application

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

What is Saas?

Software as a service (Saas) is a software delivery model. In this model, the software is served through subscription service. Saas has been popular for more than a decade now. In fact, the sales of such software have skyrocketed that building simple software has become easier. From project management to ordering healthy food, we can get any of these services through software with a 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. You have to go through trial and errors to build a viable product that people will use it. But also what and who are we targeting as an audience. There are a lot of broader areas to think about 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 a lot of cool products. With AI has been knocking on our doors, what we build today, will be obsolete in the next ten years. Based on your own experience, what I have found, is that you 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 life. What I am trying to point is, look at problems you or other human faces and if that problem can be solved through software, you have got a viable product idea.  At every pain point, the problem is an idea to build a product. Simple example – Elon Musk was driving on LA roads, he was caught in traffic which didn’t move for a long time. How do we improve our traffic? With increasing cars and population, this is almost going to be a nightmare in the future. He realized the problem and started a company called The Boring Company that would build underground tunnels for handling traffic.

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 application, 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 a chance to explore the product with minimum fuss. Less complex the product for customers to use intuitively, better will be their experiences and happier they will be to recommend your product to others.

You should work to create a minimum viable design. This will be an alpha version of the product. Getting alpha version out of the door in minimum time will give you a better idea of where to focus on scaling the product in the future. This will also save time and money.

Technology and Frameworks

Once we have the initial design of the minimum product, we can think of what technology and framework to use. What kind of infrastructure to use? Considering the less expensive options, the 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 solutions to build your application. Also if you want to scale your application in the future for data-intensive, the 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 a lot of flexibility and ease to add a lot of code easily. Of course, there is a learning curve if you have never used spring before. For the database, we have two major options, one is SQL based database or NoSQL. If it is data-intensive application, NoSQL makes more sense.

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

Conclusion

There are a lot of other factors we have not considered in this discussion especially related to the performance and health of the application. Also, we didn’t discuss any major approaches to build the application. I hope this brainstorming post will give readers an idea of a saas application that they can build.

If you have an idea of saas application and you intend to build it, let me know how it goes for you. You can subscribe to my blog.

 

Spring Boot and Microservices

Over the last few months, I have worked on Spring Boot and tried to collect my knowledge around Microservices. I was discussing lot of this with my friends and one friend did suggest me to write a book. Initially I was little hesitant to write a book about something I was learning. But also the whole point of learning is to teach someone at some point of time.

Spring Boot and Microservices

So I took this as a challenge to write a book about Spring Boot and Microservices. Initially I created series of posts and posted on this blog to see how much it could benefit people. And now to make it easy for every one, I have collected all this information and wrote an ebook. This ebook Spring Boot and Microservices is free to download. I hope this will help people to understand the concepts of Microservices and my example can help them to head start the building their projects.

Spring Boot and Microservices

What’s next?

Where do we go from here? There are a lot of questions about the next strategy for Spring Boot and Microservices. What I have covered in this book, is a tiny portion of big picture. There is lot of options like scaling the service, adding a health check for the service, and deploying the service on the cloud with automation. But for right now, I just want to take a break from thinking about this and I will come up with a next plan soon.

Till that time, you can download, read, and send me your feedback about the book. It would be great if you could leave a review for the book here.

If you have any questions, please leave your comments on this blog and I will try my best to answer them.