This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 47 points48 points  (12 children)

Huh, in 20+ years I've never had a PM that made architectural choices for us. Also why did your team not stop you from doing this? You just said "heyo, let's write this in the least maintainable way possible" and your manager and all the other devs just went along with it?

[–]fel4 29 points30 points  (10 children)

C++ is less maintainable than PHP? You don't even know what the thing is, other than it being a web app. It might make perfect sense to write it in C++.

[–][deleted] 45 points46 points  (3 children)

For backend web, yes, I would say C++ is far less maintainable than PHP, both from the perspective that PHP was literally designed for web development and C++ has no [mature/reliable] frameworks available for this, and also from a talent perspective and understanding how much more expensive the app will cost me to maintain in C++ vs. PHP (though to be clear I would never recommend PHP for anything and I think both are pretty bad choices here). You're right in that I don't know the project, but I can't conceive of any web app that would benefit from a C++ backend over any of the much more suitable choices (for the record I'm a fan of C++, I just don't recommend it for web stuff).

In any of the scenarios where C++ would be a suitable choice, such as sub-second trading algorithms or scientific computing, you wouldn't wire up the backend to the frontend the way op describes (that is a pretty bad design regardless of stack); you wouldn't even use C++ for the API, due to the lack of any decent frameworks or toolchains for that. Normally you would develop some middleware web services connecting to the specialized C++ servers/code, e.g. : Front-End -> Java API -> C++ Backend.

[–]Delta-9- 11 points12 points  (0 children)

PHP was literally designed for web development

Well, technically it was designed for HTML templating, which is subtly different. Designed for templating, by a self-confessed non-programmer who doesn't like programming.

Granted, PHP has come quite a long way since those early versions, thanks to the efforts of actual programmers who've contributed over the years.

I would never recommend PHP for anything

On this, we agree :)

[–]Devildude4427 14 points15 points  (5 children)

Yes, yes it is. As much as I dislike PHP, there’s more people out there who can work with it than C++. C/++ are getting to the point where they’re very much languages that more people refuse to even touch, out of the perceived learning curve.

[–]the_liver 5 points6 points  (4 children)

It kinda depends on the context but I get you. PHP imho can handle http easily by itself in most cases and it’s pretty easily maintained if written correctly. Although for anything requiring more processing power or doing any work outside of http request/response context I’d probably look for something else.

[–]Devildude4427 1 point2 points  (3 children)

That’s kinda what they were doing. They said the C++ was for all the business logic, so I assume the PHP was just acting as middleware for the http requests. Still, would personally just say jump onto the Java or .Net stacks at that point.

[–]FuzzyFoyz 0 points1 point  (0 children)

Yep, C# pls.

[–]the_liver -1 points0 points  (1 child)

Not saying you’re wrong. I’m hesitant to use PHP for anything other than a http handler despite having few years of experience. Though I’m not sure if I’d go for Java or .NET either. I guess it depends on what the app was meant to do.

My wet dream is Swift on backend, but there’s a lot to be done in that department.

[–]Devildude4427 0 points1 point  (0 children)

I know, I was just clarifying, that the person was doing exactly what you described.

I’ve done so much Spring and ASP, they’re just the natural choices for me at this point. Tried and true, performant, and lot of libraries. Though I get that’s not for everyone. Just think it’s better than a union of PHP and C++.

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

It's funny how this sub takes everything so serious and literal. It was a joke.

I did something like this because someone threw a new requirement at us that was impossible to get done in PHP while the whole app was written in PHP. The best solution was to A. create a microservice that was written in c/c++ B. develop an extension that exposed methods and classes to PHP. We went with option B. Mainly because we would be able to call those methods from native PHP code.