Saquib Aftab

5.8K posts

Saquib Aftab banner
Saquib Aftab

Saquib Aftab

@iamsaquibdev

Lead Software Engineer | ❤️ Programmer I demystify Java, Spring Boot, and System Design.

localhost:8080 Katılım Ekim 2023
455 Takip Edilen4.3K Takipçiler
Saquib Aftab
Saquib Aftab@iamsaquibdev·
What are Java Records? Java records were introduced as a preview feature in Java 14 (JEP 359) and finally released as a permanent feature in Java 16 (JEP 395).  A record is a special type of class designed to hold immutable data. public record Product(String name, double price) {} Here, a single line of code will help with private final fields, a constructor that takes all the fields, getter methods, and auto-generated toString(), equals(), and hashCode() methods.
English
0
0
2
23
Saquib Aftab
Saquib Aftab@iamsaquibdev·
Java Spring Security Concepts: CORS and CSRF ✅ CORS (Cross-Origin Resource Sharing) What it is: A browser mechanism that *restricts* which origins can read responses from your server. The problem it solves: By default, browsers block frontend JavaScript on site-a. com from reading responses from site-b. com. CORS is a way for the server to selectively relax that restriction. How it works: 1. Browser sends a request with an Origin header 2. For non-simple requests, it first sends a preflight(OPTIONS) request 3. Server responds with Access-Control-Allow-Origin, Access-Control-Allow-Methods, etc. 4. The browser either allows or blocks the JS from reading the response CSRF (Cross-Site Request Forgery) What it is: An attack where a malicious site tricks a user's browser into making authenticated requests to your server without the user's knowledge. The problem it solves (must be defended against): A user logged into bank. com visits evil. com, which silently submits a form to bank. com/transfer. The browser auto-attaches the session cookie, and the server can't tell that it wasn't a legitimate request.
Saquib Aftab tweet media
English
1
5
28
622
Saquib Aftab
Saquib Aftab@iamsaquibdev·
Spring Security Concepts: OAuth2 Resource Server ✅ With a single OAuth2ResourceServer declaration, Spring Security will: 1. Extract the Authorization: Bearer header from every request 2. Validate the token’s signature against your Authorization Server’s public key (fetched via JWKS URI) 3. Check expiry, issuer, and audience claims 4. Populate the SecurityContext with the authenticated principal
Saquib Aftab tweet media
English
0
9
53
7K
Saquib Aftab
Saquib Aftab@iamsaquibdev·
How to get Values from Optional? Optional provides several methods for getting a value.
Saquib Aftab tweet media
English
0
5
26
1.8K
Saquib Aftab
Saquib Aftab@iamsaquibdev·
8 Backend Skills Every Developer Should Master ✅ - Understanding How APIs Really Work - Writing Clean and Maintainable Code - Understanding System Design Basics - Code Testing - Performance Optimization - Database designs that scale - Error Handling and Logging - Authentication & Authorization
English
0
2
10
533
Saquib Aftab
Saquib Aftab@iamsaquibdev·
Every Java Backend Developer Should Master These Security Concepts ✅ [Part 1] As a Java backend developer, we write APIs, handle user data, and build systems that people trust. One gap in your security knowledge can expose the users to serious issues. 1. Authentication vs. Authorization 2. Password Hashing 3. JSON Web Tokens (JWT) 4. Public and Private Keys (Asymmetric Cryptography) 5. SQL Injection Prevention Full Article: medium.com/javarevisited/…
English
0
5
37
9.1K
Saquib Aftab
Saquib Aftab@iamsaquibdev·
Security Concepts #1: Authentication vs. Authorization ✅ These two concepts are often confused, but they are very different. - Authentication: Verifying who the user is. (Are you really who you say you are?) - Authorization: Verifying what the user can do. (Do you have permission to access this?) Authentication says: Are you really who you say you are? Authorization says: Do you have permission to access this? Authentication always comes first. A user logs in with a username and password for authentication. Once authenticated, the system checks if they can access a specific resource. This is authorization.
Saquib Aftab tweet media
English
0
4
51
8.2K
Saquib Aftab
Saquib Aftab@iamsaquibdev·
What is the Chain of Responsibility Design Pattern and How to Use it? Chain of Responsibility is a behavioral design pattern that lets us pass a request through a chain of handlers. Each handler decides whether to process the request or pass it to the next one. Full Article: medium.com/javarevisited/…
English
0
1
12
406
Saquib Aftab
Saquib Aftab@iamsaquibdev·
Advantages of Single Responsibility Principle Pattern 👉 ➡️Single Responsibility: Each handler does one thing. ➡️Open/Closed Principle: We can add new handlers without changing existing ones. ➡️Flexible chains: We can reorder, add, or remove handlers at runtime. ➡️Decoupled code: The sender doesn’t need to know which handler will process the request. Disadvantages of the Single Responsibility Principle Pattern 👉 ➡️A request might go unhandled if no handler in the chain matches. ➡️Long chains can make debugging tricky. ➡️The order of handlers matters. A wrong order can lead to incorrect behavior. ➡️It can be hard to trace where a request was handled without proper logging.
English
0
6
30
19.4K
Saquib Aftab
Saquib Aftab@iamsaquibdev·
RabbitMQ Routing ✅ • Direct exchange: Exact match. • Fanout exchange: Broadcast. • Topic exchange: Pattern matching. • Headers exchange: Based on headers. • Bind queues to exchanges.
English
0
1
6
182
Saquib Aftab
Saquib Aftab@iamsaquibdev·
How to Prevent Hitting Claude Usage Limits? 1. Start with a short, clear prompt. 2. Put only one task or one topic in a chat. 3. Batch related questions together. 4. Use the lightest model that fits the task. 5. Upload smaller, cleaner files. 6. Use Projects for repeated work. 7. Turn off extra tools when not needed. 8. Start a new chat when the topic changes. #Claude #ClaudeCode #Software
Saquib Aftab tweet media
English
0
4
13
465
World of Statistics
World of Statistics@stats_feed·
🇯🇵 The percentage of female IT engineers in Japan is only 19.5%.
English
55
14
385
37.3K
Saquib Aftab retweetledi
Saquib Aftab
Saquib Aftab@iamsaquibdev·
Java Interview Question: How does garbage collection work in modern Java (G1GC vs ZGC)? ✅
Saquib Aftab tweet media
English
0
13
79
2K
Saquib Aftab
Saquib Aftab@iamsaquibdev·
Improve Your Development Workflow with These CLAUDE.md Tips ✅ Claude starts a fresh session every time. It knows nothing about our project. It does not remember the patterns you prefer, the tools we use, or the mistakes it made last week. That is exactly the problem CLAUDE.md solves. Full Article: @saquibdev/improve-your-development-workflow-with-these-claude-md-tips-abba9aff28e7" target="_blank" rel="nofollow noopener">medium.com/@saquibdev/imp…
English
0
0
4
306
Saquib Aftab
Saquib Aftab@iamsaquibdev·
The best code you'll write is the code you delete. Before adding a new feature, ask: "Can I solve this by removing something instead?" 👉 Complexity is the enemy of maintainability. Every line of code is a liability you'll have to maintain forever. ✅Sometimes doing less is actually doing more.
English
0
2
15
586
Saquib Aftab retweetledi
Saquib Aftab
Saquib Aftab@iamsaquibdev·
Interview Question: What is the difference between @ SpringBootApplication and @ EnableAutoConfiguration?
Saquib Aftab tweet media
English
0
6
33
677