A Project to Remember
Tags: octograd2020
Published: 2020-05-22 16:57:21

Building things is a major source of fun for us engineers and developers but before we move in that direction, it is important to recognize the tools/technologies that are available at our disposal to make our work efficient and impactful. With this goal in mind, I tried my hands on various technologies during my college years. I learned:  

- HTML/CSS to build web pages
- flask and Django framework to build server-side components
- Android SDK to build android apps
- Docker to package the applications with its dependencies and environment in which it's operable
- SQL to build Databases that follows ACID properties

and the list goes on. Among all the projects that I've built using various technologies mentioned above, the one that amazes me the most is where I was not allowed to choose what to build and which technology to use.

It was a project that I did as a part of a software engineering course. Our professor wanted all students to build software that works end-to-end. he assigned different project topics to each group of students and on top of that it was mandatory to use only those technologies that were mentioned in the assignment. The problem was, the assignment seemed to be as old as the early 2000s, and I was not sure if the technologies mentioned in the assignment still exists.

I was assigned the project to build a **Stock and Portfolio Management Solution**. The requirement document stated that it should be a web application built in JAVA. In the era of Nodejs and Django, I wondered who still uses JAVA to build their backend solution. 

### The Research Phase

In my initial research, I came to know that the majority of Industry uses JAVA to build their backend solutions. Well that definitely removed one of my assumptions. The next step was to find what technologies are available to build a quality backend in JAVA. Spring Framework turned out to be quite an interesting choice. I finalized the list of tools and technologies I was going to use to build this solution.

- HTML/CSS and Javascript for front-end
- Spring for the back-end
- SQL for Database

This was sorted out quickly. But the major issue was, I still didn't know a thing about **STOCKS**.

I pinged my college alumni working in major Investment banks and asked them for ideas on how such a solution is expected to behave. I got some interesting ideas and pointers. I did a lot of google-search to understand stocks and spent some time on Investopedia stock simulator to identify features that I should support in my product. 

### The Design Phase

With all the information that I gathered from the research phase, I began the design part. I made a list of features that I planned to integrate in the platform. A rough list of some important features looked something like this:

- Separate Interface for the customer, stockbroker, and admin.
- The customer should be able to see the stocks that he/she owns.
- The user should be able to trade stocks (buy/sell).
- All the stocks in the market should be displayed on the platform with the current price.

I created all the necessary UML diagrams because it was a mandatory part of the course. UML diagrams included the activity diagram, use-case diagram, class diagram, etc. Another critical task was to design the schema of the Database. Since multiple transactions were going to happen on the platform, it needed to be taken into account while creating the DB. I tried using all my knowledge of DBMS like normalization to make sure I was designing a Database with minimal redundancy and maximum efficiency. 

### The Implementation Phase

After finishing the design, I moved on to the implementation part. It was of course fun as I always enjoy writing any sort of code. I was already familiar with JAVA and I was learning the spring framework side by side. 

I learned many new concepts and their implementation like DAO (Data Access Object), JSP (Java Servlet Page), Session, JDBC, Dependency Injection, Beans, MVC architecture (Model, View, and Controller), IoC (Inversion of Control), and many other things. Whenever I learned something new, I tried to incorporate it into my codebase. 

Another interesting thing I learned was how to operate Maven. Maven is a build automation tool based on POM (Project Object Model). It also manages all the Dependencies in your project. Think of Dependencies like a 3rd party solution that you want to include in your codebase (for ex. security) but your base framework does not offer by default, therefore you have to download and include it separately. It's difficult to keep track of all these dependencies and versions manually, and Maven helps to make this job easier. I used Apache tomcat to run the WebApp.

### The Conclusion

I spent around 2-3 months building the platform that worked end-to-end but there were few limitations:

- I didn't write any unit tests or integration tests for the code
- No load tests were performed on the application
- I didn't write a Documentation on how to run the project (Only God Knows how to run that thing now)
- I didn't include some features that I intended to support

I knew that the platform that I built was not suitable for high load. I wondered the steps that are involved to make sure that if a platform like this is deployed in production, It caters to the need of hundreds of users. I had a few **intriguing questions** on how to make my platform more reliable and secure. This increased my interest in the Infrastructure side of the software-engineering realm.

Nevertheless, I was proud of what I had built. I don't remember the exact code I wrote, but what I do remember is the lessons I learned during this process. I learned how to research effectively, steps involved in designing a product, best practices to solve errors/issues, how to learn new technologies at a fast pace, among others. All these are foundational aspects of software engineering. 

As far as my **intriguing questions** were concerned, I decided to gain some experience to answer them. I am currently doing an internship at a startup as **Infrastructure engineer** where I am learning to run and operate large platforms at scale in production. I developed a great love for **System Design** and this project played a major role in helping me identify my interests and motivated me to pursue them. 


### Link to Code

Please feel free to go through the code.

{% github https://github.com/AbhiTaker/StockEX %}