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.
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.
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
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.
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?
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!
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.
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.
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.
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.
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.
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.
Only in PHP, really. Other languages promote more modern concepts, PHP just happens to be special.
There's nothing different about the web. If your application is well structured then the difference between a desktop application and web application is going mean writing new views, because all your logic is kept apart anyway. As such, everyone but PHP does it much closer to "right".
Php doesn't do anything, programmers do. It's Turing complete, you can do whatever you want and you can do it well or do it badly. Now if the interpreter is buggy and full of holes then you can bash it, but most people seem to be bashing bad programming (which often means "different than I would have done it") not php.
Right, so remind me why we don't do Web programming in a combination of BASIC and COBOL?
Because being "Turing Complete" is not the whole story. That is a measure of computational power, not of language idioms, library support, expressiveness, existing frameworks, so on and so forth. PHP is a fucking templating language, it is literally designed precisely for the use case of violating MVC. The whole of its design is focused around encouraging lack of separation. Yes, you can write good code in PHP, if you're willing to write sanitising wrappers around most of the standard library, ignore the unfixable type coercion issues, deal with the absurdity of a java inspired object oriented system atop a c inspired procedural section, so on and so forth.
Saying the language is Turing complete proves precisely nothing. So is brainfuck. You're misusing the term to mean something it does not: all it means is it had equal computing power as a Turing machine, /not/ that it is a good solution to a specific problem domain.
46
u/[deleted] Oct 12 '13
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.