Re: Structured PHP studying

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2010-04-24 at 15:46 +0100, Nathan Rixham wrote:

> David McGlone wrote:
> > On Friday 23 April 2010 07:45:16 Michiel Sikma wrote:
> >> On 23 April 2010 13:15, David McGlone <david@xxxxxxxxxxxxx> wrote:
> >>> Is there a good strategy to studying PHP?
> >>>
> >>> For instance, is there a way to break everything down into small
> >>> managable topics?
> >>>
> >>> --
> >>> Blessings,
> >>> David M.
> >> Just build what you want to build and look things up when necessary. The
> >> biggest part of learning any language is becoming able to creatively solve
> >> problems within its realm of possibilities, and that's something you can't
> >> really learn just by reading and solving textbook problems. Hands-on
> >> experience is a very important key to understanding.
> >>
> >> Keep an open mind, ask people for answers if things get difficult, always
> >> assume that there's a better way to do something, and in a while you'll be
> >> able to write perfectly decent programs.
> > 
> > This is the route I have been following for the past couple years and I have 
> > always assumed there is a better way to do something and that is, in a way 
> > what makes me lose confidence.
> > 
> > I always feel like my code is crap and sometimes even ashamed to even show any 
> > of it.
> > 
> 
> Hi David,
> 
> Really good to see somebody asking for honest advice on a v important
> matter :)
> 
> First, if I may, I'd like to suggest that being ashamed to show your
> code is never going to be a productive way to work, rather the more code
> you show, the more feedback you will get on your code, and often with
> examples of alternative ways to do it - posting snippets and
> opensourcing are great ways of crowd sourcing solid feedback.
> 
> Next, saying your code is crap, we all feel like that sometimes, but
> it's critical to note that if your code does the job it's supposed to,
> then it's a success! A few months ago I was questioning myself again and
> wrote this: http://webr3.org/blog/general/the-wall/ - the point is it's
> a good thing to question yourself, it's a good thing to take everything
> in to consideration, and often I (used to) find myself looking at very
> short procedural ways of doing things and think.. "why am i making all
> these classes"; it's our job as programmers to know when to implement
> something in 10 quick lines that are easy to maintain, and when to
> create an all singing and dancing framework type affair, pros and cons
> to each, and there is no "One True Way" TM of doing things - each bit of
> code is very much dependent on context, scenario and maintenance costs.
> 
> Okay, on to your specific questions!
> 
> We can break this down in to small(~ish) common junks, and which you
> study, take further and in what order is entirely up to you:
> 
> General Coding
> This is the stuff that translates to almost every language, for loops,
> echo'ing, simple code optimisation and basically just how to script and
> program - I'll assume that after two years you've got this nailed better
> than any book can teach you, from here it's just experience and picking
> up tricks on the way, so generally no need to worry!
> 
> PHP
> As you know php is a specific language, and the best way to learn
> everything php specific, is literally to read the manual, from start to
> finish, a few times, and keep referring back to it, if you see something
> you haven't actually used before then give it a quick go in a short 5-10
> line script and have a play, the 2 minutes it takes will be more than
> worth it (by doing it, it'll get engrained in you).
> 
> Aside: in every project i do, and at all times i have a test.php where I
> literally just try out ways of doing things and snippets of code, once
> I'm done i stick an exit; before it then do the next snippet above it,
> this way i always have one nice file of snippets in every project to
> refer back to - they often come in handy for helping on this list
> actually, and in fact sometimes are from peoples code on this list!
> 
> Coding Standards
> One of the biggest factors of feeling your code isn't good enough, is by
> not using any coding standards, this is pretty simple stuff but makes
> your life a lot easier, and code a lot cleaner - even crap broken code
> comes across a lot better when it's nicely formatted lol. A good IDE can
> help you here, as for which coding standards that's up to you, but you
> can check you are adhering to them by using "php code sniffer" -
> personally I opt for a slightly modified version of zend coding
> standards with the odd bit of extra spacing around params etc.
> 
> Paradigms & Design Patterns
> A bit of familiarity with programming paradigms is always a good thing
> http://en.wikipedia.org/wiki/Programming_paradigm
> In PHP we use Procedural and Object Orientated (Class Based)
> If you do OO then it's also very very useful to read up on all the
> Object Orientated subjects though especially "Separation of Concerns",
> familiarity of Martin Fowler's enterprise patterns
> http://martinfowler.com/ is also a good thing, there is also a Java
> pattern guide that's most useful
> http://java.sun.com/blueprints/patterns/ and many transfer over to OO PHP.
> 
> Other Languages
> Yes :) one of the best ways to get good with your primary language (php)
> is to try out and use other languages, for instance if you were to put
> some focus in to javascript (ecmascript), scala, erlang, c, java and
> maybe something like as3 then I'm pretty sure your code and programming
> would improve ten fold I'm sure - I'm not suggesting you learn them all
> but a bit of focus and playing from time to time would be a very good
> thing indeed!
> 
> HTTP and REST
> This is pretty critical if you're making websites, honestly how can we
> create th web if we don't know how it works? REST is the design behind
> HTTP (and not just some weirdy api where you use GET parameters) - in
> fact when i say pretty critical i mean it's entirely critical, the more
> you understand REST and the more familiar you are with HTTP then the
> better your websites, web apps, api's etc will be!
> HTTP: http://www.w3.org/Protocols/rfc2616/rfc2616.html
> HTTPbis (the updated version, work in progress, probably better to read
> to be honest): http://tools.ietf.org/wg/httpbis/
> Architecture of the worldwide web: http://www.w3.org/TR/webarch/
> )you can't argue w/ the makers of the web now can ya)
> REST: http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
> 
> leave it there.. but happy to continue if you need.
> 
> Best,
> 
> Nathan
> 


Great email and nice article. I agree, there is no true way. Just as an
app could be developed in one of a selection of languages, so too the
approach within those languages will differ.

Thanks,
Ash
http://www.ashleysheridan.co.uk



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux