Where should we load initial data in Jetpack Compose? 🤔 It sounds like a simple question, but the answer has massive implications for how your app handles screen rotations and unit testing. I recently studied the different architectural patterns for this (inspired by insights from Philipp Lackner). To solidify my understanding, I fed my notes into Google NotebookLM. It generated this visual guide comparing the three main approaches: 1️⃣ The "UI Trigger" (LaunchedEffect) Great for testing, but it re-loads data unnecessarily every time you rotate the screen. 2️⃣ The "Constructor Trigger" ("init" block) Solves the rotation issue, but creates side effects in the constructor, making unit tests a nightmare to manage. 3️⃣ The Winner: stateIn + onStart 🏆 NotebookLM helped me visualize why this is the definitive answer. By using the onStart operator with SharingStarted.whileSubscribed(x seconds), you get the best of both worlds: ✅ No re-fetching on rotation. ✅ Full control in unit tests. ✅ Auto-refresh if the app is backgrounded for a long time. Swipe through the document below to see the full breakdown and code examples. 👇 It is amazing how AI tools like NotebookLM can help synthesize complex engineering concepts into clear, actionable summaries. #AndroidDev #JetpackCompose #NotebookLM #MobileSystemDesign #Kotlin #AI
Jetpack Compose Data Loading Strategies Compared
More Relevant Posts
-
Coming up from a days-long deployable no-code retrieval augmented generation (RAG) deep dive I have to shout out Lovable. This is a codebase architecture diagram of a working Policy RAG Assistant built with lovable this morning over coffee. If you're looking into RAG systems, giving a new lovable project this image is probably the path of least resistance. Google's AI Studio only stores uploads to builds for 48 hours, but has a RAG template called "Ask the Manual" that runs a filesearch store, but it's not deployable without vercel or similar. Lovable: https://lovable.dev Ask the Manual is on this page: https://lnkd.in/gzNZUApq #buildwithai #vibecoding #RAG
To view or add a comment, sign in
-
-
Our JetBrains IDEs recently got next edit suggestions (NES) added to them! NES offers intelligent recommendations for edits across your entire file – not just the next line of code. Here how it can look in the #UnrealEngine code base, for example. NES understands the intent behind the original completion, namely that you’re adding new death-related logic after the character’s health has been reduced. Isn't it cool? Find it already in Rider 2025.3.1! Try out and let us know when it grasps your ideas in the most and the least accurate ways. We are eager to learn more cases to adjust our evals. And if some of you still feel that you are better w/o all of these AI suggestions - the cheatsheet here on how to adjust IDE for your preferences can be useful: https://lnkd.in/eFFkEz3C
To view or add a comment, sign in
-
-
GenAI Learning – Day 12 Today I studied how a RAG (Retrieval Augmented Generation) pipeline actually works in practice 👇 Simple flow: 1️⃣ User query 2️⃣ Convert query into embeddings 3️⃣ Retrieve relevant data from vector DB 4️⃣ Inject context into prompt 5️⃣ LLM generates final response This approach makes AI responses more accurate, updated, and trustworthy compared to using LLMs alone. RAG is quickly becoming the default architecture for production GenAI apps. #GenAI #RAG #LLM #AIArchitecture #LearningInPublic
To view or add a comment, sign in
-
🚀 From Code to Coach: Launched a RAG-Powered AI Fitness Assistant! I have just finished deploying a Retrieval-Augmented Generation (RAG) chatbot that serves as a personalized Fitness and Health Coach 💪. This application, built on Mesop 💻 and FastAPI, is designed to pull answers directly from a user's private documents, ensuring hyper-contextual advice. 💡Key Technologies Implemented: ⚙️ Integrated Groq's high-speed inference engine ⚡, leveraging the llama-3.3-70b-versatile model, for ultra-low-latency final response generation. 💾 Utilized ChromaDB for vector storage and LangChain's memory 🧠 for robust, coherent query orchestration. Architecture: Built on Mesop for the front-end UI and FastAPI for the API backbone. A successful challenge in optimizing for latency and stability 🛡️ in an AI application! #Python #AI #RAG #LLM #Groq #LangChain #FastAPI #SoftwareEngineering
To view or add a comment, sign in
-
🚀 Weekend Hack: Turning Tab Nightmares into Power Launchers Forked a three-month-old repo today called Tabby and gave it a serious upgrade — added AI, new columns, delete functions, and arrow-key navigation. The goal? To finally escape tab chaos and make organizing your browser effortless — without losing control to auto-sorting. Think of it as a launcher for your browser tabs — fast, manual, and smart. Currently works in Chrome, but I’ve got plenty more coming. Stay tuned — this might be your new favorite productivity tool. #AI #WebDevelopment #Productivity #ChromeExtensions #IndieDev
To view or add a comment, sign in
-
-
The problem is that we conflate GenAI with machine learning. There are loads of great examples of using machine learning, it's just GenAI that is sold as a silver bullet. In software engineering it creates more work and overly verbose code and PR reviews. We should keep an eye on the usability.
To view or add a comment, sign in
-
🗺️ How Google Maps Uses A* Algorithm for Optimized Routing Ever wondered how Google Maps finds the fastest route in seconds, even across thousands of roads? Behind the scenes, it’s not just “searching roads” — it’s applying a powerful graph algorithm called A* ⭐ 🔹 The Map Is a Graph Intersections → Nodes Roads → Edges Travel time / distance → Edge weight The problem becomes simple (but massive): 👉 Find the shortest path between two nodes. 🔹 Why Not Just Dijkstra? Dijkstra’s Algorithm explores all possible shortest paths, which works… But when the graph is huge (entire cities), it’s slow. Google Maps needs speed ⚡ 🔹 Enter A* (A-Star) Algorithm A* is smarter because it uses a heuristic — a best guess of how far you are from the destination. 📌 Formula: f(n) = g(n) + h(n) g(n) → Cost from start to current node h(n) → Estimated cost from current node to destination (usually straight-line distance) This helps A* focus only on promising routes, instead of blindly exploring everything. 🔹 Why A* Is Perfect for Maps ✅ Finds the shortest path ✅ Much faster than Dijkstra ✅ Scales well for large road networks ✅ Uses Priority Queue (Min Heap) internally That’s why it’s widely used in: Navigation apps Games (NPC pathfinding) Robotics & AI 🔹 Real-World Optimization Google Maps doesn’t stop at A*: Traffic data adjusts edge weights 🚦 Road closures remove edges ❌ Multiple heuristics help find fastest, not just shortest routes 💡 Key DSA Takeaway A* shows how graphs + heaps + heuristics turn theory into products used by millions daily. DSA isn’t about solving problems — It’s about building intelligent systems. #DSA #DataStructures #Algorithms #GraphAlgorithms #AStarAlgorithm #GoogleMaps #ProblemSolving #SoftwareEngineering #ComputerScience #CodingLife #TechBehindTheScenes #DeveloperCommunity #Programming #CodingJourney #CSConcepts #EngineeringLife #LearnToCode #MERNDeveloper #InterviewPrep
To view or add a comment, sign in
-
-
AI isn't a replacement for a coach. It’s a tool for architecture. 🏎️ 💻 Mid-December was a blur. We set out with a massive goal: prove that Google’s Gemini 3 model family could act as a real-time performance coach for a race car driver, live on the track. We had one week. We had a professional driver. And we had a hypothesis: An individual developer, armed with the right AI tools, can build production-grade software at F1 speeds. It wasn't a straight line. We hit the wall—literally and metaphorically. 🚫 The Physics Wall: React’s reconciliation was too slow for 60FPS telemetry. 🚫 The Latency Wall: You can’t tell a driver to "brake harder" 500ms after they’ve missed the apex. The breakthrough wasn’t a better prompt. It was an architectural pivot we called "The Bypass." We realized we didn't need an LLM for split-second math. We re-architected the system into tiers: - Hot Path: Deterministic code for zero-latency physics (The Bypass). - Warm Path: Gemini Nano running locally in Chrome for immediate tactical feedback. - Cold Path: Gemini Pro for deep, post-run strategic analysis. The result? A "Glass Cockpit" that ran buttery smooth and an AI that actually understood the difference between a "hallucination" and a hairpin turn. I wrote a deep dive into the code, the crash (of the codebase), and the "don't be a wuss" prompt engineering that saved the project. 📖 Read the full technical story: https://lnkd.in/gqMeXbgx A huge shoutout to the team and Thunderhill Raceway for letting us turn their track into a laboratory. #GoogleGemini #SoftwareEngineering #RealTimeAI #Motorsport #GeminiNano #WebDev #Architecture
To view or add a comment, sign in
-
-
I was testing an AI feature and started thinking about the input side, not the output. Most demos focus on what the model generates. I wanted to look at what happens before the model runs. So I built a small demo project called Prompt Safety Checker 🛡️ It uses LlamaGuard to check user input first, and then decides how to handle it. The idea is straightforward: - user input is checked before reaching the LLM - based on that signal, the system decides what to do next I added three simple modes: - Strict → block the input - Balanced → warn but allow - Log-only → allow and observe The screenshot shows a prompt-injection style input that tries to override retrieved documents in a RAG system. Even though the wording looks calm, the intent is to bypass instruction.. If you’re building with LLMs, how do you usually handle inputs that shouldn’t be answered? 🔗 GitHub: https://lnkd.in/gVR3VKj4
To view or add a comment, sign in
-
-
One hard question I ask every AI team now: “How many files break if you change your primary model tomorrow?” For most, the answer is “too many,” because every provider has its own SDK, formats, auth, and billing rules baked directly into the codebase. With CometAPI, we flipped that pattern: one unified, OpenAI-style interface in your app, hundreds of models and providers behind it, so “switching” is usually just changing the model string and a few parameters instead of rewriting workflows. That kind of agility matters when a new model drops every week, prices shift overnight, or a provider hits rate limits—you can A/B test, failover, or migrate for cost and performance without pausing development or retraining your team on yet another dashboard. If you had true plug-and-play model switching today, what’s the first thing you’d change in your stack: provider, model family, or cost tier?
To view or add a comment, sign in
For those wanting the deep dive, here is the original video by Philipp Lackner that inspired this cheat sheet: https://www.youtube.com/watch?v=mNKQ9dc1knI