1

I´m really curious about the CS50 library (cs50.php). I noticed that the staff implemented OOP there (object oriented php) but not in helpers.php. I just wonder why? Does anybody know?

0

While working on my final project for CS50, I had the occasion to take a close look at the CS50 Library. You can read my notes on the subject here.

Interesting stuff, but it doesn't directly answer your question. I think the answer is that the focus of the class is more on functional programming.

In Module 7, they teach you how to use PHPMailer, which requires object-oriented PHP syntax. So David Malan uses OOP when necessary, but does not really make it the focus of the course.

Also, in the case of the CS50 Library, that is provided primarily as a tool for us to use. It's scaffolding that allows students to concentrate on learning the basics of SQL syntax, rather than struggling to implement PHP Data Objects. It's wonderful that folks like you and me are motivated to look more deeply into its implementation, but that is not required in order to complete Problem Sets 7 and 8.

By the way, if you feel that this answers your question, be sure to let me know by clicking the green check mark. Otherwise, this could become a Zombie Question, forever haunting the forums.

| improve this answer | |
  • Thanks Matt. It all started when I was trying to understand what CS50::query means and for some reason I ended up reading about OOP which surprised me because I couldn't recall anything about it during the CS50 course. Your answer partially answers my question. My guess is that functions written in classes could be reused easier somewhere else especially when you do with queries. I started to learn how to built OOP but I think I shouldn´t waste more time, lets complete the course first. – Ania Kludka Sep 6 '16 at 11:05
  • Yup. Also, when you are writing your own software in PHP, you may wish to use a library like PHPMailer or PDO (PHP Data Objects, which is what CS50::query is based on). Both of these examples are written using OOP, but that doesn't mean that you need to make your entire program object-oriented. Just get comfortable with the -> selector syntax and you can use objects without needing to implement your own classes and hierarchies! – hotwebmatter Sep 6 '16 at 11:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .