Caching is a common practice to improve your system in many ways. It helps to make your system resilient, scalable, fast, and even save some bucks depending on your use case.
If in your database some values are read often then it’s a good idea to cache them. This could be the content of the email that you send to a newly registered user, a catchy banner text that changes every day or the number of hours you ban a user from your system for suspicious activity.
If these are accessed too frequently, you may store them in application properties…
In a web app forms are the most easy and well known way of taking input from user. But with forms, comes validation. There are many ways of incorporating validation with forms. Here we will see how to use vee-validate in a VueJS project where bootsrap-vue is used as ui framework.
First of all let’s create a layout of a form containing 3 fields: name, email, phone number.
Firestore is a managed, scalable document storage available in Firebase platform. Why I like it? You can start using it and get 20K reads and writes per day whithout paying a dime event without sharing your credit card info. 20K read writes are more than enough for experimenting and creating a small to medium application.
Firebase have already provided some feature rich client packages for different programming languages. There is also one for Java too, and its documentation is well written to get started with. …
In micro-service architecture it is common that one micro-service communicates with another by consuming REST APIs. In the spring ecosystem a popular REST client is Feign because of its declarative style and DRY approach for adding different configuration.
In this post I will talk about enabling retry mechanism for feign Client. By instinct what we can do is update our business code where we wrote the statement for api call inside a try catch and while loop and write code for another API call until our condition is met. …
Django was the first web framework that I’ve learned. It helped me to land my first job. So I have a special place for Django in my heart. Whenever I work with a new framework or coding practice, I instinctively try to think- If I were using Django, how would I be doing it.
Right now I use Java, specifically Spring-boot for most of my tasks. The transition was a bit hard. I missed Django shell most for quickly testing or prototyping a piece of code. For a way around I learned to write Tests , not really full fledged…
AWS provides us a tonnes of services to reduce development and maintenance hassle. Those who need to stream and store(maybe analyze too!) lots of data in real-time, they can avail kinesis services. Of-course if you want to build your own pipeline then no one is stopping you… but there goes a say:
If I have seen further than others, it is by standing upon the shoulders of giants
In my case it was just putting the data to kinesis data firehose, which will periodically dump those data after some threshold in an s3 bucket. Pretty basic need. But after I…
Abstract factory is a creational pattern. This pattern provides an interface for creating families of related or dependent objects without describing their concrete classes.
In my last writeup about Factory Pattern I described a situation of an imaginary programmer who just created a motorbike sharing platform. Within few days his platform got so popular that customers started demanding for cars too. Instead of re-writing his whole codebase we saw how he implemented Factory pattern to accumulate both car and bike rides in his platform.
Today he is planning to add a new feature in his platform. He want to give…
Factory pattern is a creational pattern. It defines an interface for creating different type of object on the run-time. Enough jargon! let’s see an example.
Imagine you are have created a motorbike sharing app. As days gone by, your app become so much popular that users are also requesting to enable car sharing too!
Though you are happy and enjoying the excitement of upcoming success, but what about the code? Right now your code has only Bike class, and all the other methods and classes are intertwined with this class. If you need to add another class like Car you…
There is no doubt how important is the logs for a production grade application. Operational problems can be avoided and business decisions can be improved by collecting and analyzing adequate logs.
Recently I’ve been working on a Java project where I had to use the jSMPP library. Two of it’s dependencies are SLF4J and Log4J. Though it can work without then just fine for development, but as I got used to the library the uncool warning messages started to bother me. So I went there to add them in the dependencies. …
We all know how easy it is to start a project in Django. After installing Django you just need to issue one command:
django-admin sartproject myproject
This will create a myproject directory in your current directory which will contain some initial settings, database configurations etc. and the structure is as follows:
Here you can see there is a myproject on top of all, which contains another myproject inside. This inside myproject will contain the settings and configurations.
Somehow I’ve developed a bit of compulsion towards this structure…