How do i get out of the habit of procedural programming and into object oriented programming?

前端 未结 20 902
你的背包
你的背包 2020-12-23 12:13

I\'m hoping to get some tips to kinda help me break out of what i consider after all these years a bad habit of procedural programming. Every time i attempt to do a project

20条回答
  •  青春惊慌失措
    2020-12-23 12:44

    First, congrats on taking steps to learn something new! I hate it when developers decide to NOT evolve with technology.

    As far as moving from procedural programming to OOP, I would say that one thing that you can do is take an existing app (as others have mentioned) and, before you even open a text editor, sit down and think about how each aspect of the application would be converted. I have found that more than half of OO programming is defining the conceptual objects in your mind first.

    Again, I will agree with everyone's recommendations on design patterns. Specifically, I would look into the MVC (Model-View-Controller) pattern as this one might be the easiest one to grasp. You have already written code, so you should be able to look at your existing applications and begin putting each part into the M,V or C categories.

    Best of luck and have fun!

提交回复
热议问题