Is a compare between PHP and NodeJS worth? [closed] - php

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I start this topic saying that I use PHP since 2014 and I'm experienced with it, but recently (yesterday) I started to give a look to NodeJS.
Node is growing fast and it's been used by a lot of web-services.
I started using it yesterday, but I found it less "beginner-user friendly" than PHP.
I'm not saying this as a beginner in computer programming, but as a Node-beginner.
What is your opinion?
Is it worth knowing both languages?

Is it worth knowing both languages ?
If you come from php development, learning node is a great idea.
It ll teach you in a soft way the concurrent programming pattern, and also event/stream programming,
it will lead you to face problems regarding the underlying OS in a soft way.
All sort of stuff that PHP greatly solves for you right out of the box and which you never think about.
Node will also give you the impression of a bigger playground to explore.
But, if you want to be productive when it s about building website, i believe PHP is better.
On the other hand, if you are looking for performance, node may be better, but true performance comes with compiled languages like GO, not scripted languages.
Finally, if php was not plumbed by all those damn heavy javaesque framework, it would be a really nice environment with a good trade off between speed and complexity.
Node gives you speed, but it comes with a price about the complexity which can be very costly.

As a beginner of both language i noted the following advantages of both languages
PHP
Mixing code with content
Deep code base
No client app needed
SQL
Speed of coding
NodeJs
Separating concerns
Newer code means more modern features
Service calls are thinner than HTML-fat PHP calls
JSON
Raw speed
You can read full article Here

Related

PHP vs NodeJS - text based RPG [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I know this isn't a very good question to ask because people may give bias answers, but was wondering if someone could list the pros and cons of using PHP vs NodeJS as a backend language in developing the average text-based online RPG.
The RPG will store its data in a MySQL database and will have typically 10-20 players online simultaneously.
For the long-run, which language would you think is more suitable?
I have several years of experience in PHP and barely any experience in NodeJS. It seems PHP has really good synergy with MySQL but I've been really hearing good things about NodeJS. Also, what design approach should I take (i.e. MVC).
Would be great to hear from someone who has a lot of experience in both languages.
Node.js is not a language. The language is Javascript.
Both are perfectly good choices, the main difference is the asynchronous approach of everything nodejs related. This increases the performance and scalability, but it's harder to debug and uglier to write and read (Learn about the callback hell). You need to get the asynchronous concept very well if you want to have the advantages people usually credits nodejs with.
This being said, you can program asynchronously with PHP, but it's far less common.
So if you are confident with PHP, you need the results fast or don't want to experiment go with it. If you want to learn or experiment, go with Node.
If the limit is 10-20 simultaneous players the performance shouldn't be such a a problem.
About the design approach, I would leave the details for last. MVC is very common and you will probably use something like that to organize your code but the choice depends on lots of factors and you should probably think about this after having the use cases / stories of your application defined and limited.

Procedural PHP vs Object Oriented PHP [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I am fairly new to PHP (you just have to see some of my previous/recent posts!). I have done a lot of my learning by studying other people's frameworks and attempting to rewrite them for my own purpose.
Out of the examples of code I have seen, it seems about 50/50 Procedural to OOP. My question is not which is better, but when should I consider using OOP over Procedural?
By the way, I don't want to encourage an open discussion of personal opinions as to why one should be used above the other. I am fully aware, after researching, that some people just prefer to use one or the other. I am after a legitimate reason as to what would encourage me to use one over the other and in what situations.
I have also read through a few different (but similar) questions on the subject, but they seem to be flagged as not constructive because it starts a debate. I don't want this, I am on a Q&A site as I am looking for an answer, not an argument.
Even thou it is 2014, you are still allowed to wash your dishes by hand, communicate with all your friends only in person, landline phone calls or letters send by the local postal service.
And you might feel incredibly well doing so.
But if you try to host a lot of dinner parties for a lot of people and organise important projects with a lot of people from remote destinations, having hard deadlines, you might consider getting a modern dishwasching machine and a smartphone.
Same goes for OOP vs. procedual. If you are just adding a tiny piece of functionality (display the current date, echo a random hash string) on your wordpress weblog: Go procedual.
If you are writing a tiny tool that does something you need to get done, if you are writing a tiny cron job batch script in PHP or if you are just fooling arround - do as you like.
But if you plan to develop sustainable, maintainable, testable, reusable, quality software that has a lot of features you should at least use OOP. Because it is bloody 2014.
OOP will enable you to blackbox and whitebox test units of your code seperately. It will enable you to not only efficiently reuse libraries and modules written by others but alos enable you to produce modules and libraris that can be reused by others.

Considering usage of server-side JavaScript [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Recently, i heard alot of JavaScript being used sever-side. Node.js, express.js and similiar stuff are mentioned more and more, but i never had the muse or time to dig deeper into the topic.
Now, as the information flood would not decrease, i can not longer ignore those circumstances.
I wonder about two things:
Can i replace my complete, simple PHP backend, which is primary used only for database access, with server-side Javascript
and if yes:
are there any benefits of doing so?
and if not:
Why is there such a hype?
The topic seems to be quite complex and not too easy to learn, but as time goes by, i more and more get the feeling that this maybe will be the future of backend coding.
Yes you can.
If you are primarily serving data, a more contemporary approach would be to use node.js to implement a restful api . Node.js is particularly suited for this as it inherently works asynchronously - which means each request to the data source (ie the database) inherently does not block while the server is waiting to return, allowing it to punch well above it's weight in terms of being efficient when servicing many requests.
You could use the node modules express.js or restify.js to implement this.
A warning though - node.js is a single threaded application which means some work has to be carried out before is scale able. There are some good solutions for this, such as using Amazon Elastic beanstalk. But as node.js is a relative newcomer many other proposed solutions may need some coaxing to be production ready.
You may find it beneficial to read 'Javascript the good parts' by Douglas Crockford before you begin - something I needed to bring my knowledge of Javascript to a level where I could write quality maintainable code for node.js
Yes you can replace it.
Main concepts about Node you have to know is being async, second is being event-driven.
So if your PHP app just accesses db and serve responses back, node.js would be more efficient in such applications, as would not block idling for response from db, but can process with other requests and so on.
It is not complicated, if you do it. Just go and dive into. Don't ask - prototype. It is the best way to understand if you really need it or not.
I've replaced all my PHP need to node.js, except templating.

Building a StartUp and moving from PHP to Ruby at the same time? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I am about to build the backend for my startup, which will be mainly offering a REST service, but HTML content will become available later. I am an experienced PHP developer and was thinking about building it in PHP first, but many people try to convince me to switch to Ruby. I would love to, but I have the following concerns:
I want to create a prototype quickly, learning a new language costs me a lot of time.
Right now I do not have a second developer who has Ruby expertise, so if I am stuck searching for a bug somewhere, it is worse than being stuck in PHP, where I know a bunch of people to get assistance from.
Some of the arguments people are making in favor of Ruby are:
It is easy to find good developers for Ruby, because the language itself is a filter.
Using a framework like Sinatra would speed up my development time drastically
Ruby is fun
What would you do?
The questions are :
do you prefer fun, or efficiency ?
do you have time to wait before being efficient ?
why not just recruit a good php developer ?
Even if there are bad developers on the market, there are also good developers
And I should add it's not that hard to see if a developer is good or not.
you say language is a filter ; don't you think it'll be enough of a filter to just make things hard when it comes to finding a ruby developer ?
If you're betting your money on this startup, take the road that you know. Getting to market quickly and having a support structure may be a lot more important than switching to a fun language.

PHP or Lift framework for a web application? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I'm currently developing a web application using PHP, but I'm considering developing the web application using the lift framework instead, because twitter and foursquare have implemented it. I know a few benefits using lift/Scala but, could you guys mention some benefits compared to PHP?
Many thanks
Resmus Lerdorf, the inventor of PHP, once said with regards to foursqaure (build with scala/lift) that it's the first site for a long time that doesn't have a single security hole he could find.
If you're having trouble enumerating the reasons why you'd use scala/lift over PHP, you'll probably want to stick with PHP. PHP is a far more mature and supported platform - oodles of documentation, huge community, tons of tools and libraries.
Scala is a great language, but the primary reason it's being used by Twitter and Foursquare is it's ability to work with enormous sets of data on a horizontally scaled architecture. These are very specific problems for these companies, and Scala was chosen for this purpose very deliberately.
As someone who has recently begun learning Scala, the community and documentation is minute compared to PHP's. Especially where Lift is concerned. And things like IDE support is still in it's early stages.
There's really no way to compare the two technologies (very different approaches). If want to use Scala, use it, but you'll probably be investing more time and energy if you're not already proficient (also, some background in Java doesn't hurt). PHP is just PHP, it's so easy to just pick up and use.
If you ask such a question you'd better stay with PHP. Once your project becomes more and more complex and you are fed up with PHP limitations the question will disappear on its own.
But Lift does not have to be the framework of your choice.
You should consider anything except PHP a good language for web applications, but Scala is a pretty excellent one, although it will change the way you think about programming as a whole. Some people can't handle that, so be warned.
PHP advantages:
Is installed even on the cheapest "5ยข-a-month" webhoster.
PHP disadvantages:
The libraries are not stable and change every now and then, often without notice.
The whole language is buggy and generally doesn't work as a sane person would expect.
The documentation is unusable, sometimes wrong, sometimes only understandable with the user supplied usage examples (which are often wrong or not optimal, too).
No quick way to see the implementation of some language-supplied code.
The API is one big mess ... this shouldn't be called API, it should be called MCOBRIM: Messy Collection of Buggy, Random and Ill-named Methods.

Categories