I have a secret desire to be a Renaissance Man. It might seem silly to you, but I have a deep-seated desire to be well educated, write well, play a musical instrument, dabble in art, etc. I’m honestly not certain how much I’ll be able to accomplish in my life, but what I do know is that I don’t want to relax in contented existing. I want to learn how to play a guitar. I want to learn how to run a business. I want to learn how to paint. I want to be more than I am.
I want to push. I want to strive. I want to stretch myself to accomplish things that are as yet impossible for me to do. One specific aspect of myself that I want to improve is my web knowledge. Now that I’ve got a solid grasp on web design I have started trying my hand at the back-end work involved in development. And this is where I need some input. If I want to become a WordPress guru I’m going to have to speak PHP. Same with Drupal or most other CMS’s.
I know CSS and XHTML like the back of my hand. I’m 100% comfortable with them. What would you recommend I master next? PHP? MySql? Javascript? Ruby? What will be most useful? Furthermore, how does one put these skills into practice? I learned XHTML and CSS by hacking my blog apart. How would I learn Javascript or PHP?
Thoughts?






13 Comments
Although it won\’t help you with Wordpress, I would go with a web framework like Ruby on Rails. Through one programming language (Ruby), you\’ll be able to do data-driven applications, ajax-type user interactions and all kinds of other fun stuff.
Personally, I\’ve been into an equivalent system Django (based on the Python language) but that\’s because I prefer Python. The only difference really is no built in AJAX support but you can accomplish that through a really nice toolkit like Dojo Toolkit.
(I\’m a random dude on the Internet but I stumbled upon your blog through EdTechPost and I was compelled to comment because of my recent love for Django and Rails
). Good luck!
Ben,
Personally I\’d say start with either JavaScript or PHP, but to be honest, Ruby (and Ruby on Rails), Python (and Django) are also good as well. There are tonnes of tutorials online for the respective languages and there are also books available (some free books as well). So start out with those. Then build a little project/application to put what you have learnt into practice. If you choose PHP, it could be something as simple as writing a plugin for Wordpress or Textpattern.
By the way more than likely whichever you choose (whether PHP, Ruby, or Python) at some point you will be interacting with a database and in that case you\’ll be learning MySql (or some other Relational Database e.g. Postgres) along the way.
Once you\’ve got a grasp of one language, making the transition to another shouldn\’t be too difficult and also opens your eyes to a different way of doing things.
Another thing I\’ve found helpful once you\’ve grasped the basics or even a firm knowledge of a language, is that I like to look at the code of others to see how they do things. That\’s the beauty of Open Source. There are tonnes of free PHP, Ruby/Ruby on Rails, Python/Django applications freely availabe for you to download and use and look through the code. It has helped me a whole lot.
If there is any way I can help, whether it be links, books, etc…don\’t hesitate to ask.
Peace and God bless.
You should definitely learn JavaScript (no alternative to that but Flash), plus a server-side language of your choice (where the options are more varied) - For me, it\’d be PHP, but to each his own.
As for how to learn, I\’ve always done best getting the core concepts understood via reading books, then picking up tidbits by reading blogs. For JS books, I think these are must-reads (in this order).
http://domscripting.com/
http://bulletproofajax.com/
http://advanceddomscripting.com/
Plus, I would be remiss if I didn\’t plug jQuery:
http://jquery.com/
http://www.packtpub.com/jQuery/book/
As for learning PHP, I\’d recommend these books:
http://www.beginningphpandmysql.com/
http://www.friendsofed.com/book.html?isbn=1590597311
http://www.packtpub.com/ajax-php/book
Beginning PHP and MySQL 5 will give you the foundational knowledge. PHP Solutions is like the \”CSS Mastery\” equivalent of PHP. Lastly, the Ajax and PHP book will help round out your understanding of how JS and server-side interact (with practical examples).
Let me know if you\’ve got any questions, Ben. Always happy to help a fellow aspiring renaissance man.
I like the idea of making a WordPress plugin. I think I\’ll go that route to help understand PHP.
Personally, I would prefer to learn PHP and MySQL before ROR. The best approach is finding some kind of application you would like to have then start learning what you need to make it work. Like Yannick said, developing a WP plugin would be a good start.
@Nathan: I\’ve been tinkering around with jQuery and I like it a lot. It\’s a little like CSS. In fact, I\’m using it for the shadowbox effect on my portfolio page.
I also tend to agree that PHP will be more useful at this point in time for me. It also helps that I\’ve been looking at it for a couple years so I\’m at least somewhat familiar with it.
Learn PHP–it\’s widely used and well-documented, plus it\’s not too complicated but can be used with object-oriented programming practices.
I\’ve had a great experience using the [CodeIgniter](http://codeigniter.com) framework–I knew PHP beforehand but knew very little about OOP and the model-view-controller approach, which CI uses but does not force on you.
For programming, I suggest you learn one useful thing first and expand from there.
If you go for Rails or something similar, it will be too much to get a handle on: web framework, database, programming language, weird server setup, program design, etc.
If you go for Javascript, you\’ll be trying to learn programming while dealing with browser quirks. That will seriously impede your learning flow. Javascript doesn\’t have one group of people behind it making it a coherent learning experience, the same way a real language (PHP, Python, Ruby, etc.) does. Javascript is really useful, but I don\’t suggest it to start. The environment is just better when dealing with something else.
As much as I dislike PHP, it\’s a really useful language, especially if you know HTML. If you go with that you\’ll be able to *immediately* find application for what you learn. You can just embed PHP in your HTML and most web servers are already set up to use it. You\’re web pages will get so much more manageable with just a little PHP to remove some of the repetition. A few for-loops and you\’ll be in heaven. A down side is that it\’s (in my experience) not widely used for anything but web pages.
That said, if you\’re willing to delay instant gratification a little bit, I can\’t recommend Python enough. It\’s a very concise, powerful language that\’s very easy to learn. I started with PHP and I literally scowl anytime I have to use it now. It\’s syntax is a relic. The bottom line is you read code more than you write it, and having an elegant and powerful way of expressing yourself is very important,. You might want to just check out the way Python / Ruby / PHP / Perl look, and see which one makes the most sense to you right off the bat.
Since most people seem to be advocating PHP (and it would probably make sense for you to learn) I\’ll drop a few of my issues with it. I don\’t mean to start a language war, so please don\’t take any of my comments personally PHP guys. Please feel free to tell me what you personally don\’t like about Python from your experiences with it. Let\’s be friends.
THINGS I DON\’T LIKE ABOUT PHP
-You have to prefix every variable with a $ symbol. This is so unnecessary with syntax coloring, not to mention it means (as far as I know) you can\’t pass functions and classes around as variables (which is neat and useful.)
-You have to end every line with a semi-colon (unless you want a multi-line statement, but that\’s not often, and generally bad idea.) To me, it\’s the equivalent of verbally ending every sentence with the word, \”period.\”
-Things have a decidedly low-level C-like feel. I\’m just sick of C-style for-loops. I admit I haven\’t used PHP5, so you might have better syntax now.
-Arrays feel clunky and hard to work with. (Maybe it\’s better in 5, but I don\’t know.) It\’s important for things to feel good to use.
-Complex projects that have to include lots of PHP files always get unmanageable. Every single one I\’ve ever written or come across. I would really love to see a good example. I read PHP code and go, \”what? huh? why?\” It\’s harder to tell the intent of the program just by looking at it. Good program design and comments help, as with anything, but I find Python to be much more self-documenting. (Not to mention that python comments make it literally self documenting. You can inspect anything and get it\’s documentation comments.)
-The namespace is clogged. (This is a big one.) Check out the built-in function list here:
http://www.php.net/quickref.php. There are literally 3800 of them. For related functions, you have similar names, but no actual relation. This means you need to remember a lot of different functions, and it\’s hard to explore related functions because they\’re not organized. To contrast, Python has (I believe) 71 built-in functions. They provide the core functionality of the language that you deviate from depending on what you\’re doing. Python has a large standard library, so batteries are included.
-PHP is verbose.
Here are some PHP functions:
array
array_change_key_case
array_chunk
array_combine
array_count_values
array_diff
array_diff_assoc
array_diff_key
You can see that they get pretty long. Just scroll through that list of PHP functions and you\’ll see what I mean. Python organizes itself into modules dedicated to certain tasks, and you can import them at runtime so you don\’t have to load stuff you don\’t need. If PHP you do
$n = array_count_values($some_array);
In Python you do:
n = len(array)
It just makes more sense to me. (The Ruby people will tell you that length should be a method of all objects, and I don\’t totally disagree.)
THINGS YOU MIGHT NOT LIKE ABOUT PYTHON:
-Whitespace counts (some of the time). Thought I think this is sensationalized at times, it\’s important to know that Python uses indentation instead of {curly braces} to denote blocks of code. (To my knowledge that\’s the only place that whitespace is more significant that in other languages, so it\’s not like you\’re wrestling with it in your actual lines of code, you just indent the lines when you need to.) What I found, is that I always indent my code anyways, and that the curly braces were just decorative anyways. I feel the same about the $variable_names and end-of-line semi-colons. They\’re relics, and they clutter up your code with symbols that make it harder to read. Programming is hard enough that you should remove unnecessary things. Just having to type all those ; and ${} (two keystrokes for those!) is a serious increase in must-do practices. Bottom line is that the whitespace was natural after just a couple days of using it.
-It\’s not as widespread as PHP. This means that it\’s not the defacto web language that everyone supports. But you don\’t need every host to support it, just your host. It\’s not difficult, and a lot more people do support it these days.
Compare PHP:
function do_something(arg) {
echo \”Hello my name is $arg\”;
}
do_something(\”Zack\”);
With Python:
def do_something(arg):
print \”Hello my name is\”, arg
do_something()
As a designer, I think you will really care what your code looks like. And that\’s why you\’ll probably like Python.
For the second code example, the whitespace got eaten, here they are again with underscores instead of spaces, so you know what I mean. (I guess that\’s another downside, it\’s harder to post random code in blogs if there isn\’t a CODE tag or something.)
function do_something(arg) {
____echo
Ben:
ScottBruin has made a good suggestion for a PHP framework if/when you need one. CodeIgniter is really easy to use, has great documentation and a great community behind it. There is also CakePHP and a host of others, but for me, CI is the easiest.
Zack: \”If PHP you do: $n = array_count_values($some_array);\”
Try sizeof($some_array); There… only 3 more chars.
I disagree with most of your comments, though, comments about PHP - as most of them seem to be personal frustration that stems from an incomplete knowledge of the underlying structure of PHP itself.
Why is it problematic to prefix variables with $ if they\’re typeless/auto-typed anyway? $n is shorter then int n, string n or char n… isn\’t it? Add to that that type conversion is done automatically (say you use strlen() on a variable, it presumes it\’s a string and converts appropriately) - or can be done explicitly if you need to (though I rarely ever have needed that feature - and I have over 8 years experience with PHP).
The PHP namespace is quite crowded, yes, but that\’s not such a bad thing as it may initially seem. (Bearing in mind, a decent number of those you referenced do have to be compiled in, rather than being compiled by default). If you want a function, no need to go and find a library for it (most of the time), it\’s already there - ready to use. And finding related features isn\’t so difficult at all, it\’s just learning the style in which the functions are named.
As PHP is geared towards the web, it simply tries to implement the majority of common web features. This also promotes ease-of-use for the developer - as after setup, very little needs to be done to the server\’s configuration to perform almost any task you\’d need on the web. No recompilation (usually), no including of additionally libraries, etc. - it just works.
Debugging PHP can be a nightmare, though - as it\’s not *that* verbose, even at the highest error reporting level. But, once you get the hang of it, most of the time it\’s not a problem. I\’ve certainly seen easier languages to debug, though.
I\’ve left your comment about PHP code structure until last - because it\’s a complete load of rubbish. Like any language, it\’s only a mess if you make it a mess (to a great extent). I\’ve seen plenty of completely tidy and intuitive PHP code, and I\’ve also seen plenty of crap Python code. Just because you haven\’t experienced tidy/intuitive PHP code, doesn\’t mean tidy/intuitive PHP code isn\’t possible.
A language is simple to read and understand if you spend the time to put yourself in the right frame of mind. But just because a language is easy to read - doesn\’t make it a good language, either.
I\’d say that PHP and Python are both good options - but PHP would be a better option (even if it doesn\’t \’suit\’ you better) due to it\’s more widespread acceptance, and greater demand for it in the business and commercial sector (though, many businesses these days are moving towards ASP.NET, as they migrate to IIS servers).
Basically, find something that will - above all - be the *most useful* to you, not the one that looks best on first glance… looks can be deceptive.
My two cents.
James,
You\’re quite right about a few things. I didn\’t look up array_count_values(), and realized after I posted that it wasn\’t equivalent to len(). The point still stands the an_array.count(x) is more concise (and less unnecessary) than array_acount_values($an_array, x); though.
As for prefix variables with $, the problem is that you just don\’t need to do it. $n is shorter than int n, char n, but not shorter than just n. I happen to think that automatic type conversion is a bad thing in most cases because it can lead to confusing bugs. I take it that you agree since you don\’t use it much.
Not having to use an index to iterate over everything is very nice, and really makes code more readable. Just because it\’s code doesn\’t mean that it has to be arcane.
I think you misunderstand how the Python standard library works. It\’s part of the standard python installation. Same as PHP, you don\’t have to go looking for a library (although Python has very good third party libraries that are easy to install.)
If you want system utilies, you just type \’import sys\’, which brings it into it\’s *own* namespace (sys.function_name) rather than your into namespace (function_name) where it can clobber your stuff. You can, of course, import them directly into your namespace if you want, but most of the time it\’s more clear where stuff comes from (especially in larger projects) if you don\’t. In PHP you include or require one of your own files and who knows what it brings into your namespace? In Python, you have more control, which leads better overall comprehension.
You\’re right that lots of those functions are specific compile-time choices. I still think it\’s very crowded. As for learning the style in which they\’re named, yeah, you can do that. And it works fine. But, in Python, having them organized into modules that are self documenting is *better*. I don\’t mean to slam PHP. I really liked it when I used it, but now that I\’ve tried other things I see it\’s weaknesses (and strengths.)
You\’re right on about PHP being geared towards the web with no setup.
Thanks for dismissing my criticisms of PHPs code structure with a general statement. Sure, any language can be written as rubbish or gold. But some things make it easier to write good code, and some make it harder. Your argument says that you don\’t think that the syntax of a language matters very much. I very much think it does matter.
I agree that \’easy to read\’ doesn\’t necessarily mean good. But I think I did a pretty good job of describing what I thought Python was when I said: \”It
Well, besides the fact that most of the later comments here are way over my head, I do appreciate all the advice. Thanks again folks!