🔧 AI Nachrichten How I’m using Codex and ChatGPT on my Mac(01.09.2026 um 00:00 Uhr)
🕵️ SicherheitslückenProFTPD mod_sql post-authentication SQLi RCE(06.09.2026 um 18:21 Uhr)
🕵️ Sicherheitslücken[remote] CVE-2026-42167 - ProFTPD mod_sql post-authentication SQLi - RCE(25.08.2026 um 02:00 Uhr)
🕵️ Sicherheitslücken[webapps] C-MOR 6.0104 - Cross-Site Scripting (XSS)(31.08.2026 um 02:00 Uhr)
🕵️ Sicherheitslücken[webapps] CubeCart 6.7.4 - Stored XSS(31.08.2026 um 02:00 Uhr)
🕵️ Sicherheitslücken[webapps] CubeCart 6.7.4 - Cross-Site Scripting(31.08.2026 um 02:00 Uhr)
🕵️ Sicherheitslücken[webapps] Langflow 1.8.4 - Path Traversal to Remote Code Execution(31.08.2026 um 02:00 Uhr)
🕵️ Sicherheitslücken[webapps] miniOrange 5.4.3 - Unauthenticated Auth Bypass(01.09.2026 um 02:00 Uhr)
🕵️ Sicherheitslücken[webapps] Wolf CMS 0.8.3.1 - RCE v(01.09.2026 um 02:00 Uhr)
🔧 AI Nachrichten How I’m using Codex and ChatGPT on my Mac(01.09.2026 um 00:00 Uhr)
🕵️ SicherheitslückenProFTPD mod_sql post-authentication SQLi RCE(06.09.2026 um 18:21 Uhr)
🕵️ Sicherheitslücken[remote] CVE-2026-42167 - ProFTPD mod_sql post-authentication SQLi - RCE(25.08.2026 um 02:00 Uhr)
🕵️ Sicherheitslücken[webapps] C-MOR 6.0104 - Cross-Site Scripting (XSS)(31.08.2026 um 02:00 Uhr)
🕵️ Sicherheitslücken[webapps] CubeCart 6.7.4 - Stored XSS(31.08.2026 um 02:00 Uhr)
🕵️ Sicherheitslücken[webapps] CubeCart 6.7.4 - Cross-Site Scripting(31.08.2026 um 02:00 Uhr)
🕵️ Sicherheitslücken[webapps] Langflow 1.8.4 - Path Traversal to Remote Code Execution(31.08.2026 um 02:00 Uhr)
🕵️ Sicherheitslücken[webapps] miniOrange 5.4.3 - Unauthenticated Auth Bypass(01.09.2026 um 02:00 Uhr)
🕵️ Sicherheitslücken[webapps] Wolf CMS 0.8.3.1 - RCE v(01.09.2026 um 02:00 Uhr)

🔧 Programmierung 🕛 vor 1 Jahr 3 Min Lesezeit
0

OOP - Abstraction

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht




What ?



Definition 1: Abstraction is the process of hiding implementation details from users, enabling them to focus on the functionality rather than the internal workings.



Eg: A commonly used analogy is the TV remote control: users interact with buttons to operate the TV without needing to know how the internal mechanics work.



Definition 2: Abstraction provides a blueprint or plan for designing classes with a defined set of rules. It ensures consistency and enforces that certain behaviors are implemented across derived classes.



I find Definition 2 to be more intuitive and relatable and this post explains in detail from that standpoint.






Why ?



To understand the need for abstraction, let’s first explore a problem.






Problem:



Imagine creating classes to draw pictures of animals. Each animal has its own unique features, but certain traits—such as having four legs and a tail—are shared among them. Without a structured approach, developers might forget to include these common traits, leading to incomplete or inaccurate depictions.




CODE
class DogPicture {
drawATail() {}

drawFourLegs() {}

drawFloppyEars() {}
}

class CatPicture {
drawATail() {}

drawFourLegs() {}

drawConeShapedEars() {}
}

class HorsePicture {
drawATail() {}

drawFourLegs() {}

drawManeHair() {}
}

class GoatPicture {
drawATail() {}

drawFourLegs() {}

drawHorns() {}
}

class ZebraPicture {
drawATail() {}

drawFourLegs() {}

drawStripesOnBody() {}
}









Solution:



Abstraction can solve this problem by defining a shared plan or rules that every animal picture class must follow. This can be achieved using an abstract class or interface in TypeScript.




CODE
abstract class AnimalPicture {
abstract drawFourLegs(): void;

abstract drawATail(): void;
}






Now, any class that implements AnimalPicture must define these methods. Failing to do so will result in an error.






Incorrect implementation






CODE
class DogPicture implements AnimalPicture { // this will throw error as `drawFourLegs` & `drawATail` are not implemented. 
drawFloppyEars() {}
}









Error:





CODE
Class 'DogPicture' incorrectly implements class 'AnimalPicture'. Did you mean to extend 'AnimalPicture' and inherit its members as a subclass?
Type 'DogPicture' is missing the following properties from type 'AnimalPicture': drawFourLegs, drawATailts(2720)









Correct implementation






CODE
class DogPicture implements AnimalPicture {
drawFourLegs(): void {
console.log("Drawing four legs for a dog.");
}
drawATail(): void {
console.log("Drawing four legs for a dog.");
}
drawFloppyEars() {}
}

class CatPicture implements AnimalPicture {
drawFourLegs(): void {
console.log("Drawing four legs for a cat.");
}
drawATail(): void {
console.log("Drawing four legs for a cat.");
}
drawConeShapedEars() {}
}

class HorsePicture implements AnimalPicture {
drawFourLegs(): void {
console.log("Drawing four legs for a horse.");
}
drawATail(): void {
console.log("Drawing four legs for a horse.");
}
drawManeHair() {}
}

class GoatPicture implements AnimalPicture {
drawFourLegs(): void {
console.log("Drawing four legs for a goat.");
}
drawATail(): void {
console.log("Drawing four legs for a goat.");
}
drawHorns() {}
}

class ZebraPicture implements AnimalPicture {
drawFourLegs(): void {
console.log("Drawing four legs for a zebra.");
}
drawATail(): void {
console.log("Drawing four legs for a zebra.");
}
drawStripesOnBody() {}
}







This ensures that all animal picture classes implement the shared rules (drawFourLegs and drawATail), while allowing flexibility for unique features like floppy ears or stripes.






Conclusion



Abstraction in OOP helps enforce a consistent structure across related classes while allowing flexibility for unique implementations. It ensures that essential behaviors are not overlooked, making code more predictable and maintainable.

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
The Gemini desktop app is now available for Windows
1 Quelle
Windows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC
1 Quelle
Windows 11’s useless Copilot key finally does something, you can map it to right-click
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten OOP - Abstraction

Thematisch verwandte Begriffe: Abstraction · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...