Most developers learn Serialization in Java using Serializable — but that’s not how modern systems actually work. Serialization is simply converting an object into a format that can be stored or transferred, and deserialization is the reverse. Traditional approach in Java: - Serializable (marker interface) - ObjectOutputStream / ObjectInputStream This works, but has major drawbacks: - Not human-readable - Tight coupling between classes - Slower performance - Security concerns during deserialization Because of this, native Java serialization is rarely used in production today. Modern backend systems rely on different approaches: - JSON using libraries like and - Protobuf for high-performance communication - Avro for schema-based messaging systems - Kryo for faster serialization in specific use cases These approaches are: - Language-independent - Faster and more efficient - Easier to debug and maintain In , serialization and deserialization are handled automatically. When a controller returns an object, it is converted to JSON. When a request contains JSON, it is converted back into a Java object. Under the hood, this is handled by Jackson using ObjectMapper, which performs object-to-JSON and JSON-to-object conversion seamlessly. In microservices, serialization is used everywhere: - Service-to-service communication (REST/gRPC) - Messaging systems like Kafka or RabbitMQ - Caching systems like Redis Typical flow: Service A → JSON → HTTP → Service B Some common interview questions around this topic: Why is Serializable called a marker interface? It does not have methods; it simply signals the JVM that the class can be serialized. Why is native Java serialization avoided in microservices? Because of tight coupling, performance issues, and security risks. What is serialVersionUID? It is used for version control during deserialization. What happens if a field is marked transient? That field will not be serialized. How does Spring Boot handle serialization automatically? Using HttpMessageConverters with Jackson internally. Key takeaway: Understanding Serializable is important for fundamentals, but real-world systems rely on JSON or binary formats like Protobuf. If you are working with Spring Boot or microservices, this is a core concept you should be comfortable with. #Java #SpringBoot #Microservices #BackendDevelopment #SystemDesign
Java Serialization: Beyond Serializable
More Relevant Posts
-
Java Backend Developer – 2nd Round Interview These 20 questions separate good developers from great ones. 1. How does the G1 Garbage Collector work? What are regions, and how does it decide what to collect? 2. What is a memory leak in Java? Walk through how you’d detect and fix one in production. 3. How does ReentrantLock differ from synchronized? When would you prefer one over the other? 4. Explain happens-before in Java Memory Model. Why does it matter in multithreaded code? 5. How does Spring’s @Transactional handle rollback internally? What are common pitfalls? 6. What is the difference between REQUIRED, REQUIRES_NEW and NESTED propagation in transactions? 7. How would you implement distributed locking across microservices? 8. How does Hibernate’s first-level vs second-level cache work? When does it hurt you? 9. Explain the N+1 problem in JPA. How do you detect and fix it? 10. How would you design an idempotent REST API? Why does it matter? 11. How does database connection pooling work? How do you tune HikariCP for high throughput? 12. What is eventual consistency? How would you handle it in a microservices architecture? 13. How do you implement optimistic vs pessimistic locking? When would you use each? 14. How would you design a rate limiter for a public API? 15. What is the Saga pattern? How does it compare to 2PC for distributed transactions? 16. How would you secure inter-service communication in a microservices setup? 17. How does Kafka ensure message ordering and exactly-once delivery? 18. How would you design a system that processes 1 million requests per day without downtime? 19. How do you do zero-downtime deployment for a Spring Boot service running in Kubernetes? 20. Your service’s p99 latency spiked from 80ms to 2s overnight. Walk me through your debugging process. Preparing for interviews? Start revising these today 𝗜’𝘃𝗲 𝗽𝗿𝗲𝗽𝗮𝗿𝗲𝗱 𝗶𝗻 𝗗𝗲𝗽𝘁𝗵 𝗝𝗮𝘃𝗮 𝗦𝗽𝗿𝗶𝗻𝗴𝗯𝗼𝗼𝘁 𝗯𝗮𝗰𝗸𝗲𝗻𝗱 𝗚𝘂𝗶𝗱𝗲, 𝟏𝟬𝟬𝟬+ 𝗽𝗲𝗼𝗽𝗹𝗲 𝗮𝗿𝗲 𝗮𝗹𝗿𝗲𝗮𝗱𝘆 𝘂𝘀𝗶𝗻𝗴 𝗶𝘁. 𝗚𝗲𝘁 𝘁𝗵𝗲 𝗴𝘂𝗶𝗱𝗲 𝗵𝗲𝗿𝗲: https://lnkd.in/dfhsJKMj keep learning, keep sharing ! #java #backend #javaresources
To view or add a comment, sign in
-
💡Functional Interfaces in Java — The Feature That Changed Everything When Java 8 introduced functional interfaces, it quietly transformed the way we write code. At first, it may look like “just another interface rule” — but in reality, it unlocked modern Java programming. 🔹 What is a Functional Interface? A functional interface is simply an interface with exactly one abstract method. @FunctionalInterface interface Calculator { int operate(int a, int b); } That’s it. But this “small restriction” is what makes lambda expressions possible. 🔹 Why Do We Need Functional Interfaces? Before Java 8, passing behavior meant writing verbose code: Runnable r = new Runnable() { @Override public void run() { System.out.println("Running..."); } }; Now, with functional interfaces: Runnable r = () -> System.out.println("Running..."); 👉 Cleaner 👉 More readable 👉 Less boilerplate 🔹 The Real Power: Passing Behavior Functional interfaces allow us to pass logic like data. list.stream() .filter(x -> x % 2 == 0) .map(x -> x * 2) .forEach(System.out::println); Instead of telling Java how to do something, we describe what to do. This is called declarative programming — and it’s a game changer. 🔹 Common Built-in Functional Interfaces Java provides powerful utilities in "java.util.function": - Predicate<T> → condition checker - Function<T, R> → transformation - Consumer<T> → performs action - Supplier<T> → provides value 🔹 Why Only One Abstract Method? Because lambda expressions need a clear target. If multiple abstract methods existed, the compiler wouldn’t know which one the lambda refers to. 👉 One method = One behavior contract 🔹 Real-World Impact Functional interfaces are everywhere: ✔ Stream API ✔ Multithreading ("Runnable", "Callable") ✔ Event handling ✔ Spring Boot (filters, callbacks, transactions) ✔ Strategy pattern 🔹 Key Takeaway Functional interfaces turned Java from: ➡️ Object-oriented only into ➡️ Object-oriented + Functional programming hybrid 🔁 If this helped you understand Java better, consider sharing it with your network. #Java #FunctionalProgramming #Java8 #SoftwareDevelopment #Backend #SpringBoot #Coding
To view or add a comment, sign in
-
-
java interview questions 🔹 Core Java & OOP - Explain OOP principles. - Difference between Abstract Class and Interface. - Difference between final, finally, and finalize. - How do you create an immutable object? - String vs StringBuilder vs StringBuffer. - Types of exceptions in Java. - How do you handle NullPointerException? 🔹 Java 8 & Best Practices - How to handle null checks using Optional in Java 8? - How to handle null checks using annotations (e.g., @NotNull, @NotBlank)? 🔹 Multithreading & Concurrency - If two threads are using the same resource, how will you handle it? 🔹 Spring Boot & Backend Development - How to validate incoming JSON requests? - What is Spring Cloud? How is it useful? - How do you handle exceptions in a Spring Boot application? - Difference between @Component, @Service, and @Repository. - How do microservices communicate with each other? - What are the different HTTP methods used in REST APIs? - What is API versioning? 🔹 Design & Architecture - Explain SOLID principles. - Singleton vs Prototype scope. - What is Dependency Injection? - Explain the Repository Pattern. 🔹 Database & Persistence - JPA vs Hibernate. - How do you establish a database connection in Spring Boot? - What are stored procedures? - How do you optimize database queries? - Lazy vs Eager loading. 🔹 Testing & Tools - Difference between @Mock and @MockBean. - Which version control tool are you using? - How do you handle merge conflicts while pushing code to a developer branch? - Have you used Jenkins? Why is it used? 🔹 AI in Development - Are you using AI tools for coding? - What are their pros, cons, and risks? - How do you validate AI-generated code? #Java #SpringBoot #Microservices #BackendDeveloper #InterviewPreparation #TechInterview #JavaDeveloper #SoftwareEngineering
To view or add a comment, sign in
-
Functional style in Java is easy to get subtly wrong. This post walks through the most common mistakes — from returning null inside a mapper to leaking shared mutable state into a stream — and shows how to fix each one. https://lnkd.in/ey-7r7BW
To view or add a comment, sign in
-
JAVA MASTERY CHECKLIST FOR 2026 1 → Understand what Java is and where it’s used 2 → Install JDK and set up your development environment 3 → Learn how Java code is compiled and executed (JVM, JRE, JDK) 4 → Write your first Java program 5 → Understand variables and data types 6 → Learn operators and expressions 7 → Master conditional statements (if, switch) 8 → Use loops effectively (for, while, do-while) 9 → Understand methods and parameters 10 → Practice basic problem-solving in Java 11 → Learn Object-Oriented Programming (OOP) fundamentals 12 → Understand classes and objects 13 → Master encapsulation 14 → Learn inheritance and method overriding 15 → Understand polymorphism (compile-time & runtime) 16 → Use abstraction (abstract classes, interfaces) 17 → Learn constructors and method overloading 18 → Understand access modifiers 19 → Practice designing simple OOP systems 20 → Write clean, modular code 21 → Master Java Collections Framework 22 → Use Lists, Sets, and Maps effectively 23 → Understand ArrayList, HashMap, HashSet 24 → Learn iterators and loops over collections 25 → Understand generics 26 → Learn sorting and searching algorithms 27 → Work with streams and lambda expressions 28 → Practice functional programming basics 29 → Handle nulls and Optional properly 30 → Optimize collection usage 31 → Learn exception handling (try-catch-finally) 32 → Create custom exceptions 33 → Understand checked vs unchecked exceptions 34 → Learn file handling (I/O streams, NIO) 35 → Read and write files efficiently 36 → Understand serialization 37 → Work with dates and time (java.time API) 38 → Debug Java applications effectively 39 → Use logging frameworks (Log4j, SLF4J) 40 → Write robust and error-safe programs 41 → Learn multithreading and concurrency 42 → Understand threads and thread lifecycle 43 → Use synchronization and locks 44 → Work with Executors and thread pools 45 → Understand async programming 46 → Build REST APIs using Spring Boot 47 → Learn dependency injection (Spring) 48 → Connect Java apps to databases (JDBC, JPA, Hibernate) 49 → Build real-world backend applications 50 → Prepare for interviews and system design with java
To view or add a comment, sign in
-
-
Multithreading in Modern Java: Advanced Benefits and Best Practices Multithreading has always been one of core strengths of Java over years. From the early days of the JVM, Java was designed with built-in support for concurrent programming. But for many years, writing scalable multithreaded applications required careful tuning, thread pool management and constant attention to synchronization. In the latest Java versions, the concurrency model has evolved significantly. Modern Java introduces improvements such as Virtual Threads, better executors, improved fork-join performance and more structured concurrency approaches. These features allow developers to build highly concurrent applications with simpler code and fewer scalability limitations. #marketing #seo #socialmedia #marketresearch
To view or add a comment, sign in
-
🤔6 Ways to Create Objects in Java — and what actually matters in real projects When we start Java, we learn only one way to create objects: using new. But later we discover there are multiple ways — which gets confusing quickly. 1️⃣ Using the new keyword Student s = new Student(); This is the normal and most common way. Pros✅ · Simple and fast · Easy to understand · Compile-time safety Cons❌ · Creates tight coupling between classes › Industry usage: Used everywhere. This is the default way in day-to-day coding. 2️⃣Using Class.newInstance() Old reflection method. Pros✅ · Historical method Cons❌ · Deprecated since Java 9 · Should not be used anymore › Industry usage: Obsolete. 3️⃣Using Reflection (Constructor.newInstance()) Frameworks can create objects dynamically at runtime using reflection. Pros✅ · Can create objects dynamically · Useful when class name is not known beforehand Cons❌ · Slower than new · Complex and exception-heavy · Harder to debug › Industry usage: Used heavily inside frameworks like Spring and Hibernate, not in daily coding. 4️⃣ Using Deserialization Objects recreated from stored data. Pros✅ · Useful for caching and distributed systems · Helps in data transfer between systems Cons❌ · Security risks if misused · Rare in beginner-level projects › Industry usage: Used in backend infrastructure and large systems. 5️⃣ Using clone() Creates a copy of an existing object. Pros✅ · Fast copying of objects Cons❌ · Confusing (shallow vs deep copy) · Considered bad practice today › Industry usage: Rarely used now. 6️⃣Dependency Injection (DI) Frameworks (like Spring Boot) create objects and give them to your classes automatically. Example idea: Instead of creating objects manually, the framework injects them for you. Pros✅ · Loose coupling · Easier testing · Better architecture for big apps Cons❌ · Requires framework setup · Can feel confusing initially › Industry usage: This is the most used approach in modern backend development. 🚀 Final Reality Check Used daily: · new keyword · Dependency Injection (Spring Boot) Used internally by frameworks: · Reflection · Deserialization Avoid: · clone() · Class.newInstance() #Java #Programming #SpringBoot #BackendDevelopment #LearningJourney
To view or add a comment, sign in
-
-
CQRS in Java: Separating Reads and Writes Cleanly. As systems grow in complexity, keeping read and write operations separate can significantly improve performance and maintainability. In this article, Mike LaSpina breaks down the Command Query Responsibility Segregation (CQRS) pattern and shows how to implement it cleanly in Java applications. You'll learn: • The core principles behind CQRS • When to use this pattern (and when not to) • Practical implementation examples • How it scales with your application needs Whether you're dealing with high-traffic systems or just looking to improve your architecture, this guide offers practical insights you can apply right away. Read the full article here: https://lnkd.in/e8bUV_ji #Java #CQRS #SoftwareArchitecture #CleanCode
To view or add a comment, sign in
-
🚀Stream API in Java - Basics Every Developer Should Know When I started using Stream API, I realized how much cleaner and more readable Java code can become. 👉Stream API is used to process collections of data in a functional and declarative way. 💡What is a Stream? A stream is a sequence of elements that support operations like: ->filtering ->mapping ->sorting ->reducing 💠Basic Example List<String> list = Arrays.asList("Java", "Python", "Javascript", "C++"); list.stream().filter(lang-> lang.startsWith("J")) .forEach(System.out : : println); 👉 outputs :Java, Javascript 💠Common Stream Operations ☑️filter() -> selects elements ☑️map() -> transforms data ☑️sorted() -> sorts elements ☑️forEach() -> iterates over elements ☑️collect() -> converts stream back to collection 💠Basic Stream Pipeline A typical stream works in 3 steps: 1. Source -> collection 2. Intermediate Operations -> filter, map 3. Terminal operation -> forEach, collect ⚡Why Stream API? . Reduces boilerplate code . Improves readability . Encourages functional programming . Makes data processing easier ⚠️Important Points to remember . Streams don't store data, they process it . Streams are consumed once . Operations are lazy (executed only when needed) And Lastly streams API may seem confusing at first, but with practice it becomes a go-to tool for working with collections. #Java #StreamAPI #JavaDeveloper #Programming #SoftwareEngineering #BackendDevelopment #LearningInPublic
To view or add a comment, sign in
-
-
10 Mistakes Java Developers Still Make in Production Writing Java code is easy. Writing Java code that survives production traffic is a different skill. Here are 10 mistakes I still see in real systems. 1. Using the wrong collection for the workload Example: - LinkedList for frequent reads - CopyOnWriteArrayList for heavy writes Wrong collection choice silently kills performance. 2. Ignoring N+1 query issues Everything looks fine in local. Production becomes slow because one API triggers hundreds of DB queries. 3. No timeout on external calls One slow downstream API can block request threads and take down the whole service. 4. Large @Transactional methods Putting too much logic inside one transaction increases lock time, DB contention, and rollback risk. 5. Blocking inside async flows Using @Async or WebFlux but still calling blocking DB/API code defeats the whole purpose. 6. Treating logs as observability Logs alone are not enough. Without metrics, tracing, and correlation IDs, debugging production becomes guesswork. 7. Thread pool misconfiguration Too many threads = context switching Too few threads = request backlog Both can hurt latency badly. 8. Bad cache strategy Caching without TTL, invalidation, or size control creates stale data and memory problems. 9. Not designing for failure No retries, no circuit breaker, no fallback. Everything works... until one dependency slows down. 10. Optimizing without measuring Most performance “fixes” are guesses. Always profile first. Then optimize. Final Thought Most production issues don’t come from advanced problems. They come from basic decisions made at the wrong place. #Java #SpringBoot #Microservices #BackendEngineering #Performance #SystemDesign #SoftwareEngineering
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development