Frustrated about learning PHP on your own?! I can relate…

May 4th, 2006 by rvdavid Leave a reply »

Having learnt how to program in a couple of server side languages (ASP1 and PHP) on my own, I must say it had been a very bumpy ride. Lots of mistakes, lots of spaghetti code, lots of questions which the “experts” answered “RTFM” to and lectured you about googling first then asking later instead of “wasting their time” (do I sound bitter? Well I kind of am) .

One small but important lesson that I’ve picked up from my sojourn toward “Professional Web Developerdom” is that it’s not really a matter of intellect in this age of Information Technology, but more a test of patience and attention to detail.

If you’re patient and “google savvy” enough to hunt for information or troll forums, you can learn just about anything you want – as long as you pay attention to certain details (often, you’ll read the important details and it will fly above your head, don’t worry for now though it’ll click one day, you’ll pick it up when you’re ready).

As you continue with your experiments and projects, you’ll find that lessons hit you in the face accidentally as you go along. You get the feeling of rocket fuel in your stomach once it finally “clicks”, then you look outside and notice that the sun is coming up. You go to bed satisfied that you have accomplished something, you’ve made it to the next level you’re advanced, a professional, much better than the spaghetti coders out there… you dream about your chosen language (ok maybe that’s too far).

So then you wake up the next day and try to ingrain this new development in your head and put it into practice… then bang! you hit another wall… Doubts start to seep in, you’re not a professional after all, you’re just another amateur… You’re no better than the spaghetti coders out there who use double quotes for string values and do not check for get_magic_quotes_gpc(), you’re just a glorified Object Oriented spaghetti coder…

This is where patience comes in…

It’s time to step back and practice what you know well, develop with your current skillset and become masterful with them before trying to learn something new. If you’re anything like me, you’d be wincing at every bit of code that looks wrong and get the urge to start searching again. I’ve been down this path, don’t do it, it will lead you back to where you started from… Confused…

To conclude, I’d like to quote many of the virtual mentors I’ve come across in message boards and the like… “you must learn to crawl before you walk, walk before you run, run before you fly” Don’t be discouraged, focus on your strengths… Evolution will come eventually… Do not be paralysed with analysis. Like all good things it comes slowly but surely.

Till next time…

Regards,

R. Villar David

if you enjoyed this post, make sure you subscribe to my RSS feed!
You can also follow me on Twitter here.

No related posts.

Advertisement

9 comments

  1. laserlight says:

    “the spaghetti coders out there who use double quotes for string values”

    Assuming you are talking about PHP, there is nothing wrong with using double quotes for string values.

  2. Villar says:

    “Assuming you are talking about PHP, there is nothing wrong with using double quotes for string values.”

    Yes of course,

    It was an attempt at being satirical I’m afraid ;)

    But since you’ve mentioned it, there IS a slight speed advantage to using single quotes and concatenation instead of double quotes for string values in PHP.

    Whether or not it’s important, varies from programmer to programmer.

    My take on it is… if you can get that little bit of optimisation in performace, then why not do it instead?

  3. laserlight says:

    “there IS a slight speed advantage to using single quotes and concatenation instead of double quotes for string values in PHP”

    Actually, double quote string delimiters have been maligned in that that way. While it is true that one cannot do variable interpolation with single quote delimited strings, the speed gains you speak of come from the concatenation, not from using single quote delimited strings per se.

    “if you can get that little bit of optimisation in performace, then why not do it instead?”

    I agree, since in this case it is not premature optimisation as there is little difference to the programmer between using variable interpolation and concatenation.

    Though I personally use variable interpolation when constructing SQL statements. It seems clearer to me, but that is probably due to the way I format my SQL statements.

  4. Villar says:

    “While it is true that one cannot do variable interpolation with single quote delimited strings, the speed gains you speak of come from the concatenation, not from using single quote delimited strings per se.”

    I am aware of this and this is what I speak of when I say single quotes and concatenation, but again, even by just using string values and not mixing it with variables, single quotes are fraction faster by an insignificant fraction.

    This is because even without variables included inside the double quotes, it is still parsed automatically, whereas those in single quotes are not.

    On a sidenote however, I just want to point out that I am not saying that one is a bad programmer if he or she uses double quotes I was merely trying to highlight the little details one may have paid attention to in trying to be a “better programmer” :P

    “Though I personally use variable interpolation when constructing SQL statements. It seems clearer to me, but that is probably due to the way I format my SQL statements.”

    I too do this for readability reasons.

    $sql = “SELECT *
    FROM tablename
    WHERE name = ‘something’
    AND surname = ‘somethingelse’”;

    Is a lot easier to on the eye than

    $sql = ‘SELECT *
    FROM tablename
    WHERE name = ‘something’
    AND surname = ‘something”;

    Not only that, but you run into trouble when inserting data with multi line values within them.

  5. bpat1434 says:

    “which the “experts” answered “RTFM” to and lectured you about googling first then asking later instead of “wasting their time” (do I sound bitter? Well I kind of am) .”
    You forgot one… “Search the forums!!” That’s what I don’t get. It’s not that those that help don’t want to (or can’t) it’s just that it’s better to help someone learn how to find answers on their own before spoon-feeding them.

    I always loved the chinese proverb:
    Give a man a fish, feed him for a day. Teach a man to fish, feed him for life.

    But then again, Confucious always said: “Man who stand on toilet, high on pot” and “Man who farts in church, sits in own pew” :)

    If you browse forums, you’ll see plenty of times where I either blatantly say RTFM or quote it and don’t really write much at all…. the manual is a source to be used, one should NOT just disregard it. Just because you may be male, doesn’t mean you don’t need to ask for directions ;)

  6. Villar says:

    “You forgot one… “Search the forums!!” That’s what I don’t get. It’s not that those that help don’t want to (or can’t) it’s just that it’s better to help someone learn how to find answers on their own before spoon-feeding them.”

    I happen to agree with the “search the forums” suggestion.

    With regards to spoon feeding, I think there’s a clear line where one can distinguish that the enquirer has done some research or not.

    In which case, should a person enquire about it and expect to be spoon fed, I’d guide them to the right direction for the answer.

    I’m talking about how one posts a 3 paragraph rant about how reading this question has “wasted their time” and not give an answer. I mean seriously, either post something constructive or post nothing at all.

    “I always loved the chinese proverb:
    Give a man a fish, feed him for a day. Teach a man to fish, feed him for life.

    But then again, Confucious always said: “Man who stand on toilet, high on pot” and “Man who farts in church, sits in own pew” :)

    lol :D

  7. Anonymous says:

    To be honest I prefer the one that goes: Build a man a fire, keep him warm for a night, set a man on fire, and you keep him warm for the rest of his life.

    Well, what that’s got to do with PHP I don’t know. I suppose you could compare it with… nope lol

    - Madwormer2 (can’t be arsed to sign in)

  8. Villar says:

    “Well, what that’s got to do with PHP I don’t know. I suppose you could compare it with… nope lol”

    lol

  9. Heffo says:

    Also in PHP when using the echo command it is faster to use parameters instead of concatenation.
    e.g.
    echo ‘Hello ‘, ‘world’;
    instead of
    echo ‘Hello ‘ . ‘world’;

    Not much different but it gives a very slight increase in performance so why not?

Leave a Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.