What is Synchronization in Respect to Multi-Threading in Java

With respect to multi-threading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one Java thread to modify a shared variable while another thread is in the process of using or updating same shared variable. This usually leads to erroneous behavior or program. In … Read more

What are the Pros and Cons of an Observer Design Pattern

PROS:                                                 Loose coupling between Subject and Observer: The subject knows only a list of observers, that implementthe Observer interface, it does no know the concrete implementation of the Observer. Broadcast communication: An eventnotification is broadcast to observers irrespective of the number of Observers CONS:                                                If not used carefullythe observer pattern can add unnecessary complexity. The order of Observer notifications … Read more

Can you List some Java Interfaces that use the Observer Design Pattern

The Java Message Service (JMS) models the observer pattern, with its guaranteed delivery, non-local distribution, and persistence, to name a few of its benefits. The JMS publish-subscribe messaging model allows any number of subscribers to listen to topics of interest. When a message for the published topic is produced, all the associated subscribers are notified. … Read more

What is an Observer Design Pattern

The Observer pattern is a behavioral design pattern that  allows an object (an Observer) to watch another object (a Subject). The subject and observer to have a publish/subscribe relationship. Observers can register to receive events from the Subject. Some of the practical uses of observer pattern are: When a change to one object requires changing … Read more

How Many Types of Relationship Exist in Database Designing

There are three major relationship models:- One-to-one One-to-many Many-to-many In the context of Core Java or any programming language, the number of relationship types in database design is not specifically related to the language itself. Instead, it is a concept in database management systems (DBMS). In the context of database design, relationships between tables are … Read more