Day 14 · 1 Hour
LLM for Development
GitHub Copilot made devs 55% faster — learn to use AI as your pair programmer.
🔥 Real-World Hook (0–5 min)
GitHub Copilot made developers 55% faster in Microsoft's study. Developers who use AI write better tests, catch more bugs, and deliver features faster.
But the developers who get replaced aren't those who use AI — they're those who don't. Today you learn to use LLMs as a pair programmer that never sleeps and knows every framework.
🤖 LLM as Your Coding Partner (5–20 min)
💡 Mental Model
Think of an LLM as a very senior developer who:
✔ Has read every Stack Overflow answer ever written
✔ Knows Java, Spring, SQL, React, Docker, Git
✔ Never judges your questions
✔ But can be wrong — always verify critical code
Your job: ask precise questions. Get precise answers.
💻 Live Coding — Build a Feature with AI (20–40 min)
-- Prompt technique 1: Precise context "I have a Spring Boot app with a Student entity (id, name, email, dept, gpa). Write a JPA repository method that finds all students in a given department with GPA above a threshold, sorted by GPA descending." -- Prompt technique 2: Explain existing code "Explain this Spring Boot code line by line: [paste your code]" -- Prompt technique 3: Debug with AI "I'm getting this error: [paste error] Here's my code: [paste code] What's wrong and how do I fix it?" -- Prompt technique 4: Generate tests "Write JUnit 5 tests for this Spring Boot service method: [paste method] Include edge cases: null input, empty list, duplicate email."
🔭 Build an AI-Powered Chat Feature
// Spring Boot endpoint calling Groq API (free LLM) @Service public class AiService { @Value("${groq.api.key}") private String apiKey; private final RestTemplate rest = new RestTemplate(); public String ask(String question) { var headers = new HttpHeaders(); headers.setBearerAuth(apiKey); headers.setContentType(MediaType.APPLICATION_JSON); var body = Map.of( "model", "llama3-8b-8192", "messages", List.of(Map.of("role", "user", "content", question)) ); var resp = rest.postForObject( "https://api.groq.com/openai/v1/chat/completions", new HttpEntity<>(body, headers), Map.class ); return ((Map) ((List) resp.get("choices")).get(0)) .get("message").toString(); } }
🎯 You Code It (40–55 min)
- Sign up at console.groq.com — get a free API key (faster than OpenAI)
- Add the
AiServiceclass to your capstone project - Create an endpoint
POST /api/askthat accepts a question and returns an AI answer - Add a chat box to your frontend HTML — input + submit button + answer area
- Connect it to your
/api/askendpoint using fetch - Test: Ask "What are the top 3 Java interview questions?" — AI answers in your app!
📄 Day 14 Cheat Sheet — LLM for Dev
Best Prompt Patterns
| Give context first | "I have a Spring Boot app..." |
| Be specific | "Write JPA method for..." |
| Include constraints | "...sorted by GPA desc" |
| Paste the error | "I get this error: ..." |
| Ask for tests | "Write JUnit tests for..." |
| Ask for explanation | "Explain line by line" |
Free LLM APIs
| Groq API | Fastest, free tier, Llama3 |
| Claude API | Best for code, Anthropic |
| Gemini API | Google, free tier |
| Ollama (local) | Run on your laptop |
| GitHub Copilot | IDE integration, student free |
AI Tools for Java Dev
| GitHub Copilot | Code autocomplete in IDE |
| Claude.ai | Architecture & debugging |
| ChatGPT | General questions |
| Cursor IDE | AI-first code editor |
| TabNine | ML autocomplete |
When NOT to Trust AI
| Security-critical code | Review manually |
| Database migrations | Test in dev first |
| Payment logic | Write yourself + test |
| Cutting-edge APIs | AI may be outdated |
| Business logic | You know the domain |