🚀 Day 5 — RxJava (From Threads to Streams) Up until now, async in Android looked like this: • Run something in background • Switch to main thread • Repeat… again and again And when tasks depend on each other → nesting starts --- 👉 The real problem: It’s not just threads. It’s how we structure async flows --- 👉 Enter RxJava Instead of thinking in threads, you think in streams of data --- 👉 Example: Observable.fromCallable(() -> apiCall()) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(data -> textView.setText(data)); --- 👉 What changed: • No manual thread handling • No explicit thread jumping everywhere • You define the flow, not the execution steps --- 👉 Even better for dependent tasks: observable1 .flatMap(data1 -> apiCall2(data1)) .observeOn(AndroidSchedulers.mainThread()) .subscribe(result -> textView.setText(result)); --- 👉 Instead of nesting, you chain operations --- ✅ What improved: • Cleaner async flow (no callback hell) • Easy chaining of dependent tasks • Built-in thread switching • Powerful for complex operations --- ⚠️ What went wrong: • Steep learning curve • Hard to debug • Too many operators → confusing • Overkill for simple use cases --- 📉 Core Problem: RxJava solved complexity — but introduced cognitive overload You’re not fighting threads anymore, you’re fighting understanding --- ➡️ Why we moved forward: Developers needed: • Simpler syntax • Better readability • Easier debugging --- ➡️ Next: Coroutines (Simple, readable async without losing power) --- #AndroidDevelopment #RxJava #AsyncProgramming #MobileDevelopment #SoftwareEngineering #AndroidDev #Programming
RxJava Simplifies Async Flows in Android
More Relevant Posts
-
Most backend bugs in production aren't caused by bad code. They arise from assumptions that were never questioned during development. Common assumptions include: - "This API will always return data." - "The network will always be stable." - "No one will hit this endpoint 1000 times a minute." Defensive programming isn't pessimism; it's simply experience wearing a helmet. #BackendDevelopment #SoftwareEngineering #Java #LessonsLearned
To view or add a comment, sign in
-
Java isn’t part of my main stack, but learning widely used technologies helps in understanding system trade-offs and communicating across teams. Still more to explore, but useful exposure overall. For those building products or leading teams, what mature or “non-primary” technology have you learned recently just to understand the ecosystem better? • In Search of an Understandable Consensus Algorithm (Raft) https://lnkd.in/ggF3ezqd • Paxos Made Simple https://lnkd.in/gtj4FcM5 • Large-scale Incremental Processing Using Distributed Transactions and Notifications (Percolator) https://lnkd.in/gciRd_Nx • On the k-Atomicity-Verification Problem https://lnkd.in/gBQBD4Qx • Modular Composition of Coordination Services https://lnkd.in/gNYksbsu Always interesting to study the systems that shaped modern architecture patterns and backend design. #SpringBoot #Java #BackendDevelopment #SystemDesign #SoftwareArchitecture #RESTAPI #TechLearning #ContinuousLearning #StartupLearning #DeveloperCommunity
To view or add a comment, sign in
-
-
Is it a 6 or a 9? 👀 Two people. Same number. Different perspectives. In software development, I see this all the time: Frontend says it’s a bug. Backend says it’s working fine. Both are right — from their side. The real problem? Missing clarity. ✔ Align on the same data ✔ Check logs, payloads, contracts ✔ Remove ambiguity Because good engineering is not about arguing who is right — it’s about making things clear enough that no one has to argue. Have you faced this in your project? 🤔 #Angular #Java #Debugging #SoftwareEngineering #TeamWork
To view or add a comment, sign in
-
-
🚀 Day 12 – Runnable vs Callable (and why Future matters) While working with threads, I explored the difference between "Runnable" and "Callable". 👉 We often use "Runnable": Runnable task = () -> { System.out.println("Running task"); }; ✔ Doesn’t return any result ✔ Cannot throw checked exceptions --- 👉 Now "Callable": Callable<Integer> task = () -> { return 10; }; ✔ Returns a result ✔ Can throw checked exceptions --- 💡 So where does "Future" come in? Future<Integer> result = executor.submit(task); Integer value = result.get(); 👉 "Future" acts as a placeholder for the result of an asynchronous computation --- 💡 Key takeaway: - Use "Runnable" → when no result is needed - Use "Callable" → when you need result or exception handling This becomes very useful when working with ExecutorService in real applications. #Java #BackendDevelopment #Multithreading #Concurrency #LearningInPublic
To view or add a comment, sign in
-
Some weeks in tech, you don’t build anything new. You just investigate, monitor, restart, compare logs, ask questions, and slowly narrow down one issue. And honestly? That’s real engineering too. Not every productive week ends with a feature release. Sometimes it ends with better understanding. The more I work in backend systems, the more I realize: Building is exciting. Debugging builds experience. #BackendEngineering #Learning #Java
To view or add a comment, sign in
-
Day 7/60 – Backend Development Journey (Multithreading & Synchronization) Today I worked on Java Multithreading and understood how concurrent execution works along with synchronization. What I built Task 1: Parallel Execution: Created two threads to print numbers: • Thread 1 → prints 1 to 5 • Thread 2 → prints 6 to 10 Both run simultaneously using Runnable Task 2: Shared Counter with Synchronization: • Two threads increment a shared counter • Ensured correct final value using locking mechanism Key Concepts Applied 1. Multithreading Running multiple threads in parallel to improve performance. Example 1: • Thread A → handles API requests • Thread B → processes background tasks Example 2: • Thread 1 → file download • Thread 2 → UI updates 2. Race Condition Multiple threads accessing shared data can cause incorrect results. Example 1: • Two threads incrementing the same variable → wrong count Example 2: • Bank balance updates → inconsistent values 3. Synchronization & Locking • Used ReentrantLock to ensure only one thread updates the counter at a time. 4. Thread Coordination • Used join() to wait for threads to finish before printing result. #Java #Multithreading #Concurrency #Threading #Synchronization
To view or add a comment, sign in
-
-
Built a Java AI agent that fixes bugs and creates PRs right from Slack. The key part? It asks for approval before doing anything significant. Still a side project. But the full flow is working. 🐙 https://lnkd.in/g4tv86h9 #Java #SpringBoot #AIAgents
To view or add a comment, sign in
-
Most developers think @Autowired is just dependency injection. It's not ❌ It's Reflection + Proxies + Runtime Wiring. Which means : ⭕ Dependencies are injected at runtime (not compile time) ⭕ You might be calling a proxy, not your actual class ⭕ Field injection hides dependencies and hurts testability ⭕ Startup time increases as your app grows The biggest surprise : 👉 this.method() can bypass Spring logic completely (broken @Transactional) Lesson : "Convenience annotations often hide real complexity." Do you still use Field Injection in production ? #SpringBoot #Java #BackendEngineering #SoftwareArchitecture
To view or add a comment, sign in
-
🚨 Java memory leaks are silent killers. Your app works fine… until it slowly becomes slower… and then crashes. The worst part? They’re often hard to detect. This video breaks down 10 real-world memory leak patterns and how to find them using heap dump analysis. 🎥 Watch here → https://lnkd.in/deYsA75x 👉 What’s the hardest bug you’ve debugged? #Java #PerformanceEngineering #Backend #DevOps #Perfology
To view or add a comment, sign in
-
-
Performance Tip for Developers 🚀 ❌ Don’t use loops inside loops unnecessarily ❌ Avoid multiple DB calls ❌ Don’t ignore caching ✅ Optimize queries ✅ Use indexing ✅ Write clean logic 💡 Small optimizations = big performance gains 👉 Follow for real dev tips #performance #coding #developers #backend #java #optimization #softwareengineer #tech #learning #trending
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