Tips for transforming procedural code into object-oriented? [closed]

2

I have a system that is completely procedural in style, and I want to know what points I need to identify in order to turn this code into an object-oriented one.

    
asked by anonymous 12.06.2014 / 16:52

2 answers

5

I had this procedure on a site that I developed when PHP did not have POO yet. The big problem is understanding the current business rule and translating Object Oriented Programming. They are different things, and their main goal is to understand Procedural and Analyze before implementing OOP.

Tip:

1) What does your system do?

Example: Make a customer registration, how you can reuse something, maybe the View and some code, but in real terms, the part code will have to be rewritten, it's a big job.

2) Can I reuse code?

Example: The SQL you can take advantage of, I believe they are the same or practically the same. You will now have to use PDO or MySqli , then start the changes there.

3) Is it worth changing or making another?

Often it is better to design in POO a new system that can be done in parallel to the old one, thus avoiding system shutdown, and emphasizing the new system.

4) Working with Standards?

I suggest working with current patterns and nomenclatures, interfaces , abstract , class . An important factor is knowing POO well, and maybe even implementing it with MVC Frameworks, eg Laravel or Zend (Laravel indicates faster learning, Zend learning curve is higher)

5) Procedural Code for OOP Code, care?

Beware, as it has been reported POO is concept, follow the OOP concepts and make a new code with such concept. Experience: once I worked on a team that had programming in Cobol and they started to make a system in VB6, what happened, everything they did in Cobol they replicated in VB6, that was the worst absurdity I've ever seen. p>     

12.06.2014 / 18:43
5

I participated in a project recently where I had to carry a desktop system programmed in VB6 for ASP.NET C # OO (3 layers).

My review was as follows:

  • Understand how the system (and each page of it) works and how to use it (Identify what it is and what it is for).
  • Understand the business rule (this is very important because you can find restrictions that end up breaking other pages that depend on this rule).
  • Identify the system objects and methods and list them.
  • Search for functions and methods that can become generic.

As OO is a concept I believe my experience can help you

    
12.06.2014 / 17:31