Jump to content

Recommended Posts

I was looking to write tutorials.

 

I am wondering if the procedual style is legitimate?

 

Because I have been reading posts on the internet like:

"horrid code" and similar, also because of issues like "SQL injection".

 

Any suggestions on the procedual style specifically, when one is looking to write tutorials?

Link to comment
https://forums.phpfreaks.com/topic/291447-is-the-procedual-style-legitimate/
Share on other sites

Taking "procedural code" to mean the typical file-as-a-functional-unit approach to PHP,

 

People who write horrible procedural code will write horrible object-oriented code too. Makes no difference. Meanwhile SQL injection is completely unrelated so that argument means nothing.

 

Procedural code teaches (hopefully) good coding practices that will bleed into object-oriented code too. So it's worth it. For example, separation of logic and presentation is particularly important in procedural code, drilling in the concept so it will be familiar when they eventually come to object-oriented code (notably MVC).

Without any procedural coding experience, it's doubtful that you could learn PHP enough to make anything useful. Evidence pointing to this fact are the super simple questions that beginners are asking in the framework forums. The frameworks being primarily OOP, they offer lots of shortcuts, but they don't teach somebody PHP. The way that functions are used compared to methods needs to be learned. The global nature of variables compared to class properties with certain visibility needs to be learned. There are too many things to list when comparing the differences between procedural and OOP coding. You really can't just learn procedural or OOP, you need to learn both to really know your PHP. For now, just investigate all of the things you don't understand, and then over time you will realize that the learning process never stopped. I've got about 8 years PHP experience and still learning. When you're comfortable with PHP, then you'll realize you need to know more about CSS, HTML, JavaScript, Apache, MySQL, SQLite, XML, Python, Ruby, Bash, Sass, etc, etc, etc.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.