In terms of the kinds of microservices you'd be producing with PHP, yes, that's kind of the idea. Each service acts as an api interface for a specific data source.
However, I have another example that counters this. I have two microservices that I wrote in NodeJS due to their real-time behavior.
The first is a search service which performs dozens of queries in parallel to take advantage of multiple database cores and different indexes. As the queries finish the results get streamed to the front-end via a long polling system. This way when someone enters a search query, the fastest and most likely cases (like an order id or address) show up first and then less likely matches like full text searches come in over time.
The second is a Socket.io server which manages the data on our order pipeline. It regularly polls the database with a collection of queries, comparing the results against the previous poll. Any differences get broadcast over the websockets to the front-end which updates the order listings. It also manages lock states on orders so that two staffers don't work on the same order.
Both of these systems interact with the same MySQL database as our PHP monolith, but having them as microservices allowed each to fulfil a very small domain of responsibility. If one of them breaks down it doesn't affect anything else on the site.
I got your point entirely, you're saying that when you have query B that depends on data from query A, you have to wait for query A to finish.
However that is not a scenario that occurs 100% of the time. In the average REST app it's probably not even 50% of the time, as you're far more likely to have more GETs than POSTs. I have numerous routes that perform parallel data lookups. I've got integration tests that interleave a dozen queries at once (including inserts) to setup test conditions.
You could claim that the ability to perform parallel queries wont result in a significant improvement, and that would fall well within the bounds of YMMV, but to claim that parallel query execution is a fallacy is an absolutist generalization and outright misleading.
the Node community is extremely toxic and there are always bad presses around. PHP will probably still live on for a while
You say that like PHP doesn't have it's own share of bad actors and conference drama. I see the exact same personalities and behaviors in PHP that I encounter in JS. Both communities have toxic elements.
It's not a fallacy. Multi-threaded multi-core database systems are fully capable of performing multiple queries at the same time, they do it all the time.
If I need to perform 3 database selects to get the data that I need for a request then yes triggering each query will happen in a synchronous order, but sending those queries to the database takes less than a millisecond. As soon as the first command is sent we can then send the second, and then the third. The parallel processing occurs in the external system, and the database responds in order of how long the query took. The total response time is that of the longest query, not the combined length of all three.
I've used both, and they're both just as good, just different apis for mostly the same behavior. I think proxyquire's interface is a little easier to reason about, but that's just opinion.
First of all, the frontend side of this is almost irrelevant. I say almost because you mentioned a desire to share code between both sides of the site. In 3 years doing node dev I've not yet encountered a single solution for universal JS which isn't a massive clusterfuck of over-engineering (especially the React stuff). It's a pipe-dream
In the real world most of your frontend code is going to be separate from your backend, just like it would be in PHP. Frontend tooling like gulp and webpack, or tools like karma for running frontend tests, are going to be exactly the same for a PHP application running the same logic using the same HTTP requests. The only differences are on the server.
Nginx is a piece of both stacks, so that's irrelevant. NPM comes with node and thus shouldn't be mentioned separately, but if you must then it falls in the exact same position as composer. So, again, irrelevant. MySQL is also part of both stacks... irrelevant.
The absolute minimum that you need to setup a server side application in Node is express + body-parser + a database driver (node-mysql2, for example).
You might want some kind of template library, but as of node 4 JS template strings are available, so you don't really need it. You'll also likely want to use lodash to fill in for the gaps in JS's standard kit, but with Node 6 you have full access to ES6 and some of ES7, which significantly improves the toolkit.
That's it, 3-5 libraries and you can have a fully functional website. Compare that to your average Symfony or Laravel stack and it's a pretty huge difference.
You don't need typescript any more than you need type hinting in PHP. People have been writing both JS and PHP for decades without static types, it's perfectly acceptable.
You don't need mocha, chai or sinon for testing, Node has its own assert module built right in and you can execute multiple test files using shell wildcards. These libraries are just nice-to-haves (and aren't even the best tools available, just the most well known). You probably will need proxyquire, however, to do in-module dependency injection for your tests.
That's not the point he was making at all. He stresses multiple times in the post is that dynamic languages allow for faster development, and that through TDD you can avoid the issues that static types protect you from.
The article is only about developer efficiency, not anything else.
Take note of the age of this post, and its revision history. He wrote this because of reactions when Underscore 1.7 had numerous breaking changes that screwed over people who were using semver in their project dependencies.
Six months later (to the week) Underscore 1.8 was released, containing numerous breaking changes that once again wreaked havok in hundreds of codebases that were relying on Semver. It was also pushed out with numerous bugs, because he ignored failing unit tests. This was when he made the last edit, crossing out the comment about 1.7 becoming 2.0.
Moral of the story, if you use Underscore you better lock the version number, because Jeremy doesn't give a fuck.
Node doesn't follow SemVer
This is no longer true, the next major release of node will follow SemVer.
It really does depend on how you define community. The main definition is simply a group of people living in the same place or having something in common, and under that definition, any one who uses PHP would be a member of the php community.
Usually, however, when people refer to communities in programming, they mean it in the communal sense of fellowship and contribution, either in the form of knowledge or product. If you are creating open source libraries for other community members to use, you are contributing. If you are helping others to learn more, you are contributing.
A person who partakes of the communal goods but never gives back in kind is a tourist.
A person on an island that doesn't partake of anything and has no communication is an alien.
Varnish is awesome for consumption sites like portals, blogs and tube sites where the majority of traffic isn't personalized, but it's not helpful for the kind of site OP is building. You can't cache a checkout.
I'd even go so far as to say that mysql writes should be deferred to a message queue. Use a memory store to keep track of available seats (OP is using memcache but I'd probably go redis).
Object wrapped literals, ala JavaScript. If a variable containing a string, integer, float or array is addressed as if it were an object, the runtime automatically wraps it in an object for that type (String, Integer, Float, Array). Those object contain OOP versions of all the functions we currently use for those types. This creates a parity with the functional versions of the Mysqli and DateTime functions.
$foo = 'my text';
echo $foo->ucwords();
// My Text
Never, ever, EVER insert external (or even internally stored) data into a raw query. That's how you get SQL injection. Always used bound parameters (what pmjones showed you).
What databases are you using that don't support it?
The warning is because PDO is an abstraction layer and it's up to the individual drivers to fully support it. To my knowledge, the MySQL, Postgres and SQLite drivers all do, and I would bet MSSQL does too.
No specific strategy, but I did get involved in online communities with a lot of other remote developers; Networking helps a lot. The latest job I'm in actually came from a blog post I wrote that the project lead found.
I'm a systems architect, both front-end and backend.
I live in Southern California, but I could probably be anywhere. The current company I work for is about 30 miles north of me, and my last job was for a company in Buffalo, NY.
Yeah, the IP address at the top makes me think it's pulling temperature from a wifi connected thermometer.
In terms of the kinds of microservices you'd be producing with PHP, yes, that's kind of the idea. Each service acts as an api interface for a specific data source.
However, I have another example that counters this. I have two microservices that I wrote in NodeJS due to their real-time behavior.
The first is a search service which performs dozens of queries in parallel to take advantage of multiple database cores and different indexes. As the queries finish the results get streamed to the front-end via a long polling system. This way when someone enters a search query, the fastest and most likely cases (like an order id or address) show up first and then less likely matches like full text searches come in over time.
The second is a Socket.io server which manages the data on our order pipeline. It regularly polls the database with a collection of queries, comparing the results against the previous poll. Any differences get broadcast over the websockets to the front-end which updates the order listings. It also manages lock states on orders so that two staffers don't work on the same order.
Both of these systems interact with the same MySQL database as our PHP monolith, but having them as microservices allowed each to fulfil a very small domain of responsibility. If one of them breaks down it doesn't affect anything else on the site.
Ok then, that's fair.
The scope of what you quoted made no mention of performance, so it looked to me like you were explicitly saying that parallelism was a fallacy.
I got your point entirely, you're saying that when you have query B that depends on data from query A, you have to wait for query A to finish.
However that is not a scenario that occurs 100% of the time. In the average REST app it's probably not even 50% of the time, as you're far more likely to have more GETs than POSTs. I have numerous routes that perform parallel data lookups. I've got integration tests that interleave a dozen queries at once (including inserts) to setup test conditions.
You could claim that the ability to perform parallel queries wont result in a significant improvement, and that would fall well within the bounds of YMMV, but to claim that parallel query execution is a fallacy is an absolutist generalization and outright misleading.
You say that like PHP doesn't have it's own share of bad actors and conference drama. I see the exact same personalities and behaviors in PHP that I encounter in JS. Both communities have toxic elements.
It's not a fallacy. Multi-threaded multi-core database systems are fully capable of performing multiple queries at the same time, they do it all the time.
If I need to perform 3 database selects to get the data that I need for a request then yes triggering each query will happen in a synchronous order, but sending those queries to the database takes less than a millisecond. As soon as the first command is sent we can then send the second, and then the third. The parallel processing occurs in the external system, and the database responds in order of how long the query took. The total response time is that of the longest query, not the combined length of all three.
Illustration
I've used both, and they're both just as good, just different apis for mostly the same behavior. I think proxyquire's interface is a little easier to reason about, but that's just opinion.
You would be wrong.
First of all, the frontend side of this is almost irrelevant. I say almost because you mentioned a desire to share code between both sides of the site. In 3 years doing node dev I've not yet encountered a single solution for universal JS which isn't a massive clusterfuck of over-engineering (especially the React stuff). It's a pipe-dream
In the real world most of your frontend code is going to be separate from your backend, just like it would be in PHP. Frontend tooling like gulp and webpack, or tools like karma for running frontend tests, are going to be exactly the same for a PHP application running the same logic using the same HTTP requests. The only differences are on the server.
Nginx is a piece of both stacks, so that's irrelevant. NPM comes with node and thus shouldn't be mentioned separately, but if you must then it falls in the exact same position as composer. So, again, irrelevant. MySQL is also part of both stacks... irrelevant.
The absolute minimum that you need to setup a server side application in Node is express + body-parser + a database driver (node-mysql2, for example).
You might want some kind of template library, but as of node 4 JS template strings are available, so you don't really need it. You'll also likely want to use lodash to fill in for the gaps in JS's standard kit, but with Node 6 you have full access to ES6 and some of ES7, which significantly improves the toolkit.
That's it, 3-5 libraries and you can have a fully functional website. Compare that to your average Symfony or Laravel stack and it's a pretty huge difference.
You don't need typescript any more than you need type hinting in PHP. People have been writing both JS and PHP for decades without static types, it's perfectly acceptable.
You don't need mocha, chai or sinon for testing, Node has its own assert module built right in and you can execute multiple test files using shell wildcards. These libraries are just nice-to-haves (and aren't even the best tools available, just the most well known). You probably will need proxyquire, however, to do in-module dependency injection for your tests.
That's not the point he was making at all. He stresses multiple times in the post is that dynamic languages allow for faster development, and that through TDD you can avoid the issues that static types protect you from.
The article is only about developer efficiency, not anything else.
I believe that's why Bob is stressing TDD, not just testing.
Not is being, has been, for some time. It's being removed from PHP.
I've never heard of Robo, but I like gulp a lot. Gives you a lot more flexibility than grunt, and is significantly faster.
Take note of the age of this post, and its revision history. He wrote this because of reactions when Underscore 1.7 had numerous breaking changes that screwed over people who were using semver in their project dependencies.
Six months later (to the week) Underscore 1.8 was released, containing numerous breaking changes that once again wreaked havok in hundreds of codebases that were relying on Semver. It was also pushed out with numerous bugs, because he ignored failing unit tests. This was when he made the last edit, crossing out the comment about 1.7 becoming 2.0.
Moral of the story, if you use Underscore you better lock the version number, because Jeremy doesn't give a fuck.
This is no longer true, the next major release of node will follow SemVer.
Not on a regular basis, but on Friday I accidentally reset the password of all users in our UAT database to my own. Ran the query in the wrong window.
Was an easy fix, we just reloaded the database.
Hell, after a decade of people saying NEVER DO THIS, I'd be surprised if a bad programmer even knew what goto was.
It really does depend on how you define community. The main definition is simply a group of people living in the same place or having something in common, and under that definition, any one who uses PHP would be a member of the php community.
Usually, however, when people refer to communities in programming, they mean it in the communal sense of fellowship and contribution, either in the form of knowledge or product. If you are creating open source libraries for other community members to use, you are contributing. If you are helping others to learn more, you are contributing.
A person who partakes of the communal goods but never gives back in kind is a tourist.
A person on an island that doesn't partake of anything and has no communication is an alien.
Varnish is awesome for consumption sites like portals, blogs and tube sites where the majority of traffic isn't personalized, but it's not helpful for the kind of site OP is building. You can't cache a checkout.
I'd even go so far as to say that mysql writes should be deferred to a message queue. Use a memory store to keep track of available seats (OP is using memcache but I'd probably go redis).
Object wrapped literals, ala JavaScript. If a variable containing a string, integer, float or array is addressed as if it were an object, the runtime automatically wraps it in an object for that type (String, Integer, Float, Array). Those object contain OOP versions of all the functions we currently use for those types. This creates a parity with the functional versions of the Mysqli and DateTime functions.
PHP doesn't lack them. http://www.php.net/manual/en/class.splenum.php
What does this do that SplEnum lacks?
http://www.php.net/manual/en/class.splenum.php
Never, ever, EVER insert external (or even internally stored) data into a raw query. That's how you get SQL injection. Always used bound parameters (what pmjones showed you).
What databases are you using that don't support it?
The warning is because PDO is an abstraction layer and it's up to the individual drivers to fully support it. To my knowledge, the MySQL, Postgres and SQLite drivers all do, and I would bet MSSQL does too.
Fulltime employee.
No specific strategy, but I did get involved in online communities with a lot of other remote developers; Networking helps a lot. The latest job I'm in actually came from a blog post I wrote that the project lead found.
I'm a systems architect, both front-end and backend.
I live in Southern California, but I could probably be anywhere. The current company I work for is about 30 miles north of me, and my last job was for a company in Buffalo, NY.