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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Java or PHP/SQL

  • 12-08-2011 1:57pm
    #1
    Registered Users, Registered Users 2 Posts: 116 ✭✭


    Hey folks wondering if you could give me some advice,

    Basically do a bit of web design and would like to get into web development,
    Iam looking at doing a part time Java or PHP course

    I have looked at php doing wordpress templates but haven't dived any deeper than that,

    I see there is alot of work (and wages) going for Junior Java developers and it seems like a very flexible language

    I dont have a computer science background so would like to know which would be easier to pick up and what would be more useful job wise?

    Thanks


Comments

  • Closed Accounts Posts: 2,696 ✭✭✭mark renton


    Java is notably more complex that PHP/SSQL

    Job wise Games / Applications v Data processing - Web coding
    Probably 50-50


  • Registered Users, Registered Users 2 Posts: 1,311 ✭✭✭Procasinator


    I reckon that without a related background it would be easier to get a PHP job rather than a Java job. I could be wrong, though.

    It would also probably be easier to learn PHP than Java. PHP's dynamic and interpreted nature also lends itself to more experimentation. It's also well documented particularly for the inexperienced.


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


    Based purely at looking at Multi-National firm's jobs site and own experience, Java is slightly more sought after at this time.


  • Registered Users, Registered Users 2 Posts: 3,141 ✭✭✭ocallagh


    How much time/effort/money do you want to invest in learning?

    If you're looking to get up to speed quick enough, I would choose PHP/MySql. It is easier to get to grips with and you'll find a lot more open source code out there to learn from. The lower learning curve will also afford you time to learn HTML/CSS/Javascript which are all just as important for web development. You'll also land a decent job if you can display solid PHP/Web Dev skills.

    Long term though, Java is probably a better language to have on your CV. You will need to put some real time and effort into it and there is the danger the learning curve will be too high and you'll just give up.. You'll also need to set aside any web dev hopes for the first 6 months to a year. You'll be spending all your time getting to grips with the fundamentals of Java.

    If you're dedicated and have some money saved up, go with Java. If you just want to get stuck in, go with PHP and in a few years you could then do a Java course or something


  • Registered Users, Registered Users 2 Posts: 116 ✭✭aficionado


    Wow thanks for the advice guys,
    I think I will go down the PHP route as I would be more familiar with it building wordpress sites in the past,
    I'll see how that goes and hopefully if I wish to pick up Java down the line the php will stand to me :)


  • Advertisement
  • Closed Accounts Posts: 20,759 ✭✭✭✭dlofnep


    PHP is much easier to pickup and start coding with. I did web-dev with both in college - and while I had prior experience with PHP - it's far more intuitive.


  • Registered Users, Registered Users 2 Posts: 1,657 ✭✭✭komodosp


    I'm not too familiar with Java, but if I it came down to one or the other I would choose it, simply because PHP/MySQL is a bit simpler and I think you could learn that on your own...
    You say you don't have a computing background but I am sure if you learned Java you'd have enough programming knowledge to pick up PHP pretty quickly


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Firstly you should separate the programming language from the database. While PHP and MySQL traditionally go hand in hand, they're actually separate application tiers; as such Java can happily work with MySQL and PHP can happily work with other databases, such as Oracle.

    With regards to the programming language, PHP is a far easier and more forgiving language than Java.

    By forgiving, I mean you can do a lot of things in PHP that Java would simply refuse to do, because you have to be more disciplined about scope, object/variable types and so on. The downside is that, especially if PHP is your first language, it will also tend to teach you a lot of bad habits, that (other than causing problems in your PHP applications) will have to be 'unlearned' when you move onto other languages later.

    The other disadvantage of PHP is that it is pretty much limited to the Web. There are compilers, IDE's and GUI frameworks that allow you to develop applications for other platforms using PHP, but I don't think they're terribly stable and certainly in little demand commercially.

    Furthermore, LAMP and other PHP-based Web applications tend to be the less mission-critical ones. There are some enterprise PHP-based Web applications out there, but generally languages such as Java or C# are used there.

    Java has a much steeper learning curve, but is used more widely on commercial projects, especially enterprise level projects. As it is more unforgiving, being a good Java programmer will likely make it a lot easier for you to get into other languages, such as (or especially, given the similarities) C#.

    With regards to employment, PHP developers are two-a-penny. Good PHP developers are actually uncommon, due to the ease of entry and propensity for picking up bad habits, and when you get them, they are almost always developers who can already code in multiple languages. Java developers are less common (although CS graduates who say they can develop in Java are also two-a-penny) and thus will tend to get paid more also because they will tend to get jobs in larger organizations, while PHP developers will end up in SME's.

    It really depends on how much time and effort you want to invest. Ideally, you should look at learning Java initially (with a course) and once you have the basics, start on PHP, which should come easily. This will give you both the best grounding and widest number of options in the long term.

    In short, quick entry to market; go for PHP. Long game plan; Java.


  • Registered Users, Registered Users 2 Posts: 19,049 ✭✭✭✭murphaph


    I am no expert (beginner PHP guy) but the company I work for (which does projects for other companies around the world) has recently rebuilt 2 enterprise level sites after their initial Magento launch platforms became overwhelmed. Both sites were online shoe shops. One was rebuilt with Java and the other with a custom PHP solution.

    I think as PHP matures and offers more functionality (at present Java can still do a lot more things than PHP as the libraries are a good deal larger) it will see more and more deployments in enterprise level applications.

    The rebuilt PHP deployment is PHP all the way through with different applications running the front end, back end (order processing etc.) and the tool used for product management etc. It took approximately 1 year to rebuild with about 10 developers there for most of that time.

    We can't find good PHP developers at all (staff get a €2,500 bonus if someone they recommend becomes a full time employee which is kind of unheard of here) in Berlin. I guess it's dependent on where one lives/works. Java developers meanwhile (according to a fairly senior Java guy I know here in another place) find it hard to find work in Berlin as the demand isn't really there for their skills. They undoubtedly would be well paid if they moved to Munich or wherever. Perhaps this will change as the IT scene in Berlin matures.


  • Registered Users, Registered Users 2 Posts: 2,021 ✭✭✭ChRoMe


    murphaph wrote: »
    I am no expert (beginner PHP guy) but the company I work for (which does projects for other companies around the world) has recently rebuilt 2 enterprise level sites after their initial Magento launch platforms became overwhelmed. Both sites were online shoe shops. One was rebuilt with Java and the other with a custom PHP solution.

    I think as PHP matures and offers more functionality (at present Java can still do a lot more things than PHP as the libraries are a good deal larger) it will see more and more deployments in enterprise level applications.

    The rebuilt PHP deployment is PHP all the way through with different applications running the front end, back end (order processing etc.) and the tool used for product management etc. It took approximately 1 year to rebuild with about 10 developers there for most of that time.

    We can't find good PHP developers at all (staff get a €2,500 bonus if someone they recommend becomes a full time employee which is kind of unheard of here) in Berlin. I guess it's dependent on where one lives/works. Java developers meanwhile (according to a fairly senior Java guy I know here in another place) find it hard to find work in Berlin as the demand isn't really there for their skills. They undoubtedly would be well paid if they moved to Munich or wherever. Perhaps this will change as the IT scene in Berlin matures.

    If you have a good grasp on Java you will pick up PHP very easily.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 1,042 ✭✭✭Groinshot


    ChRoMe wrote: »
    If you have a good grasp on Java you will pick up PHP very easily.
    If you have a good grasp of *insert programming language here* you will pick up *insert other programming language here* very easily...


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Groinshot wrote: »
    If you have a good grasp of *insert programming language here* you will pick up *insert other programming language here* very easily...
    Hmmm... don't know if I'd agree with you on that one.

    Certainly, if you have a good grasp of any programming language you will pick up others more easily; programming fundamentals (regardless of the language is procedural, OO or whatever) tend to be the same across the board. However, when languages are more forgiving or not explicit or abstract too much under the hood (as it were) it means you miss out on many such fundamentals, because you don't 'need' to know them.

    This can create problems later as you have to 'unlearn' many habits you picked up, before learning from these 'new' fundamentals.

    I started, many years ago, with BASIC and much later Visual Basic. Moving to other languages that more strictly enforced types or required more under the hood development, such as pointers, did present an additional struggle for me when I moved to them. As did getting into OO; I shudder to think about the first Java project I worked on. Everything was static.

    In retrospect, I would have been better with Java first and then moving to other languages. Of course, this is a moot point, because Java didn't exist when I began coding.


  • Registered Users, Registered Users 2 Posts: 1,042 ✭✭✭Groinshot


    Absolutely true. But the rules should be the same/similar for PHP, or for java.
    I shouldn't have a variable called $number and store a number in it, only to later on use it for a string, because that would be bad practice. If you get the idea behind it, and understand the logic of different data types etc, you're well on your way. It's all just a case of learning a new syntax then.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Groinshot wrote: »
    Absolutely true. But the rules should be the same/similar for PHP, or for java.
    I shouldn't have a variable called $number and store a number in it, only to later on use it for a string, because that would be bad practice. If you get the idea behind it, and understand the logic of different data types etc, you're well on your way. It's all just a case of learning a new syntax then.
    They're not the same though. I can store a number in $number, and then a character. Even when it's a number, I can store one and don't really care if it's an int, float or whatever. Less said about how I can so what I like with arrays in PHP the better.

    Being able to do that can form a lot of bad habits and you really see that from the quality of the code of a lot of the PHP out there. I know from experience that undoing bad habits can waste a lot of time.


  • Registered Users, Registered Users 2 Posts: 1,042 ✭✭✭Groinshot


    They're not the same though. I can store a number in $number, and then a character. Even when it's a number, I can store one and don't really care if it's an int, float or whatever. Less said about how I can so what I like with arrays in PHP the better.

    Being able to do that can form a lot of bad habits and you really see that from the quality of the code of a lot of the PHP out there. I know from experience that undoing bad habits can waste a lot of time.
    I know you CAN, but you shouldn't is what I'm saying....


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Groinshot wrote: »
    I know you CAN, but you shouldn't is what I'm saying....
    I agree, but between PHP and Java, which language is a newbie going to be more likely to be doing things that they shouldn't?


  • Registered Users, Registered Users 2 Posts: 2,021 ✭✭✭ChRoMe


    Groinshot wrote: »
    If you have a good grasp of *insert programming language here* you will pick up *insert other programming language here* very easily...

    Thats not true at all, ffs.

    For example would someone who could write VB, be able to very easily pick up c++?


  • Registered Users, Registered Users 2 Posts: 2,021 ✭✭✭ChRoMe


    I agree, but between PHP and Java, which language is a newbie going to be more likely to be doing things that they shouldn't?

    PHP, obviously.


  • Registered Users, Registered Users 2 Posts: 1,311 ✭✭✭Procasinator


    I agree, but between PHP and Java, which language is a newbie going to be more likely to be doing things that they shouldn't?

    Which one are they more likely to be writing useful software and potentially get a job quicker and easier (for web development) seems to be the OPs question though. My initial instinct at least for the first part of the question would be PHP.

    Obviously there are best practices for both, and in both you can choose to ignore them... It is true that it's easier to do it in PHP though. :P

    Edit: Looking at one of your earlier posts, I'm pretty sure you agree.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    ChRoMe wrote: »
    PHP, obviously.
    D'doh! Thanks for that Monsieur de la Palisse.
    Which one are they more likely to be writing useful software and potentially get a job quicker and easier (for web development) seems to be the OPs question though. My initial instinct at least for the first part of the question would be PHP.

    Obviously there are best practices for both, and in both you can choose to ignore them... It is true that it's easier to do it in PHP though. :P

    Edit: Looking at one of your earlier posts, I'm pretty sure you agree.
    Yes and no. As I said in one of my earlier posts, PHP is a faster way to get into the dev game, where you're doing commercial viable (and thus remunerated) work, however the price you pay is that you will take longer to learn more complex languages than if you'd gone for a language like Java first.

    This is important because the dev game is about constant retraining and updating. Unless you want to base your future career of legacy work, you're going to have to adapt and learn new languages quickly, and I can tell you that bad habits learned from easy languages take years to unlearn.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 2,021 ✭✭✭ChRoMe


    D'doh! Thanks for that Monsieur de la Palisse.

    Yes and no. As I said in one of my earlier posts, PHP is a faster way to get into the dev game, where you're doing commercial viable (and thus remunerated) work, however the price you pay is that you will take longer to learn more complex languages than if you'd gone for a language like Java first.

    Depends, you might find someone's uptake quicker not starting with strongly typed variables. Most of the bad habits I find are nearly language independent, stuff like mixing logic with mark up.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    ChRoMe wrote: »
    Depends, you might find someone's uptake quicker not starting with strongly typed variables.
    I don't think anyone is suggesting that uptake of a language like PHP would not be faster than Java, of course it would. That's why PHP is a better bet in the short term.

    It's the bad habits that would come with a more forgiving language that will be a problem later on, because 'unlearning' them takes considerably longer than 'learning' them.


  • Registered Users, Registered Users 2 Posts: 2,021 ✭✭✭ChRoMe


    I don't think anyone is suggesting that uptake of a language like PHP would not be faster than Java, of course it would. That's why PHP is a better bet in the short term.

    It's the bad habits that would come with a more forgiving language that will be a problem later on, because 'unlearning' them takes considerably longer than 'learning' them.

    I'm saying as a path of progression, some light PHP work to get introduced to the basics of flow control and that sort of thing, in some cases would make the java learning better.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    ChRoMe wrote: »
    I'm saying as a path of progression, some light PHP work to get introduced to the basics of flow control and that sort of thing, in some cases would make the java learning better.
    Perhaps, but I still think the cost of the bad habits learned will more than make up for this.


  • Registered Users, Registered Users 2 Posts: 1,311 ✭✭✭Procasinator


    Yes and no. As I said in one of my earlier posts, PHP is a faster way to get into the dev game, where you're doing commercial viable (and thus remunerated) work, however the price you pay is that you will take longer to learn more complex languages than if you'd gone for a language like Java first.

    I don't know if I agree with that, though.

    I remember when I was a teenager trying to self-learn C++ for a while with only a little success. I understood the basics of what was happening, but I couldn't produce of anything of use quickly, and as such didn't really learn to think about problem solving. To busy playing with type conversions and pointers.

    I then learned JavaScript for in-browser hacks, and as you probably know, you can do a lot of hideous code in JavaScript.

    When going to other languages from there (such as PHP, Java, C#, C++, etc), I did not feel hindered by my experience playing with JavaScript - if anything, it helped, as I learnt to think like a programmer and solve problems. In the very least, it didn't slow me down.

    While bad habits can be a problem, I think it's more to do with the paradigm shift or language specific features that cause confusion. The whole I can do this in X, but not in Y attitude. But this is going to happen no matter what direction you were going.

    I also knew PHP before I knew Java - the fundamentals of good design and general programming practices remain the same. You have to understand why things are different, but it's still easier then understanding from scratch.

    It's mostly additive information you are learning, not contradictory, I find.


  • Registered Users, Registered Users 2 Posts: 2,021 ✭✭✭ChRoMe


    Perhaps, but I still think the cost of the bad habits learned will more than make up for this.

    I could see that being an issue if the person spent a long time in PHP before, eh "graduating" to java or similar. Otherwise its not going to be, being able to write any code is a step in the right direction.

    I see many other senior devs with your same opinion, sometimes I wonder if its attributed to the fact that when you are writing code for a while, you forget what its really like as a beginner.


  • Registered Users, Registered Users 2 Posts: 1,042 ✭✭✭Groinshot


    ChRoMe wrote: »
    Thats not true at all, ffs.

    For example would someone who could write VB, be able to very easily pick up c++?
    Can't speak for VB, as I've never used it, but sure, why not?
    I appreciate they're completely different, but if you understand the concepts of a variable, of comparison, conditional statements, loops, It's going to make any language much easier, no?


  • Registered Users, Registered Users 2 Posts: 2,021 ✭✭✭ChRoMe


    Groinshot wrote: »
    Can't speak for VB, as I've never used it, but sure, why not?
    I appreciate they're completely different, but if you understand the concepts of a variable, of comparison, conditional statements, loops, It's going to make any language much easier, no?

    The level of abstraction is the issue and its a lot harder to go "down" (closer to the metal) than it is to go up. At the higher levels the transition can be easier.

    For those very basics you mention it is correct, I was referring to a situation where someone learning PHP after Java has essentially less work, rather than going from PHP to Java


  • Registered Users, Registered Users 2 Posts: 1,042 ✭✭✭Groinshot


    ChRoMe wrote: »
    The level of abstraction is the issue and its a lot harder to go "down" (closer to the metal) than it is to go up. At the higher levels the transition can be easier.

    For those very basics you mention it is correct, I was referring to a situation where someone learning PHP after Java has essentially less work, rather than going from PHP to Java

    Even still though, Javas manages it's own memory, so wouldn't make as much of a difference. I doubt the OP will be dealing with memory management any time soon, It'd be more worth his while getting to grips with the basics, and whether that's in PHP or Java, that's up to him. Either way, it's easier to make the transition from one to the other than it is to learn the first one from scratch.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 1,311 ✭✭✭Procasinator


    The main difference I see between PHP and Java is it's type system, particularly that Java is static. There are of course others, but this would be the biggest hurdle I'd imagine.

    When you think about it, static/strong typing isn't really a better representation of the metal than dynamic/weak typing.


  • Registered Users, Registered Users 2 Posts: 2,021 ✭✭✭ChRoMe


    The main difference I see between PHP and Java is it's type system, particularly that Java is static. There are of course others, but this would be the biggest hurdle I'd imagine.

    When you think about it, static/strong typing isn't really a better representation of the metal than dynamic/weak typing.

    It is because its forcing you to think about the type of data you are storing in memory. Its a far way from C, but its definitely closer.


  • Registered Users, Registered Users 2 Posts: 1,311 ✭✭✭Procasinator


    ChRoMe wrote: »
    It is because its forcing you to think about the type of data you are storing in memory. Its a far way from C, but its definitely closer.

    But closer to the metal, that is not generally the case.

    For instance assembly, which is usually the closest most people will get to the metal. It is generally untyped. You can do whatever you want in code, and you'll find out later in run-time if you've done it wrong. It's true you are forced to think about the type of data you are storing in memory, but not by the compiler, but by non-functioning code, undefined behaviour or maybe even segfaults.

    Type-safe languages attempt to prevent this kind of errors from happening, but that is not to say they are closer to the metal.


  • Registered Users, Registered Users 2 Posts: 2,021 ✭✭✭ChRoMe


    But closer to the metal, that is not generally the case.

    For instance assembly, which is usually the closest most people will get to the metal. It is generally untyped. You can do whatever you want in code, and you'll find out later in run-time if you've done it wrong. It's true you are forced to think about the type of data you are storing in memory, but not by the compiler, but by non-functioning code, undefined behaviour or maybe even segfaults.

    Type-safe languages attempt to prevent this kind of errors from happening, but that is not to say they are closer to the metal.

    True its a general characteristic rather than a rule. Generally I think it is the case, but of course there are specific instances where it doesn't hold true. Personally I prefer a compiler choking on something rather than having to hunt down weird run time behaviour


  • Registered Users, Registered Users 2 Posts: 1,311 ✭✭✭Procasinator


    I suppose thinking about types is a more low-level task, and some languages (such as PHP) allow you to think less about them. In Java you can't re-use variables on unrelated types nor avail of as much implicit type conversions as PHP. But I don't think that is much of a roadblock to moving from say PHP to Java as being made out to be.

    I'd argue a PHP and Java programmer would struggle moving to C anyhow, and the Java programmers advantage wouldn't be that significant (assuming an equal level of experience).


  • Registered Users, Registered Users 2 Posts: 2,021 ✭✭✭ChRoMe


    I suppose thinking about types is a more low-level task, and some languages (such as PHP) allow you to think less about them. In Java you can't re-use variables on unrelated types nor avail of as much implicit type conversions as PHP. But I don't think that is much of a roadblock to moving from say PHP to Java as being made out to be.

    I'd argue a PHP and Java programmer would struggle moving to C anyhow, and the Java programmers advantage wouldn't be that significant (assuming an equal level of experience).

    Its one of the biggest differences,but how many problems it causes for someone starting out is dependent on the student.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 19,049 ✭✭✭✭murphaph


    I'm currently doing the HTML/CSS/JS for a Java project and my team lead offered to show me some Java which I'm gonna take him up on. I looked at Java a while back so know the basics but not in a web app sense (that stuff strikes me as very different to PHP, using Tomcat etc. I mean) and the way the framework (stripes) is coded is really different to the way PHP can be directly embedded in HTML and the PHP engine on the web server will interpret it and spit out the proper HTML-all that seems really quite different in Java.

    Anyway, while he was showing me he mentioned that Java 6 does indeed allow a sort of "weak typing". He said it's now possible to declare an "integer" object and not initialise it and then to assign that object to an integer primitive, that is potentially assign null to a primitive, which could lead to a null pointer exception. Sure enough the IDE he uses highlights the "danger" (if you hover over the assignment!) but the language does allow it and I guess some IDEs wouldn't even highlight that and it would only be discovered at runtime.

    He said he's not sure if it's a good thing or a bad thing that it's now possible to do this.


  • Registered Users, Registered Users 2 Posts: 2,021 ✭✭✭ChRoMe


    murphaph wrote: »
    I'm currently doing the HTML/CSS/JS for a Java project and my team lead offered to show me some Java which I'm gonna take him up on. I looked at Java a while back so know the basics but not in a web app sense (that stuff strikes me as very different to PHP, using Tomcat etc. I mean) and the way the framework (stripes) is coded is really different to the way PHP can be directly embedded in HTML and the PHP engine on the web server will interpret it and spit out the proper HTML-all that seems really quite different in Java.

    Anyway, while he was showing me he mentioned that Java 6 does indeed allow a sort of "weak typing". He said it's now possible to declare an "integer" object and not initialise it and then to assign that object to an integer primitive, that is potentially assign null to a primitive, which could lead to a null pointer exception. Sure enough the IDE he uses highlights the "danger" (if you hover over the assignment!) but the language does allow it and I guess some IDEs wouldn't even highlight that and it would only be discovered at runtime.

    He said he's not sure if it's a good thing or a bad thing that it's now possible to do this.

    That is a feature that has been around since Java 5. Its called autoboxing, personally I wouldn't consider it weak typing. Its a good thing, cleans a lot of crap out of code.


  • Registered Users, Registered Users 2 Posts: 116 ✭✭aficionado


    Advice has been great here, Some of it over my head so think I'll go for the more accessible option!
    Signed up for the php course so hope it goes well and I dont get bad habits!
    Thanks for your help


Advertisement