Skip to main content

Posts

Showing posts from 2021

Hibernate Locking

Locking refers to actions taken to prevent data in a relational database from changing between the time it is read and the time that it is used. Your locking strategy can be either  optimistic  or  pessimistic . Locking strategies Optimistic Optimistic locking assumes that multiple transactions can complete without affecting each other, and that therefore transactions can proceed without locking the data resources that they affect. Before committing, each transaction verifies that no other transaction has modified its data. If the check reveals conflicting modifications, the committing transaction rolls back [ 1 ] . Pessimistic Pessimistic locking assumes that concurrent transactions will conflict with each other, and requires resources to be locked after they are read and only unlocked after the application has finished using the data. Hibernate provides mechanisms for implementing both types of locking in your applications. Optimistic When your application us

Patterns Knowledge

Anti Pattern: Its a pattern which we repeatedly do and which brings negative results. Architecture by implication: Systems lacking a clear and document architecture. Cover Your Assets: Continuing to document and present alternatives, without ever making an architectural decision. Witches Brew: Architectures made by groups resulting in a mix of ideas and lack a clear vision. Gold Plating: Continuing to define an architecture well pass the time which results in no benefits to the architecture. Vendor King: A product dependent architectures leading to a loss of control of architecture and development costs Big Bang Architecture: Designing the entire architecture at the beginning of the project when you know the least about the system.

Design Principles

Identify the aspects of your application that varies and separate them from what stays the same. Program to an Interface, not to an Implementation. Strategy Pattern: Strategy pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from the clients that uses it. Each pattern describes a problem that occurs over and over again in our environments.and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over without ever doing it the same way twice. Strategy using CDI and Producers: https://www.nicolaferraro.me/2016/02/24/strategy-pattern-using-cdi/

Cryptography

Crypto - Secret Graphy - To Write CryptoLogy - The science of secrets Symmetric Cryptography: Both the parties have the same keys. Asymmetric Cryptography: Both the parties do not have the same keys. They work on the concept of Public and Private Keys. Its also called as Public Key Cryptography. Its very expensive to encrypt and decrypt using Asymmetric Cryptography. Hence there are systems which use both Symmetric and Asymmetric Cryptography together like ECC. Don't implement your own Crypto. Its very easy to do it incorrectly. Side Channel: When you can observer properties of a function other than their functional behaviour it is called as Side Channel. E.g. Knowing how long it takes to encrypt a text, knowing the length of a particular encrypted text. In cryptography,  Kerckhoffs's principle  (also called  Kerckhoffs's  desideratum, assumption, axiom, doctrine or law) was stated by Netherlands born cryptographer Auguste  Kerckhoffs  in the 19th century: A c

Random Information

// These methods are all very similar, unfortunately there's no way to use Java templates to solve // The redundancy because annotations can not have inheritance, and the ".value()" function is specific // to each class Stripe Lock in Java: https://google.github.io/guava/releases/19.0/api/docs/com/google/common/util/concurrent/Striped.html http://codingjunkie.net/striped-concurrency/ The Simple Logging Facade for Java (SLF4J) serves as a simple facade or abstraction for various logging frameworks (e.g. java.util.logging, logback, log4j) allowing the end user to plug in the desired logging framework at  deployment time.