Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Christian Cargill
Christian Cargill
8,065 Points

Should I learn PHP or JS (node) if I am interested in backend programming?

I am already about 50% of the way through the front-end course, and I've read that JS is now being used for backend development. However, I'm currently a freelancer who uses WP and I probably want to continue doing freelance work, so I'm not sure how many scenarios I'll run into where I'll be working with node.js.

I mean, are there pros/cons to following either backend language? I've also considered learning Ruby on Rails, but a lot of people seem to suggest it's becoming used less often, in favor of full stack JS.

I suppose I'm looking for a talent that is in demand, flexible, and pays well (who isn't though?) :)

5 Answers

Dane Parchment
MOD
Dane Parchment
Treehouse Moderator 11,075 Points

To be honest it seems as though the winds are shifting from the bigger web back-end languages (PHP, Ruby on Rails, Django (Python)) to the JavaScript languages. Basically as long as you keep scalability in mind, NodeJs, Angular, Express, Meteor, all of these JavaScript frameworks can basically take the place of these languages.

To answer your question: Learn Both, get a solid foundation in an actual established back-end language (PHP, Ruby on Rails, etc.), but then also get a grasp on the MEAN Stack or the Meteor Stack which both utilize javascript as its source.

Here are some resources to help you: https://scotch.io/ - Great for generall web development (includes php, javascript, node, css, etc.) http://php.net/docs.php - This is the best resource (aside from Treehouse, that helps you learn PHP)

Douglas Counts
Douglas Counts
10,060 Points

To be honest it seems as though the winds are shifting from the bigger web back-end languages (PHP, Ruby on Rails, Django (Python)) to the JavaScript languages.

By JavaScript languages, I assume that you meant things like CoffeeScript and TypeScript as later you mentioned what were frameworks. CoffeeScript and TypeScript are both pre-processed languages that are converted to standard JavaScript which is what the server and browser see. This is usually done in your workflow with a build tool like Grunt or Gulp. Although you can load middleware into your node app and have both converted on the fly.

Basically as long as you keep scalability in mind, NodeJs, Angular, Express, Meteor, all of these JavaScript frameworks can basically take the place of these languages.

Umm, that is a definite no for all your examples except Express. Express is a web server framework specifically for node or Electron. Angular and Meteor are browser based "front end" technologies and should normally not be run on the server as the server doesn't have a browser DOM. There are hacks for this though, but it is strongly not recommended to run on node, but node is just fine serving them up to the browser just like any other server.

Node.js isn't like a framework any more than a C compiler is a framework. Both are binary compiled engines designed to compile and run something. And both have libraries. Node is more like PHP, Python, or Ruby on Rails.

Regarding a recommended language - My advice is to learn several languages because each has unique perspectives on how to solve a problem. But you are going to have to focus primarily on two languages in your case. PHP because that is what WordPress uses and JavaScript because that is what runs on the browser.

Node is great for the cloud because it is self contained and doesn't need Apache nor Internet Information Server to host it. That makes cloud servers happy because it is easy to create an instance or even scale it up to several servers. Node also supports clustering and child processes that can use every core on your processor to get work done--each is singled threaded of course. That strength though is also its weakness because many providers offer you a choice to either have your content served up with Apache or IIS, neither of which will work for you since you need PHP on port 80. Neither Apache nor IIS can "share" a port with Node. Node has to own its port(s) and can actually own many ports to serve up many simultaneous web API's by using many port listeners.

Christian Cargill
Christian Cargill
8,065 Points

Thanks for the help! Yeah, most everyone says now is the time to absorb JS and really jump into learning to develop with it. Its just with how quickly the tide seems to change in regards to front-end fads, its really difficult to find a specific path. So many new ideologies trumping old ones month by month, it's not as simple as it used to be.

Dane Parchment
Dane Parchment
Treehouse Moderator 11,075 Points

True that, I do believe that JavaScript will become the one true programming language for the web just based on how versatile it is, but still its always great to have a foundation in an older language (PHP for example) as those legacy jobs will pay you well :D

I would check out React as well. There is a good blog post about it here, http://blog.teamtreehouse.com/react-hype-real The official site http://facebook.github.io/react/

Dane Parchment
Dane Parchment
Treehouse Moderator 11,075 Points

True React is pretty cool, but I see it more as a front-end framework as compared to a back-end one.

Well sort of but add in Flux and Flow and you have a pretty nice package that is flexible, easy to update and is getting a lot of attention at some pretty large corporations. Check out this repo https://github.com/kriasoft/react-starter-kit Not that I am trying really hard to get the TH staff to put up some lessons or anything :)

Alexander Costa
Alexander Costa
11,464 Points

It does not matter which rout you decide to go in as long as your learning to program. try sticking with a language and master it. Then you can pick up other languages easily if you want to or need to. As far as a job goes it depends what you want to do in the industry. You could do agency work by learning php/JS/Drupal or Ruby/js/Rails or etc etc etc whatever you learn there will be a job for. Just make sure to stay focused.

Christian Cargill
Christian Cargill
8,065 Points

Yeah, but I tend to feel like all of these libraries forked from other libraries, combined into frameworks - just seem to add multiple layers of complexity, abstraction and confusion to the "modern" web development process. I understand how they can make a team of web developers lives easier, but as a one-man gig at the moment, it feels like by the time I digest all of these technologies there will be an entirely new subset of them that I will have to learn.

You don't often read about how to build things, you read about what to build them with. Its like the industry is so in love with technology that its all about building tools to continue enhancing the technology instead of a focus on the work, or the products, or what the tools should be used for.

If someone asked me "Oh, are you a web developer" I'd look around and say... "I think".

Dane Parchment
Dane Parchment
Treehouse Moderator 11,075 Points

I think you are looking at it the wrong way. Web Development nowadays is extremely complex as there are a lot of hidden things you got to account for. These frameworks don't add to the complexity, they help alleviate it by making things much easier, for example the METEOR framework makes creating real-time, asynchronous applications a breeze, imagine having to go through and create a layer of asynchity for your application before you even begin coding it! For a single person frameworks make life so much easier! Yes, you may have to spend more time learning the framework, but the end result is so worth it! So just bare with it, grit your teeth, and dive into the realm of frameworks and libraries, because without them the web wouldn't be as "modern" as it is today!

You might be right but I struggled with PHP for a long time trying to get all the pieces together to make sure my users were secure and I was accessing the data in the most efficient way, Then came along Laravel and now i can whip up a site in an afternoon. I guess you can look at Wordpress the same way.

Dane Parchment
Dane Parchment
Treehouse Moderator 11,075 Points

Well, that's the point! I think that these new frameworks and libraries make life easier for everyone. However, I do recommend that one do learn the concepts before using these frameworks so that they can understand why these frameworks make life easier. Like mastering javascript before learning jquery!

Christian Cargill
Christian Cargill
8,065 Points

You guys are right. I think it might be just the fact that there are so many pieces to the puzzle it can be difficult to settle with what language or path you want to take.

Dane Parchment
Dane Parchment
Treehouse Moderator 11,075 Points

Well I mean from a person standpoint and at the end of the day, you take the road you are more comfortable traveling. So if using too many frameworks and libraries is to complex or daunting, then stick with the language you are comfortable with, there are always legacy apps/websites that need to be created that don't need to use these frameworks, and they do pay well.

From a business standpoint however, you want to move with the times, the web is an ever shifting place, and if you want to stay competitive you need to learn what everyone else is learning or risk being left behind!

Alexander Costa
Alexander Costa
11,464 Points

If you love JS focus on Vanilla JS until you really get a grasp on it then work on some frameworks. Once you have the vanilla version of a language really solidly understood you can hop from framework to framework with some relative ease.

Dane Parchment
Dane Parchment
Treehouse Moderator 11,075 Points

Exactly, the whole point of a framework or library is making life easier for you. So you can master javascript, or PHP, and then when you feel comfortable coding in them, move onto the libraries to save you time and headaches.

:D

Christian Cargill
Christian Cargill
8,065 Points

Thanks guys!

I'll just stick it out until JS really clicks, and I might test out PHP to see if that provides me anything creatively rewarding.

Dane Parchment
Dane Parchment
Treehouse Moderator 11,075 Points

Great, have fun learning, if you need help, you've got a wonderful community of programmers who are always glad to help!

That...or cross your fingers asking questions in StackOverflow ;P

Alexander Costa
Alexander Costa
11,464 Points

People may shun me for this but I love php.... a lot.