Using Codex & Claude Code in a Real Task: A Practical Coding Example (2026)

Published: (December 3, 2025 at 12:07 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

If you read the previous post, you already have a general view of how Codex and Claude Code differ in approach. Now it’s time to put them into a real scenario, same problem, two solutions.

We asked both models to solve a simple but layered task:

Given a JSON list of users, return only the ones with "active": true.

Codex Output — Fast, Direct, Minimal Structure

import json

def get_active_users(data):
    users = json.loads(data)
    active = [u for u in users if u.get("active")]
    result = ""
    for u in active:
        result += f"{u['name']} - {u['email']}\n"
    return result

# Example usage
data = '[{"name": "Ana","email": "ana@mail.com","active": true},{"name": "Luis","email":"luis@mail.com","active": false}]'
print(get_active_users(data))

✔ Works and runs immediately

Codex is perfect if you want fast output and you’ll refine later.

Claude Code Output — Maintainable, Modular

import json
from typing import List, Dict

def parse_users(data: str) -> List[Dict]:
    """Safely parse JSON input into Python objects."""
    return json.loads(data)

def filter_active(users: List[Dict]) -> List[Dict]:
    """Return only active users."""
    return [u for u in users if u.get("active") is True]

def format_report(users: List[Dict]) -> str:
    """Generate a readable name + email report."""
    lines = [f"{u['name']} " for u in users]
    return "\n".join(lines)

def build_user_report(data: str) -> str:
    users = parse_users(data)
    active = filter_active(users)
    return format_report(active)

✔ Maintainable, commented, modular

Claude thinks like someone who shares this repo with a future team.

When to Use Each Approach

Use Codex if you need:

  • A fast function for a script or hackathon
  • To test logic quickly and move on
  • A starting point to optimize later

Use Claude Code when:

  • You know the file will grow
  • Multiple people will maintain the repo
  • You plan to add validation, testing, or roles later

Same problem, different philosophies.

🎥 Quick visual version available!

Back to Blog

Related posts

Read more »

Daily Tech News Roundup - 2025-12-06

Daily Tech News Roundup Welcome to your daily dose of tech news! Today, we're covering everything from bizarre art installations featuring robot dogs to the la...

Switching account

@blink_c5eb0afe3975https://dev.to/blink_c5eb0afe3975 As you guys know that I am starting to log my progress again I thought it would be best to do it on a diffe...