glassfish Posted October 5, 2014 Share Posted October 5, 2014 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? Quote Link to comment https://forums.phpfreaks.com/topic/291447-is-the-procedual-style-legitimate/ Share on other sites More sharing options...
requinix Posted October 5, 2014 Share Posted October 5, 2014 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). Quote Link to comment https://forums.phpfreaks.com/topic/291447-is-the-procedual-style-legitimate/#findComment-1492771 Share on other sites More sharing options...
KevinM1 Posted October 5, 2014 Share Posted October 5, 2014 Put another way, coding style (procedural, OOP, etc.) is in no way a metric of code quality. There is nothing inherently bad with procedural code. Quote Link to comment https://forums.phpfreaks.com/topic/291447-is-the-procedual-style-legitimate/#findComment-1492781 Share on other sites More sharing options...
sKunKbad Posted October 5, 2014 Share Posted October 5, 2014 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. Quote Link to comment https://forums.phpfreaks.com/topic/291447-is-the-procedual-style-legitimate/#findComment-1492805 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.