Skip to main content
Stack Overflow
  1. About
  2. For Teams

Timeline for When should I be using classes in Python?

Current License: CC BY-SA 3.0

Post Revisions

18 events
when toggle format what by license comment
Dec 24, 2024 at 20:36 comment added Jason Hu as basically an expert in this very exact area to answer this question, my claim from almost 10 years still holds: classes are neither necessary in programming, nor are you mandatory to use it. classes are a way to express abstraction, but abstraction can be expressed in multiple other ways, and as a result, different programming paradigms are created. again, there is nothing wrong to use or not use classes...
Dec 24, 2024 at 20:34 comment added Jason Hu well... it's a blatantly ridiculous claim that a PhD in programming language theory and types does not understand OOP...
Dec 16, 2024 at 10:26 comment added PaulG PLEASE ignore this coment from @JasonHu - it completely misses the point of OOP - as most who don't really understand OOP do (encapsulating state and behavior). In python the simple heuristic for when you should use a class comes down to whether or not your abstraction needs to be concerned with state. Abstractions that carry mutable state should be implemented using a class to express this. Python lets you hold state functionally (e.g. by passing around a dict), but remember - code is largely about expressing intent - so use constructs like classes when to express what you need to express.
Mar 5, 2024 at 18:19 comment added jxramos If a procedural design with the call stack gets it done you don't need to bring classes into the picture, especially if you're only doing procedural stuff with the class anyways. I've always felt you should use the minimal representation to get to job done and only invoke more powerful logical/semantic structures when necessary. To mobilize more complexity in solutions that exceed the level of complexity in the problem itself is to me an antipattern, something in the direction of over-engineering. Which solution presents the minimal cognitive load comes into play too.
Sep 9, 2021 at 3:51 answer added zyc timeline score: 8
Nov 10, 2020 at 22:44 history protected Community Bot
May 29, 2020 at 11:26 review Close votes
Jun 2, 2020 at 0:05
Oct 9, 2018 at 13:18 answer added Mohit Thakur timeline score: 5
Oct 12, 2015 at 14:14 vote accept metersk
Oct 12, 2015 at 4:26 answer added Dmitry Rubanovich timeline score: 37
S Oct 12, 2015 at 3:40 history suggested valignatev
adding oop tag
Oct 12, 2015 at 3:37 comment added Jason Hu there is nothing wrong to code with no classes if you can manage your code nicer. OOP programmers tend to exaggerate the problems due to the constraints from the language design or superficial understanding of different patterns.
Oct 12, 2015 at 3:30 answer added Ashutosh timeline score: 5
Oct 12, 2015 at 3:18 review Close votes
Oct 26, 2015 at 3:03
Oct 12, 2015 at 3:13 answer added dantiston timeline score: 307
Oct 12, 2015 at 3:07 review Suggested edits
S Oct 12, 2015 at 3:40
Oct 12, 2015 at 3:03 answer added valignatev timeline score: 22
Oct 12, 2015 at 2:53 history asked metersk CC BY-SA 3.0
toggle format

AltStyle によって変換されたページ (->オリジナル) /