Skip to content
IT Vizag
← Objects & Classes

▶ Sign up free for the video, slides & prompts

The lesson below is open to all. Enter your email once to unlock every video, slide deck, prompt and code example on this device.

Checking…

AI angle: design classes with AI

Lesson 8 of 10 · 2 min read

Brainstorm a class design with AI, then simplify it.

🎬 Video version coming soon — read it now

Designing classes, deciding what becomes a class and what each one is responsible for, is harder than writing them. AI is a good brainstorming partner, but it tends to over-design. Your job is to simplify.

Brainstorm

🔒 Ready-to-copy prompt: sign up free (above) to unlock it.

Expect too much

AI answers often include things like LibraryManager, BookFactory, AbstractUser, Librarian(User), Notification... For a beginner project, most of that is unnecessary.

Ask yourself for each class:

  • Does it hold its own data? If not, maybe it's just a function.
  • Will there be several of them? One Library object is fine; a class just to group functions often isn't needed.
  • Is the inheritance a true "is a"? Or is it there just because it looks professional?

A sensible result

🔒 Code example: sign up free (above) to unlock it.

Three small classes. Add more only when a real need appears.

Ask AI to criticise, too

🔒 Ready-to-copy prompt: sign up free (above) to unlock it.

Asking for simpler gives much more useful feedback than asking for "better".

Always run it

Write a few lines that create objects and call each method. If something is awkward to use, the design needs to change, whoever suggested it.

Tip: Draw the classes as boxes on paper with arrows for "has a" and "is a" before coding. Five minutes of drawing saves an hour of refactoring.

In one line

Use AI to brainstorm class designs, then cut everything that doesn't hold its own data or serve a real need.

Saved on this device. Sign in to keep progress everywhere.

Share with a friend