Tips for turning procedural code into object-oriented?

Asked

Viewed 765 times

2

I have a system that is totally procedural style, and I want to know what are the points I need to identify to turn this code into object-oriented.

2 answers

5

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

My analysis was as follows:

  • Understand how the system (and each page of it) works and how to use it (Identify what is what and what it serves).
  • 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

5


I had such a procedure on a website that I developed myself when PHP had POO yet. The big problem is understanding the current business rule and translating Object-Oriented Programming. These are different things, and your main goal is to understand Procedural and Analyze before implementing in POO.

Tip:

1) What your system does ?

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

2) I can reuse code ?

Example: The SQL you can enjoy, believe they are the same or practically. Now you will definitely have to use PDO or MySqli, then, there begins the changes.

3) Worth changing or making another?

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

4) Working with Standards ?

I recommend working with current standards and nomenclatures, interfaces, Abstract, class. An important factor is to know POO well, and maybe even implement with Frameworks MVC, example, Laravel or Zend (Laravel index is faster learning, Zend the learning curve is higher)

5) Procedural Code for POO Code, beware?

Beware, as already reported POO is concept, follow the POO concepts and make a new code with such concept. Experiment: once I worked on a team that had the programming in Cobol and they started making a system in VB6, what happened, everything they did in Cobol they replicated in VB6, that was the worst nonsense I ever witnessed.

  • 3

    Good answer, many relevant points. I highlight: "it is better to design in POO a new system that can be done in parallel to the old".

Browser other questions tagged

You are not signed in. Login or sign up in order to post.