In my last post, I talked about how isolating the code allows you to focus on the main problem and ignore the complexity associated with the rest of the application. In this post, I will talk about how a large problem can easily be solved by dividing it into much smaller (micro) problems.
Implementing Micro Tasks
Let’s say you are building an application which allows the user to authenticate using username and password. You are responsible for the complete piece, which includes the database, server as well as the user interface. If you look at the problem as a single unit, you may get overwhelmed due to the scale of the task. I have even witnessed some of my students completely freeze and not even able to take a single step forward, because they become paralyzed due to the mammoth size of the task.
The path forward is to break problems into smaller, micro problems. There is no hard and fast rule of how small a micro problem should be, but it should be definitely smaller than the original task. Here are few examples of micro tasks for building the login user interface:
- Place required web elements on the page
- Validate TextFields for username and password
- Display validation messages
- Add CSS styling as instructed in the design guidelines
- Make web page responsive
All these tasks should be written somewhere, either digitally or physically on a piece of paper. Once you have completed the task, you can mark it off as completed. The process of checking off tasks, accomplishes two things. First it moves you closer towards your goal and second it gives you confidence to move forward.
Let’s take another example, where you have to build the backend endpoint for the login action. The action would be responsible for extracting username and password from the request, checking credentials against the database and then notifying the caller of the result. Here are few micro steps you can take to authenticate the user.
- Implement login action and extract and print username and password
- Fetch the user object from the database using username
- Compare hashed password for the user
- Return JSON result to the user
When validating the backend code, make sure to start with a tool which can initiate request instead of triggering a request from the user interface. You can use any tool you like, but I recommend POSTMAN. Using a tool to test your backend will allow you to narrow focus on a single layer, backend. If your backend works as expected using a networking tool but fails during user interface integration then you will be confident that the problem lies in the integration code rather than the backend.
The process of dividing a large problem into micro problems takes time and experience. If you are just starting out, I urge you to write every single task on a piece of paper and try to solve it. After gaining more experience, you will start to see things at micro level and your brain will automatically start dividing large problems into micro problems.
If you liked this post and want to support my work then check out my courses on Udemy.