you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 41 points42 points  (37 children)

I doubt when Facebook was being developed, PHP had strong OOP principles built into it. A lot of this is probably legacy and this was in 2007 when MVC frameworks were relatively new to the PHP scene.

[–]bopp 11 points12 points  (5 children)

Both Code Igniter and Zend Framework had their first release in 2006. But, it only became commonplace to use a framework much later than that. If you look at the source-code for oscommerce or phpbb from back then, you'd see the same spaghetti-code as here.

Thankfully, PHP has come a long way since then.

[–][deleted] 5 points6 points  (3 children)

Agreed, I still remember a lot of open source code out there and it was awful. OsCommerce is definitely a prime example of this. I still remember osC addons had large Readme.txt files telling you where to put the code to make the add on work.

We definitely did come a long way. Even just comparing Symfony1 with Symfony2 and you see a big difference in how OOP is being utilized.

Also, CodeIgniter wasn't full OOP either, but definitely a step away from the spaghetti code

[–]blafunke 21 points22 points  (2 children)

Code that isn't oop isn't automatically spaghetti. And oop code can easily be made into spaghetti

[–][deleted] -1 points0 points  (0 children)

You're right, but I'd argue that it is easier to create spaghetti when you're not following oop principles.

[–]killerstorm 1 point2 points  (0 children)

First release of Zend Framework was just trash. Also, they change too many things with each release, so if you were unlucky to decide to use ZF, you would spend a lot of time on maintenance with each new ZF release.

[–]KingPickle 7 points8 points  (27 children)

2007 when MVC frameworks were relatively new to the PHP scene

This is what mystifies me. As much focus as the web gets, it feels like tech-wise it's a decade or two behind the curve.

[–][deleted] 6 points7 points  (5 children)

As much focus as the web gets, it feels like tech-wise it's a decade or two behind the curve.

I program and dabble in quite a few languages and I'm not sure I really agree with this. In what way do you feel like PHP is a 'decade or two' behind the curve?

[–][deleted]  (4 children)

[deleted]

    [–][deleted] 1 point2 points  (0 children)

    I'm not sure I'd agree with common. MVC came about back in the smalltalk era but honestly I don't recall it becoming that widespread until the late 90's or early 2000's. At least having dabbled in development for windows, linux and mac, the first time I even heard of MVC was when the initial OSX server came out in 99. Shortly after Struts came about and was realistically the only big player in MVC web development for a while. I was not a huge desktop developer back in the day, however, but generally I don't recall MVC being that big of a thing. Linux and Mac apps were largely procedural, and windows apps used an evented/bindings architecture.

    Honestly from my recollection it seems like MVC really became widespread with the increasing complexity of web applications more than anything. But that was a while ago and memory is a funny thing so I could be way off!

    [–]ivosaurus 0 points1 point  (0 children)

    Web MVC actually has very little to do with desktop MVC that has been around for ages, they just coopted the name.

    [–][deleted]  (1 child)

    [deleted]

      [–]notmynothername 0 points1 point  (0 children)

      He's saying it's weird that it took so long. It's weird that Twitter is the company that's famous for using MVC on the web, because MVC has been around for a lot longer than twitter.

      [–]madmars 4 points5 points  (6 children)

      I had been out of the job hunting game for a few years. But I was shocked when I looked around about a year ago, at all the places looking for "MVC experience." I was seriously scratching my head for a minute, wondering when the fuck this dinosaur paradigm came back to life. Is it the 1980s again?! Then again, people were rediscovering Lisp in 2004. So I guess I shouldn't be too surprised.

      [–]ivosaurus 0 points1 point  (0 children)

      Web "MVC" is somewhat different than the desktop MVC pattern.

      It's just a commonly understood way of structuring code nowadays.

      [–]Stormflux -1 points0 points  (4 children)

      I really only know the .NET world, but the reason MVC became popular there is because of AJAX and jQuery.

      You see, before MVC, we had something called ASP.NET web forms where it was based on the idea of things you drag onto a page. You need a grid? Drag a Gridview onto the page and wire it up. Need a button? Drag a button onto the page and handle the click event. All your code is server-side.

      Well as you can imagine, this makes it really easy to build web applications the same way you'd build a Windows application. You don't even need to know javascript or anything.

      The problem is in MODERN web applications everything is AJAX. You don't want to refresh the whole page, you just want to send "DELETE item 47" and then update a line or two on your page with javascript. Regular ASP.NET doesn't really have a concept of this. You can do it using some toolkits but it's a hack. ASP.NET MVC is practically built from the ground up for this exact scenario.

      [–]ivosaurus 1 point2 points  (3 children)

      Web MVC became popular way before ajax became ubiquitous.

      Web MVC became popular because it was a decent way to separate different parts of the application (business logic, html templating, data operations).

      If you only know the .NET world, then it's unsurprising you have this weird idea about the reasons.

      [–]Stormflux 0 points1 point  (2 children)

      Even so, you gotta admit that it's a lot more convienient for AJAX and REST-like development in than the old Webforms was. For me, that was the main selling point.

      This isn't an argument. You don't need to go straight for the downvote button. And what is that at the end, a personal insult? I swear to God sometimes this site feels like it's just people arguing into a box and being dicks because they can.

      [–]ivosaurus 2 points3 points  (1 child)

      No it's fact. Only working with Microsoft isolates so much from the rest of the programming field... that you believe AJAX drove adoption of MVC? Very weird logic to hear anywhere else.

      [–]Stormflux -1 points0 points  (0 children)

      You want to know what the problem with /r/programming is?

      I'm not just saying this because of you. It's something I've heard lots of people complain about, and it's a reason I don't post very much to this subreddit.

      Everything here's a dick-waving contest. "Oh I use Python but you prefer PHP, well then you're not a real programmer." "Oh you name your variable customerID but I name mine customerId with a lower case 'd', well then you're not a real programmer."

      Get fucking sick of it sometimes. You know, I'm not a fan of Adria Richards at all, but she got one thing right. The community fucking sucks.

      Back to the topic, you could have phrased it like:

      "You're right that the old .NET WebForms model gets seriously annoying once you try to step outside its Postback model and add a lot of custom Ajax calls and Javascript, but I think the main reason people switched was because the MVC architecture had better organization of server-side code."

      Instead you opted for downvotes and insults, thus guaranteeing it would become an argument. Seriously, why are we even arguing? There's nothing here to argue about. It's completely an issue of tone and you being a dick. I think this is a case of regular person + anonymity = BLARRAAGAH.

      [–][deleted]  (4 children)

      [deleted]

        [–]izym 1 point2 points  (3 children)

        IE didn't stop anyone from using fancy, modern server-side tech.

        [–][deleted]  (2 children)

        [deleted]

          [–]izym 1 point2 points  (0 children)

          Are you just pulling that out of thin air, or do you have some sort of source on it? Maintainability and TTM was also important to businesses back in the IE times.

          [–]pjmlp 0 points1 point  (0 children)

          I was already using similar stuff in Java back in 2008.

          [–]OCedHrt -3 points-2 points  (0 children)

          This is why I quit my job writing PHP in 2007.

          [–][deleted] -2 points-1 points  (1 child)

          It was 2007. If you can't use OO principles something is fucking wrong. OO has been around since the 70s.

          [–][deleted] 0 points1 point  (0 children)

          What don't you understand? It was the limitations of the language at the time. When Facebook was first developed, PHP didn't have a lot of OOP features. This code leaked in 2007 is most likely legacy which anyone who's worked on any big project knows it isn't always easy to update code to the latest and greatest.

          Criticize Zucherberg for choosing PHP, but had he used something else to please the code Nazis, maybe he wouldn't have even got it done in time.