Posts

Authentication and Authorization

Image
Authentication and Authorization Authentication and Authorization are two main important concepts in the world of security, mainly when it comes to accessing online services, apps, or systems. As authorization and authentication looks similar but they serve different purposes. Let's dive into authentication and authorization. 1. Authentication - "Who are you?" Authentication is the process of verifying the identity of a user or a system. When you log into a website or an app, you provide some form of identification like a username and password. The system then checks whether the information matches the credentials stored in its database. If it matches, you’re authenticated and allowed to proceed. There are several methods of authentication such as; Username and password : The most basic form where you enter a password to prove your identity. Two-factor authentication : You use something you know (password) plus something you have (a one-time code sent to your phone) to l...

OOP Concepts in Java.

Image
 OOP ( Object Oriented Programming ) In OOP, the two main aspects are methods and classes. If we assume like this, class as fruit and the objects as types of fruits such as orange, grapes, apple etc..... This clearly gives an idea that class is a blueprint or template of an object and object is an instance of a class. class---> Fruit objects ---> Orange, Apple, Grapes etc.... In OOP, there are main 04 concepts, they are as below; Encapsulation Inheritance Abstraction Polymorphism 01 Encapsulation The meaning of Encapsulation is to make sure that sensitive data is hidden from the users, to achieve this you must; declare class variables and attributes as private provide public get and set methods to access and update the value of a private variables The Get method return the variable value and the Set method set the value Example:-  public class Person {     private String name;           public String getName() {     ...

Inner Class, Static Inner Class and Anonymous Inner Class

Image
 01) Inner Class In Java, inner class is a class that defined within another class. Inner classes provide better encapsulation, organization and useful when you want to logically group classes that are only used in one place. Inner classes are able to access the outer class's methods and variables, if they are even private. They often used to be readable and maintainable codes. In Java, there are several inner classes among those, the three inner classes that i chose are as below; Normal Inner Class (Non-Static Inner Class) Static Inner Class Anonymous Inner Class 1. Normal Inner Class (Non-Static Inner Class) Inner class is a class that is declared within the outer class. It can access the outer class's methods and variables, even if it is private. Example: class Outer {     private String message = "Hello from Inner Class!";     class Inner {         public void showMessage() {             System.out.println(me...

Blocking and Non-Blocking Operations

Image
Blocking Operations In blocking operations program must wait for a task to complete before moving on to the next task. While it waits, nothing can be happened to the program because it is blocked until the current task is completed.           Real-World Example :- In banks, while we are waiting in the queue we must wait for the person                infront to complete his transaction, we cannot move forward until the person infront completes his            tasks. Non-Blocking Operations In non-blocking operations , it allows a program to engage in other tasks while waiting for the operations to finish. It doesn't block other programs from running. The program has the ability to move forward immediately without waiting for the operation to finish.          Real-World Example :- In a restaurant, while ordering the food we can chat with friends, it is not ...