Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Should I learn PHP or Node.js

Options
  • 10-08-2017 11:15pm
    #1
    Closed Accounts Posts: 5,482 ✭✭✭


    I'm a 4th year CS student as some of you know.

    In college we were 'taught' PHP. We did it for a week, but didn't do much. I have used it in my projects and while u know a little, most of what I get isn't self written. I get my solutions online.

    I want to learn a language really well that I can use for my 4th year project. Ideally I'd learn both, but I'm swaying towards node, as I want to know the JS stack.

    Any opinions?


«1

Comments

  • Registered Users Posts: 14,329 ✭✭✭✭jimmycrackcorm


    JS is ubiquitous so it's better to stick to node.


  • Registered Users Posts: 2,166 ✭✭✭Are Am Eye


    Yes.


  • Registered Users Posts: 6,250 ✭✭✭Buford T Justice


    php is a festering steaming pile of turd if you ask me & you should run a mile from it

    Stick with node. Angular > 2.x if you're looking for a framework


  • Registered Users Posts: 2,030 ✭✭✭colm_c


    php is a festering steaming pile of turd if you ask me & you should run a mile from it

    Stick with node. Angular > 2.x if you're looking for a framework

    Agree with the php comment, although still plenty of work in that area, steam pile or not.

    Angular is a frontend JS framework, not a node framework.

    OP, node is very freeform, which is good and bad. I would be more inclined to learn a good structured OOP language and framework such as Python/Django or Ruby/Rails.

    At this stage in your learning, getting a handle on OOP patterns and usage would be invaluable to future employers and it will be far more valuable than learning the current flavour of the month node/JS framework.


  • Registered Users Posts: 8,488 ✭✭✭Goodshape


    PHP7 is actually pretty good, and the JavaScript ecosystem isn't really one to be throwing stones.

    But node.js is probably the right answer. You'll learn JavaScript along the way, which is very useful.


  • Advertisement
  • Registered Users Posts: 1,206 ✭✭✭zig


    If you were learning PHP you should learn from a framework, a good one, like Laravel.

    Likewise what you're considering with Javascript and node.

    I would recommend node also. Not only will being a good Javascript developer always stand to you , even if you're going into other languages in the future, but also learning node will demonstrate to you good techniques.


  • Registered Users Posts: 1,298 ✭✭✭off.the.walls


    PHP is not that good unless you plan on hacking together Wordpress templates. In my experience of it anyway, I know there are some good frameworks out there for it such as Cake, Laravel and others that I do not know about personally.

    If you're going to go with node I'd suggest first looking at just pure JS, theres a good video series on Udemy, Javascript understanding the weird parts, it'll bring you through all the gotchas that JS can throw into your face and allow you to get a better understanding of the language in order to be better able to code a node js application.

    You have to remember that NodeJS itself is a very small framework it's the packages around it such as express, http, mysql, koa that give it a lot of server side power. In addition to that you may want to make an api by using Node but separate your frontend code out into another application in a frontend framework such as React, Angular, AngularJS or Vue or Meteor... you can see where i'm going here lots of ways to skin a cat.

    Enjoy! but avoid PHP


  • Registered Users Posts: 8,488 ✭✭✭Goodshape


    JavaScript is not that good unless you plan on hacking together JQuery templates.

    If you're going to go with PHP I'd suggest first looking at just pure PHP, theres a good video series on Laracasts.com, PHP The Right Way, it'll bring you through all the gotchas that PHP can throw into your face and allow you to get a better understanding of the language in order to be better able to code a PHP application.

    You have to remember that PHP itself is a very popular and widely used language on the web, it's the packages around it such as composer, Symfony modules, frameworks such as Symfony itself or Laravel, and a huge community that give it a lot of power.

    Enjoy! but avoid JavaScript (and silly arguments about which is the "best" language – they're all rubbish tbh :P).


  • Registered Users Posts: 1,298 ✭✭✭off.the.walls


    Hmmmm..... I can't even be mad about that comeback... personal opinion is that I would rather Javascript to PHP, but I suppose that argument is as valid as any.


  • Registered Users Posts: 8,488 ✭✭✭Goodshape


    Yeah. I actually use both PHP and JavaScript all the time. They both have their issues but they've both come a long way in recent years.

    PHP7, Laravel, and Symfony are all very nice to work with – and nothing like the 14 year old (!!!) codebase of WordPress. And if you haven't used PHP with Composer (the package manager), then you haven't really used modern PHP. The old stuff doesn't compare.

    I find JavaScript remarkably similar. It would be easy to point to crusty old JS widgets or JQuery and dismiss it as a messy toy scripting language. The horrors of an out of control JavaScript codebase are something to behold. But, recently, with Node and NPM, Angular2+, React, TypeScript, and more... and the fact it seems to run everywhere (much like PHP!) – it's turned into a pretty solid option!


    I just think the JavaScript community and ecosystem is a bit more 'lively' at the moment. You'll probably never be out of work with either of them, but if it's one or the other – you might have more fun with JavaScript / Node.


  • Advertisement
  • Registered Users Posts: 6,250 ✭✭✭Buford T Justice


    Goodshape wrote: »
    Yeah. I actually use both PHP and JavaScript all the time. They both have their issues but they've both come a long way in recent years.

    PHP7, Laravel, and Symfony are all very nice to work with – and nothing like the 14 year old (!!!) codebase of WordPress. And if you haven't used PHP with Composer (the package manager), then you haven't really used modern PHP. The old stuff doesn't compare.

    I find JavaScript remarkably similar. It would be easy to point to crusty old JS widgets or JQuery and dismiss it as a messy toy scripting language. The horrors of an out of control JavaScript codebase are something to behold. But, recently, with Node and NPM, Angular2+, React, TypeScript, and more... and the fact it seems to run everywhere (much like PHP!) – it's turned into a pretty solid option!


    I just think the JavaScript community and ecosystem is a bit more 'lively' at the moment. You'll probably never be out of work with either of them, but if it's one or the other – you might have more fun with JavaScript / Node.

    Having worked professionally with both, I would recommend js and running a mile from php. Php is great if you want to build a server backend or some static(ish) web page. If you want to build anything of quality on a front end then you are going to have to sit some js on top of it for animations or a half decent ux. You can't get that with php, and there are already some full stack js frameworks that can do it all within the same language. Why bother learning two languages when you don't need to?


  • Registered Users Posts: 8,488 ✭✭✭Goodshape


    If you want to build anything of quality on a front end then you are going to have to sit some js on top of it for animations or a half decent ux.

    And if you want to twist a screw, a hammer's going to be a pretty useless tool.

    I've worked with hammers in the past and they're all crap. Not a single one is any good and twisting screws. Run a mile!


  • Closed Accounts Posts: 5,482 ✭✭✭Hollister11


    This is making my decision much harder haha

    I'm currently doing a web dev course on udemy where node is the backend language. So for the time being I'm going to learn node.

    I suppose it wouldn't hurt to know how to use both.


  • Registered Users Posts: 8,488 ✭✭✭Goodshape


    No problem sticking with Node. Given the choice the two it's probably the right place to start.

    I just take issue with people attacking one of the most popular and versitile languages on the web based on their limited knowledge of a decade old blogging platform (WordPress).

    Just no need for that. Some of the most successful and popular sites in the world have been built with PHP.


  • Registered Users Posts: 6,250 ✭✭✭Buford T Justice


    Goodshape wrote: »
    No problem sticking with Node. Given the choice the two it's probably the right place to start.

    I just take issue with people attacking one of the most popular and versitile languages on the web based on their limited knowledge of a decade old blogging platform (WordPress).

    Just no need for that. Some of the most successful and popular sites in the world have been built with PHP.

    Indeed they have, facebook being one of the most prolific of these

    For the record I've never used wordpress so I can't rate it. My experience is from building end to end applications in Cakephp and mySql, so if I'm attacking the language this is why - not because of a tool written in php.


  • Registered Users Posts: 8,488 ✭✭✭Goodshape


    Yeah, I've used CakePHP before. Wouldn't recommend it!


  • Registered Users Posts: 1,206 ✭✭✭zig


    Goodshape wrote: »
    I just take issue with people attacking one of the most popular and versitile languages on the web based on their limited knowledge of a decade old blogging platform (WordPress).

    Just no need for that. Some of the most successful and popular sites in the world have been built with PHP.

    Over time as I struggled with wanting to settle on a language/career I tore myself apart wondering why people thought PHP was so bad (its the back end language I know best).

    Years of experience later and lots of reading, not to mention learning other framewords like node (and dipping my toes into other languages) etc has thought me to start ignoring "Avoid [language]" comments, unless there's a very good and very specific reason for it.


  • Registered Users Posts: 1,298 ✭✭✭off.the.walls


    zig wrote: »
    Over time as I struggled with wanting to settle on a language/career I tore myself apart wondering why people thought PHP was so bad (its the back end language I know best).

    Years of experience later and lots of reading, not to mention learning other framewords like node (and dipping my toes into other languages) etc has thought me to start ignoring "Avoid [language]" comments, unless there's a very good and very specific reason for it.


    But also knowing a "language" is no good if you don't understand the principals of what you need to do, you need to understand why you need to loop, create conditionals, use certain patterns in your code.

    If you know the ideas behind it then you will be able to apply those ideas and theories into any language.


  • Moderators, Society & Culture Moderators Posts: 9,668 Mod ✭✭✭✭Manach


    My own relevant experience is suppprting legacy Php code and elsewhere doing some Qa automation with JS. The former is simpler to work with on basic maintenance while the latter has more advanced/interesting features. A fair bit of language choice seems to revolve about what is the standard in the company.


  • Registered Users Posts: 6,250 ✭✭✭Buford T Justice


    For me, one of the major drawbacks is that php is loosely typed. I believe they've addressed a lot of that in php7, but I've only developed in 5.6.

    In creating apps over time I've run into more problems because of method signatures and variable types.
    Does a method take any arguments, and what type are they? Is the return type void or not. If not, what does it return? Could be a boolean? an object? a number? Hey, I'm feeling adventurous - lets conditionally not return anything, because that certainly isn't going to be confusing in the long term.

    Variables are loosely declared too. Is it a boolean? is it a string? is it an array? No, its an object, but for funsies lets reassign an integer to it. There's no reason why you can't, and it'll never become confusing.

    Granted within this you could argue that a lot of this is down to the individual writing the code. This is true, but for someone who is learning to use a language it breeds too many bad habits for me, such as not giving variables types and so on. Experience has forced me to learn this the hard way and trying to get out of my own bad habits since that's exactly what I did.

    I also concede that javascript is also loosely typed, but since the introduction of typescript its made life considerably better. Declaring data types is optional, as is proper method signatures but if you declare them correctly you will get syntax highlighting and compilation errors when you try to compile ts into js.

    Hence I am of the opinion that for someone learning a language to start, its more likely easier to do so using javascript, more specifically typescript. I may be biased, since I am writing in angular2 at the moment, but having used both, I can certainly see the benefits of javascript.

    P.S - I am also a convert. Before I started this current role, I would have preferred to work with C# and have avoided js altogether. Never though I would actually be advocating it but here I am.....


  • Advertisement
  • Registered Users Posts: 8,488 ✭✭✭Goodshape


    I also concede that javascript is also loosely typed, but since the introduction of typescript its made life considerably better. Declaring data types is optional, as is proper method signatures but if you declare them correctly you will get syntax highlighting and compilation errors when you try to compile ts into js.

    Well, exactly :). JavaScript and PHP are both loosely typed (by default, or by preference) and both can result in the most ungodly mess of unmaintainable code if you don't know what you're doing.

    PHP has had (optional) type declarations since PHP5 and they were greatly expanded upon in PHP7, with scaler type definitions and return type hints. It also has good class inheritance, namespaces, interfaces, traits, anonymous classes, plenty of good stuff, and a huge active community.


    The barrier to entry remains very low for PHP (and JavaScript) which means –

    a) there's lots of bad PHP and JS code written by people just starting out and/or with no desire to learn and do things properly.

    b) people cut their teeth on PHP, cobble something together, later learn how to do things properly in another language, look back on their old code and conclude that PHP must have been the problem.


    I regularly switch between PHP7 and TypeScript'd JS code. They're remarkably similar to work with.


    Everyone has a preference, and that's fine, but the "php is a steaming pile of turd" meme is just short sighted, wrong, and pretty insulting to anyone who's working with the language.


  • Registered Users Posts: 6,250 ✭✭✭Buford T Justice


    Goodshape wrote: »
    Everyone has a preference, and that's fine, but the "php is a steaming pile of turd" meme is just short sighted, wrong, and pretty insulting to anyone who's working with the language.

    Not in my opinion its not. Read my post again, I've given my opinion on the language as just that - my own opinion based on experiences that I've explained here. I've made no reference to the people that use it and if you are insulted by that then that's an issue for you.


  • Registered Users Posts: 8,488 ✭✭✭Goodshape


    Not in my opinion its not. Read my post again, I've given my opinion on the language as just that - my own opinion based on experiences that I've explained here. I've made no reference to the people that use it and if you are insulted by that then that's an issue for you.

    In your opinion it's not insulting? I work with the language everyday and I'm telling you that it is.

    You've used an old framework on an old, deprecated, version of the language and feel you can state, as if fact, that "php is a festering steaming pile of turd if you ask me & you should run a mile from it".

    Let alone that you evidently, by your own admission, don't have enough experience with the language to make such a call, it's just a ****ty childish thing to do even if it were true.


  • Registered Users Posts: 6,250 ✭✭✭Buford T Justice


    Goodshape wrote: »
    In your opinion it's not insulting? I work with the language everyday and I'm telling you that it is.

    You've used an old framework on an old, deprecated, version of the language and feel you can state, as if fact, that "php is a festering steaming pile of turd if you ask me & you should run a mile from it".

    Let alone that you evidently, by your own admission, don't have enough experience with the language to make such a call, it's just a ****ty childish thing to do even if it were true.

    The OP asked for opinions and I've given just that. My opinion based on my experience (I never stated it was a fact).
    php is a festering steaming pile of turd if you ask me & you should run a mile from it
    Emphasis on the "if you ask me" bit there. This doesn't make my opinion right, nor does it make it wrong but I'm no less entitled to voice my it than you are without having to resort to petty name calling as you have.

    I can't help the fact that you've been insulted because of my opinion. That's on you, not me.


  • Registered Users Posts: 8,488 ✭✭✭Goodshape


    Name calling? I'm just suggesting you don't insult other people's professions.

    You're "free" to do so though, yeah. Good luck with that approach.


  • Registered Users Posts: 6,012 ✭✭✭Talisman


    I'm a 4th year CS student as some of you know.

    In college we were 'taught' PHP. We did it for a week, but didn't do much. I have used it in my projects and while u know a little, most of what I get isn't self written. I get my solutions online.

    I want to learn a language really well that I can use for my 4th year project. Ideally I'd learn both, but I'm swaying towards node, as I want to know the JS stack.

    Any opinions?
    The language you use shouldn't matter. Languages like JavaScript, PHP and Python don't force you into a single programming paradigm (e.g. Procedural, Object-Oriented, Functional). Learn the paradigms, the data structures and patterns that go with them. If you use an IDE like those offered by JetBrains the code is practically written for you so you will pick up the syntax of a language through exposure to the IDE.

    Personally I think if you know PHP then you already know Python. No matter what language you choose, you should definitely learn JavaScript.

    If you want to challenge yourself implement your project in a functional programming language like Clojure or Scala. Functional programming isn't widely taught which is a pity because it opens your mind in a way that OOP does not. There's nothing to stop you from using functional programming in JS, PHP or Python but the temptation to fall back to old habits and patterns of the procedural and OOP realms might prove too great. Once you grasp the art of functional programming you will instinctively begin to produce cleaner and more testable code when you change to another paradigm.

    You should also take the opportunity to begin doing Test Driven Development and document your code if you're not already doing so - these are very good habits to develop. If you produce well tested and documented code then you're a better job candidate than your peers.


  • Closed Accounts Posts: 5,482 ✭✭✭Hollister11


    OP here.

    I see jobs I'm interested that require node, also require C# ASP.NET MVC.

    Should I learn this also.. Angular also?

    What is the 'best' for development age wage wise?


  • Registered Users Posts: 2,030 ✭✭✭colm_c


    Best depends on experience more than tech.

    Someone with zero experience vs someone with 2-3 years experience vs 10+ experience will have very different salary's.

    Difference in salarys across tech isn't that big, unless you are in a niche tech that has little competition.

    The tech you've mentioned is pretty topical right now, so lots of companies are looking for it.

    I'm also fascinated with this push for traditionally backend developers to know angular - which is a JavaScript frontend framework.

    I guess it makes some sense, but from what I've seen a lot of them shouldn't be let near it.


  • Registered Users Posts: 6,012 ✭✭✭Talisman


    OP here.

    I see jobs I'm interested that require node, also require C# ASP.NET MVC.

    Should I learn this also.. Angular also?

    What is the 'best' for development age wage wise?
    ASP.NET MVC is a framework for Microsoft's implementation of the Model-View-Controller architectural pattern, it's a standard design pattern that developers should be familiar with. C# was born during the legal dispute between Sun Micro Systems and Microsoft regarding Microsoft's implementation of Java. The similarities between the two languages are no coincidence - if you can code in Java then it's not difficult to transition to C# and vice versa. On the Java platform you will see jobs advertised for experience with the Spring or Play frameworks. Spring is a massive platform, Play is more productive to build something quickly.

    If you want to develop using Node.js then you need to know JavaScript well - that means knowing what happens under the hood. A lot of developers come from other languages and don't actually learn the platform because they don't need to in order to get by. It's not difficult but most developers haven't a clue how JavaScript works behind the scenes - Lexical Scope, Closures, Prototype Chains. Once you understand how those things work, everything else falls into place.

    You Don't Know JS is a great free resource by Kyle Simpson that you can use to massively improve your understanding of the language.

    Codesmith run regular meet ups in their New York office which they live stream and the recordings are found on YouTube - JavaScript the Hard Parts. If you can follow and understand the subject matter you'll be on a better footing than many mid-senior level JavaScript developers.

    The frontend frameworks are very similar - they steal ideas from each other. Ember.js and Vue.js have borrowed heavily from React and Angular. AngularJS was ground breaking but it was a dog with fleas - it hamstrung itself with how it polled state. Angular 2 was a complete rewrite and a massive improvement, using the framework means migrating to TypeScript. TypeScript brings a lot of benefits but I would advise learning JavaScript first.

    The Model-View-Controller is an important pattern to know whether you find yourself working on the back or front end.


  • Advertisement
  • Registered Users Posts: 1,298 ✭✭✭off.the.walls


    If you're going to go with learning Javascript why not just master the MEAN stack?

    MongoDB
    ExpressJS
    AngularJS
    NodeJS

    That way you can write fullstack applications and that'll open up your entire career to a wider range of possibilities than just front end or just backend. With this you wont end up as a jack of all trades because your entire stack will be Javascript based. You'll end up mastering Javascript.


Advertisement