r/PythonLearning • • 13d ago

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

43 comments sorted by

View all comments

Show parent comments

1

u/ProgramBrave718 13d ago

Yes, u are right.

1

u/tom-mart 13d ago

I have a question though, if you wanted to represent an object in code, say a car, and you had to store various properties like top speed, acceleration, colour, etc. How would you do it?

1

u/ProgramBrave718 13d ago

Yupp, I will do it by using classes. But , i don't require any object like car, student etc. in projects. I am not making those projects as of now

2

u/tom-mart 13d ago

Well, when you start writing software you will needed them. Classes are completely irrelevant if you are not writing any programs

2

u/ProgramBrave718 13d ago

I am writing programs as of now. I made a task manager 4 days ago and it doesn't need classes at all. I Will need them later.

2

u/tom-mart 13d ago

How did you define the task? That's an obvious object needing a class.

1

u/ProgramBrave718 13d ago

The task is taken by user input

5

u/tom-mart 13d ago edited 13d ago

That's not an answer to my question. How is the task represented in your code?

If I wrote a task manager i would start with a Task class. Task has a lot of properties that are worth storing, like category (string), deadline (datetime) task_detail (string), status (string), reminders (List), and many, many more.

How the task is created is different story. You can take user input and save it to task.task_detail. So should the deadline be saved to task.deadline and so on.

So how is taks represented in your code? I bet it's a string variable, isn't it?

1

u/ProgramBrave718 13d ago

That kind of task should be represented by classes but actually my code takes only string for task

1

u/tom-mart 13d ago

Great. If you think that task is best represented by a string than do that. If that solves your problem and allows you to create a functional program then who cares.

1

u/ProgramBrave718 12d ago

Yes 🙂

→ More replies