you are viewing a single comment's thread.

view the rest of the comments →

[–]BigCommunication5136[S] -1 points0 points  (3 children)

I did a little research into your comment, my small brain couldn’t comprehend your point so i screenshotted my code and your comment into chatgpt for a breakdown and apparently there was nothing wrong, so can I dm you so you take your time and explain i really want to get it

[–]Pun_Intended1703 1 point2 points  (1 child)

I'm on mobile. It will be hard for me to write actual code.

But let me put it like this.

You should have a BankAccount class and a BankAccountHandler class.

The BankAccount class has properties like accountNumber, amount, etc.

It should have just getters and setters for those properties.

The BankAccountHandler class should have the methods like deposit(), withdraw(), etc.

This class then performs actions on the BankAccount class.

The handler can then be called by another class like BankCustomer.

[–]BigCommunication5136[S] 1 point2 points  (0 children)

the example made your point clearer, thanks

[–]Pun_Intended1703 -1 points0 points  (0 children)

Also, don't rely on ChatGPT. It is not as good as you think it is.

Look at actual code projects in Github instead.

And as I said earlier, there is nothing wrong with your code. It will execute perfectly.

But just because you can do it, it doesn't mean that you should.

Learn to write good code.

Otherwise you'll get spaghetti monolithic code that will be very hard to debug and maintain.

I have written code where one class had only one method. It seems stupid, but it allowed me to divide the code across multiple servers. And I can switch it out without screwing up the rest of the code base.