- Standard Design Principles
These are the foundational design principles every developer should internalize. They complement the SOLID Principles (covered in a dedicated post) and apply across languages and frameworks. 1. DRY (Don’t Repeat Yourself) Every piece of knowledge should have a single, authoritative representation…
- Singleton Pattern
Introduction The Singleton pattern ensures a class has only one instance and provides a global point of access to it. It is one of the most widely used — and misused — design patterns in software engineering. When applied correctly, it solves real problems around shared resource management, such as…
- Postgres – Subqueries and CTEs
Scalar subqueries, IN, EXISTS and the difference that matters when the inner query returns NULL. WITH for naming the steps of a query you can still read next month, the MATERIALIZED keyword that Postgres 12 made optional and when to force it, recursive CTEs, and writing to two tables in one statement with a data-modifying CTE.
- Git restore deleted commit
Sometime you commit something but then accidentally deleted it and then you would like to bring it back or continue working on it. I had this happened to me and it was frustrating to redo everything I deleted. But then I found out there is a way to recover deleted commit. Well, you want to […]
- Git reset
Get list of commits to choose from git log Git reset can change the branch pointer to point to any commit in the tree. git reset –hard <hash> $ git reset –hard 07a2a46 HEAD is now at 07a2a46 Updated index.html If you quickly check the log, you will see no history of the commits […]