views:

89

answers:

4

Here's a bit of a twist on the old which do I learn first question you've read a million times before...

I began learning PHP last fall and feel I have become fairly competent in procedural PHP programming.

As my site - the driving reason for these studies - has developed I've reached a point where learning OOP PHP would make for cleaner code and tighter organization on the admin side, but would not allow me to add significant functionality to the user side. (This has more to do with the site design and goals than with any particulars of OOP PHP.)

BUT, beginning to learn Javascript would open up a whole slew of optional improvements I could make (in time) to the site from the user's perspective.

Before recommending that I learn both together, please understand that I'm an expat struggling through a lower management position and at best can spare 4 hours a week to this endeavor. Programming is a passionate hobby, but good blocks of time are hard to find.

So:

Proc PHP -> OOP PHP -> JavaScript ?

or

Proc PHP -> JavaScript -> (maybe later) OOP PHP ?

+1  A: 

This is my opinion only, but if everything on your site is working using the procedural PHP, then learn JavaScript. OOP PHP is nice to know, but if your site is already working, it's not going to make it a million times better just to rewrite it in OOP. Especially if you are going to be the only one using the code (ie, not released commercially/open source). I prefer to spend time writing JS when I can because it is a nice break from doing some lame, brain numbing stuff in PHP.

And whichever way you go, a lot of stuff transfers. Much of the JavaScript written today is done using OOP (JQuery...any other modern JS library).

Jonathan Kuhn
*Much of the JavaScript written today is done using OOP* <-- that's kind of one of my concerns, actually. Will beginning JavaScript without knowing OOP mean I'll just write assy JS?
Andrew Heath
much javascript is still writting in non oop using the DOM. In fact, there are books like "DOM Scripting: Web Design with JavaScript and the DOM" that are REALLY good and cover non oop JS programming. In reality both languages are fairly similar once you get the syntax changes. Most things like your loops/conditionals are basically the same.Edit: I just read what umass wrote, and I agree that I went through a few languages before back to JS and really enjoying it. However I feel that has more to do with the way JS has gone. It's the same, but much has been done to make it enjoyable (jquery).
Jonathan Kuhn
+2  A: 

i prefer you to do Proc PHP -> OOP PHP -> JavaScript first. you cannot concentrate on multiple technologies at a time, only one at a time. so learn one by and build a strong base in it. with this skill go to next and go on. you can learn php and javascript faster, because they are interesting and easy.

what i prefer first you learn php, which will give you the big manuplation skill.

  • managing data.
  • retriving data.
  • flow control.
  • app structure. etc

then you learn javascript, which help to present the data you have, in a appealing way. also learn to use libraries like jquery,dojo, ext js etc. i prefer jquery.

in developing an app the priority should given to data manpulation. and to gui. if you have a big collection of information, but poor gui the succes rate will be low.

so learn php first then go for javascript or libraries like jquery.

Jaison Justus
A: 

Ohh boy.

So my progression was like this: Java --> (Proc PHP, SQL, & HTML/CSS and atempting to learn but DETESTING JavaScript) --> Lisp --> C++ --> OOP PHP (which was really review) --> about 5 pther languages including perl, ruby, etc. --> Javascript libraries like prototypejs & jquery --> Absolutely LOVING JavaScript

Javascript is overwhelming to the novice. I was 2 years out of my CS degree and comfortable with 7 other languages before I began to appreciate the beauty of JS.

OOP is very simple, in PHP it's even simpler. Take the time to learn the OOP basics and then move on from there. If you understand basic single inheritance and overriding methods that's all you'll need for PHP OOP. Don't bother with writing ain interface then programming to the interface so you can write multiple implementations and swap them out and blah blah, it's all loosely typed anyways. There about 1 or 2 design patterns you'll learn to use and won't even know you are using.

IMHO throw both ideas out and focus your time on learning how to design and effectively manage your back end data storage. It's a very neglected skill these days, but much more important than most people want to admit.

If you want though tackle a few JS projects but I highly recommend doing so whithin in the warm safe confines of prototypejs. jquery is probably the most populat right now but there are also 2 or 3 other like dojo, moo tools, or the yahoo API that you can use. I have uses yui, prototypejs, and jquery and I would recommend prorotype to the novice programmer. You also don't really need to know OOP to use these frameworks. You need to understand OOP to BUILD them, but then using them is fairly straightforward with a rudimentary understanding.

umassthrower
A: 

I would also recommend you to start with Javascript, because it's easier (read:faster) to get the benefits out of it.

I'm sorry to say, I didn't learn OOP within PHP, I just rewrote procedural code wrapped in a class. It's only after seeing some other languages (Java, C++, Ruby) that I begin to reap the fruits of object orientation (also in PHP).

giraff