DELAPARRA
Index
Color
NL
Category: Programming paradigms

Class

Explained by Updated

What is Class?

Class: A blueprint or template describing what an object looks like and what it can do. Like architectural plans — the plans are not a building, but you build from them. A class is a blueprint for objects. It describes what data an object holds, its properties, and what it can do, its methods. An Invoice class might hold a number, a customer and lines, and offer methods like total() and send().

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about Class

How is Class used in practice?

Each object created from the class is an instance with its own data. Two invoices share the same structure and behaviour but have different numbers and amounts.

What should you keep in mind with Class?

Good classes are focused. A class that handles invoices, sends emails, talks to the accounting system and builds PDFs is hard to test and hard to change. Split responsibilities so each class has one clear job. In frameworks like Laravel, models, controllers, jobs and services are all classes with a specific role, and keeping to those roles keeps a codebase easy to work in.

At a glance

CategoryProgramming paradigms
Explained by
Updated

More Programming paradigms terms

All terms starting with C

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.