Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungRefreshed repository pull requests page generally available(22.09.2026 um 03:25 Uhr)
Sichere ProgrammierungThe Joy of Learning the Basics Again(22.09.2026 um 03:28 Uhr)
Sichere ProgrammierungZero-Code OpenTelemetry Tracing for Dagster(22.09.2026 um 03:39 Uhr)
Linux Tipps & Hardening`prime-all`(22.09.2026 um 02:28 Uhr)
IT Security Toolsopensoho v0.15.2(22.09.2026 um 03:33 Uhr)
IT Security NachrichtenUS Proposes AI Incident Alert System in Talks With China, Bessent Says(22.09.2026 um 04:01 Uhr)
Sichere ProgrammierungRefreshed repository pull requests page generally available(22.09.2026 um 03:25 Uhr)
Sichere ProgrammierungThe Joy of Learning the Basics Again(22.09.2026 um 03:28 Uhr)
Sichere ProgrammierungZero-Code OpenTelemetry Tracing for Dagster(22.09.2026 um 03:39 Uhr)
Linux Tipps & Hardening`prime-all`(22.09.2026 um 02:28 Uhr)
IT Security Toolsopensoho v0.15.2(22.09.2026 um 03:33 Uhr)
IT Security NachrichtenUS Proposes AI Incident Alert System in Talks With China, Bessent Says(22.09.2026 um 04:01 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Why Object-Oriented Programming Was Introduced - Objects and Classes

In the previous article, we examined the importance of software design, and how all software engineering principles have been defined to address issues rather than creating more complexity. In this article, we will begin with one of the…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

In the previous article, we examined the importance of software design, and how all software engineering principles have been defined to address issues rather than creating more complexity.



In this article, we will begin with one of the most significant programming paradigms known as Object Oriented Programming (OOP).



But before moving into definitions, let us examine the issue first.









🤯 The Problem



Imagine you are building a user system.



Without OOP:




const user1Name = "Ashay";
const user1Email = "[email protected]";

function loginUser1() {}
function logoutUser1() {}






Now imagine:




  • 10 users

  • 100 users

  • admins

  • customers

  • sellers



Everything becomes:




  • duplicated

  • disconnected

  • hard to manage



You have:




  • data scattered everywhere

  • behavior scattered everywhere



This is the core problem OOP tries to solve.









🧠 The Core Idea of OOP



OOP says:




"A real-world entity should keep its own data and behavior together."




Example:



A User should contain:




  • its own properties (name, email)

  • its own capabilities (login, logout)



That combination becomes an object.









✨ What is an Object REALLY?



An object is:




A self-contained unit of state + behavior.




State = data

Behavior = actions/functions



Example:




const user = {
name: "Ashay",
email: "[email protected]",

login() {
console.log(`${this.name} logged in`);
}
};






Here:
























Part Meaning
name/email state
login() behavior
combined together object


This is the true meaning of an object.









Then Why Do We Need Classes?



Now imagine creating 10,000 users.



You DON'T want:




const user1 = { ... }
const user2 = { ... }
const user3 = { ... }






You need a reusable structure.

That reusable structure is a class.





What is a Class REALLY?



A class is:




A factory/template that defines what an object should contain.




Example:




class User {
name: string;
email: string;

constructor(name: string, email: string) {
this.name = name;
this.email = email;
}

login() {
console.log(`${this.name} logged in`);
}
}






Now you can create objects easily:




const user1 = new User("Ashay","[email protected]");
const user2 = new User("Rahul","[email protected]");









Deep Understanding of new



This is VERY important.



When you do:




const user1 = new User(...)






new does several things internally:




  1. Creates empty object {}

  2. Connects object to class prototype

  3. Binds this to new object

  4. Runs the constructor

  5. Returns object









💡 Important Mental Model



A class is NOT the actual thing.



It is only:




  • definition

  • structure

  • contract



The object is the real runtime entity.



Example:




























Real World OOP
Building map Class
Actual house Object
Human DNA structure Class
Actual person Object








Common Beginner Mistake



People think:




class User {}






means “doing OOP”.



No.



Real OOP begins when you think:




  • What responsibility belongs here?

  • What data should this object own?

  • What should be hidden?

  • How should objects communicate?

  • Who controls what?



That leads to:




  • Encapsulation

  • Abstraction

  • Polymorphism

  • Dependency Injection

  • SOLID principles



which we’ll cover one by one.









⏭️ What's Next?



Now that we understand what OOP is and how classes and objects help organize state and behavior, an interesting question naturally arises especially for JavaScript developers.



If JavaScript already allows us to create objects using plain object literals and factory functions, why do we need classes at all?



Are classes simply syntactic sugar, or do they solve a different set of problems?



Before we dive into the core principles of OOP such as Encapsulation, Abstraction, Inheritance, and Polymorphism, we'll take a small detour to explore one of the most common debates in the JavaScript ecosystem:



Factory Functions vs Classes



We'll compare both approaches, understand their trade-offs, and discuss when each one makes sense in real-world applications.



Because before learning how to design good objects, it's worth understanding the different ways we can create them.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Why Object-Oriented Programming Was Introduced - Objects and Classes

Thematisch verwandte Begriffe: ObjectOriented, Programming, Introduced, Objects · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-49449 | Joplin is an open source note-taking and to-do application that organise…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick