We have different approaches but all of them have following common concepts to implement Singleton pattern:
- Private constructor which restricts instantiation of the class from other classes.
- Private static variable of the same class that is the only instance of the class.
- Public static method that returns the instance of the class, this is the global access point for outer world to get the instance of the singleton class.
Where do you use the Singleton pattern?
Most of the scenarios, Singleton classes are created for resources such as File System, Database connections etc…
Continue reading “Best Practices of Java Singleton Design Pattern”
HTTP caching can speed up web applications. It’s standardized and well implemented in all modern browsers and results in a lower latency app and improved responsiveness.
HTTP caching occurs when an item is fully cached for faster retrieval the next time the resource is required. The browser may choose to not contact the server at all and simply use its own local copies of web resources. There are many cache headers such as “Cache-Control”, “Expires”, “Last-Modified” and “ETag”.
Continue reading “HTTP Cache Headers”
Sharing my own experience with you on Gradle
Gradle is nice tool to build applications like Maven and ant since it brings best of Maven and ANT… One thing that I don’t like with Gradle is too slow! It is slowest one when compared with ANT and Maven but it is simplest one either 😉
Gradle may be future of building JAVA apps. One day, it might be more popular and will be replaced with Maven by many companies.
Gradle uses the “Groovy” programming language! Don’t panic! You don’t need to know Groovy in order to write build script in Gradle! You just need to understand the Groovy and that is it! However, if you wanna learn about Groovy then here is link for you: Gradle
Continue reading “Gradle build tool”