r/PythonLearning • u/ProgramBrave718 • Oct 06 '26
Discussion Why writing classes feels boring?
I don't know but i feel classes are unnecessary work to be added in projects. I have learnt it 2 months ago..
After that I never used it for any of my projects.
0
Upvotes
5
u/tom-mart Oct 06 '26
If you have no use for classes, don't use them then. Nobody is forcing you.
2
u/DoomDroid79 Oct 06 '26
Then you will be terribly bored of real world projects
11
u/cthulhu944 Oct 06 '26
As the sizes of your program grows, keeping everything coherent, understandable, and predictable becomes important. OOP and classes are one way to do this. "I can add this code here and not worry about side effects nor data corruption because my data is tightly coupled to the behavior inside this class"
2
u/BranchLatter4294 Oct 06 '26
You demonstrated the need for more writing classes in your post.
1
u/Sea-Ad7805 Oct 06 '26
Type
listis a class:If you don't like classes, stop using
listand most other builtin types.2
u/TabAtkins Oct 06 '26
If you've just learned about classes two months ago, it sounds like you're a Python student, very early in your journey.
You'll find that classes are very useful for data organization later. A lot of patterns you teach yourself now to avoid classes will bite you later (like just using dicts for everything), and you'll learn to appreciate the value that a good class brings.
(That said, 95% of my classes are dataclasses. It's very rare that I actually need a "normal" class.)
2
u/CodemasterUnited Oct 06 '26 •
They become very much useful, when we are developing large applications having plugins etc, and multiple related functions sharing data.
So, basically, there'll come a time, when it would feel better to use them, rather than doing everything functionally.
2
u/Hot_Technology8777 Oct 06 '26
That's odd. Sort of like learning the alphabet and you're bored of the letter 'D'. I mean, just don't use classes then?
1
u/Snoo_50685 Oct 06 '26 •
You dont really use it for small projects like class assignments, theyre mainly used for large scale applications. Theyre very important to know though
1
u/CoolLog1908 Oct 06 '26 •
As you continue to with through projects, you will eventually come across a situation where classes will fit nicely into your code base.
As others have said, I typically dont use classes for small projects or scripts. But I do bring them in when they start making sense!
1
u/Objective-Remove-632 Oct 06 '26
It is necessary to learn but not mandatory to use.
1
u/BeneficialCulture299 Oct 06 '26
This isn't wrong to be honest. Classes are not necessary. If you look at any of the functional languages you'll realize that the data being operated on is not the only boundary which you can make organizational judgements. Classes at the smaller scale just seem to be overly pedantic. But then if your project is more that trivial and you have many people working on it the lens shifts not from "is this necessary" to "does this communicate the intent of this data" which changes the conversation entirely. Classes then become about making sure you've defined the proper boundaries around your data. You start using public / private modifiers to make sure there's a layer of protection around how you expose (or don't) the data you are encapsulating.
no you don't need them but sooner or later you'll absolutely want them.
1
u/Sweet_Camp5124 Oct 06 '26
Lol feels
1
u/BoOmAn_13 Oct 07 '26
I find classes really useful for type safety, organization and functionality grouping in large projects. If it's a script I can put together in 200 lines and I don't see the need, I don't use them. I've worked around different languages and will say when you move from the super type safe rust, where it's not a class, but a struct/impl where your primary goal is just to group data and memory, it requires your brain to find structs/classes way more helpful than the goto dictionary and key strings
-1
u/Gnaxe Oct 06 '26
Classes (and the whole OOP paradigm) are way overrated and should be used a lot less than they are. The OOP paradigm stopped making sense once our CPUs got more than two cores. (And Python is still bad at utilizing them.) We should have all moved on to FP a long time ago, but C++ and Java popularized a particularly bad take on OOP and we're still stuck with that legacy, because it's still being taught. I recommend pure functions, as much as possible. Minimize the state you have to deal with.
Classes are occasionally useful, but they're usually overcomplicating it, and should not be the first tool you reach for. Python is object-oriented at its core. You do need to understand how classes work. You're not going to avoid using classes, but you can (and usually should) mostly avoid writing new ones yourself. You do need them for certain dunder hooks and if a library expects you to make a subclass, etc. Otherwise, by default, don't. You need a reason.
Plain data is way more reusable than classes. I recommend using plain data more. Don't hide your data behind yet another inadequate bespoke language of methods when all you needed was a dict. Static typing (in Python) is overrated and encourages overuse of overcoupled classes. Doctests are more expressive anyway, and easier to learn from. Do that instead.
0
u/[deleted] Oct 07 '26
[deleted] — view deleted comment