# 090: AI Learning User Style # AI adapts to your coding preferences # After writing code for a while, AI learns your style # You prefer functional programming: numbers = [1, 2, 3, 4, 5] doubled = numbers.map(x => x * 2) evens = numbers.filter(x => x % 2 == 0) total = numbers.reduce((sum, x) => sum + x, 0) # AI notices and suggests functional style for new code: ### Intent: Filter active users and get their emails # AI suggests (matching your style): # active_emails = users # .filter(user => user.active) # .map(user => user.email) # Instead of imperative: # active_emails = [] # for user in users: # if user.active: # active_emails.append(user.email) # You prefer verbose variable names: user_email_address = "alex@example.com" is_email_verified = false total_purchase_amount = 0 # AI learns and suggests: ### Intent: Store user's phone number # Suggested variable name: user_phone_number (not just "phone") # You always add error handling: fetch_user_data(id): try: return fetch "/api/users/{id}" catch error: show "Error loading user" return null # AI learns pattern and auto-adds error handling to suggestions: ### Intent: Fetch product details # AI suggests (with error handling, matching your style): # fetch_product(id): # try: # return fetch "/api/products/{id}" # catch error: # show "Error loading product" # return null # Style preferences stored locally ai.get_learned_preferences() # Returns: # { # style: "functional", # naming: "verbose_snake_case", # error_handling: "always_try_catch", # comments: "minimal", # max_line_length: 80 # } # You can override per-project ai.set_preference("style", "object_oriented") # For this project only # AI becomes YOUR collaborator, not a generic one