• Home

CodingExperiments.com

Linux, PHP, and the blogosphere

Search

Category:

  • Apple Inc.
  • Apps
  • Facts
  • Fun
  • Google
  • Ideas
  • Internet
  • Linux
  • Microsoft
  • PHP
  • Programming
  • Rants
  • Security
  • Uncategorized
  • web 2.0

Archives:

  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • June 2008
  • May 2008
  • April 2008
  • March 2008
  • February 2008
  • January 2008
  • December 2007

Pages

  • About
    • The Authors
  • Commenting your code
  • How to Write Papers with Groff
  • ModCMS Anti-Spam Component Set
  • ModCMS Technical Specifications
  • Regular Expressions Guessing Game
  • Saving code directly to a web server
  • The (Almost) Perfect PHP 404 Page

Meta:

  • RSS
  • Comments RSS

Awesomeness tracker

CodingExperiments at Blogged View blog authority
Free Page Rank Tool

Python, Javascript, And PHP as Languages for Beginners

June 7th, 2008 by Rishabh Mishra

Introduction

Python, Javascript, and PHP are all known as languages that beginners can use to sink their teeth in programming. Those three language are also frequently used in many commercial applications. Given all these three choices, which language should a beginner learn? Well, here’s the features of the three languages broken down.

Python

Pros:

  • Cross-platform
  • Used on the desktop and server
  • Has a module for everything that you could ever think of
  • Has good documentation

Cons:

  • Indentation is required, and errors will come up if code is not indented properly. UPDATE: A bunch of people told me that they think indentation is good as it teaches newbie programmeres to properly indent their code. I understand the good part of this, but I think that forcing indentation seems extreme. I guess whether this is a con or not is completely up to the developer.
  • It may take some Googling to figure out how to use a certain module. I can tell that from personal experience.
  • It’s not HTML-embedded like PHP or Javascript, so it’s a little more work to write web applications with it.

Python is ideal for the person that wants to create cross-platform applications on the desktop and server, and doesn’t mind having to install Python if they’re on Windows.

Javascript

Pros:

  • All you need to execute Javascript is a modern browser, which is something available on plenty of computers.
  • Reduces server load in web applications
  • With AJAX-style Javascript coding, you can make web applications more like desktop applications
  • In the form of Greasemonkey scripts and similar, Javascript can be used to modify the functionality of other webpages.
  • Since Javascript works with HTML, you can create user interfaces much more easily than with Python.
  • Javascript can be used to make desktop applications with things like Adobe AIR.

Cons:

  • You can’t expect Javascript to act the same everywhere. Different web browsers handle Javascript differently.
  • Users can disable Javascript in their browser, or have a web browser that’s too old for your application.
  • Because of the the first con, Javascript is harder to write and debug

Javascript is a good first language for people that are willing to put work into writing and debugging code, but they do not want to install things. It’s also good for people that want to make HTML pages easier to use.

PHP

Pros:

  • Is server-side like Python, but shares the same ease-of-interface making as Javascript.
  • Is HTML embedded. This makes it even easier to make user interfaces in HTML.
  • You can bet on recent versions of PHP being available on (most good) shared hosting servers due to it’s demand.
  • Has good documentation

Cons:

  • It’s easy to shoot yourself in the foot.
  • Not good for desktop applications at all.
  • The community is filled with newbie programmers showing others code examples with bad programming practices.

PHP is good for people that want to develop server-side web applications quickly, and are okay with the application not being as fast (I can’t find the link to the testing that shows that Python is faster). It is also a good idea to buy a book on PHP in order to learn all the bad programming practices that are often showed in newbie code examples that are posted on the Internet.


Posted in Uncategorized |

  • johnmc
    I would have only one quibble with your web observation on Pythion. Of the three Python is the only language that was not built to be on the web from the beginning. But regardless Python can make a fair showing of its qualities on the web.

    I would suggest a review of three python tools. Karrigell is a full fledged environment. It even provides its own http server. Cheetah and MyGhety are two template languages one could consider. Each has its own strengths and produce fully formed html code.

    There are others of course (Django, TurboGears) that provide the full MVC stack if you wish.
  • Rishabh Mishra (possible248)
    Good observations that Python was not built for the web at the start and that template languages like Cheetah make Python for the web easier to write. I'll look into them.
  • FudgeMan
    I had a look and Karrigell and was very impressed! Why does it seem to be so unknown?
  • MarcC
    Hi there,

    interesting views! I would have my own things to add/comment on:

    - Python can also be used in the .NET world (see "IronPython") which includes ASP.NET, so in essence it can be used for "easy" web development.

    - The Python indentation "battle" has been raging for almost 2 decades now; some see it as a pro, some see it as a con. In the end, any good programmer indents anyway, so its not really an issue (although no one likes to be FORCED to do something...)

    - "It may take some Googling to figure out how to use a certain module." - this is true of most languages, in my experience :-) But yes, more practical examples in the reference library would be a good thing for everyone! Good point!

    - To add to what the above poster mentions, Python was indeed not built for the web (it predates it, really...). This has, in my observation, hindered its success as a mainstream web programming language till recently. The coming of the MVC-style web frameworks have changed the playing field somewhat, and now "Ruby" and "Python" are mentioned as powerful alternatives to PHP (pro: better programming practices are part of the development process).

    Cheers!
blog comments powered by Disqus