

Ask HN: Web programming... Where to start? - alexgodin

Let me begin begin by introducing myself I'm 17 and I love thinking about startups and the web (This is my most notable accomplishment in this field: foodo.me). But it's hard to implement projects you come up with if you don't know a little bit of how to code.<p>So I've decided I need to learn to program for the web. Previously I took Stanford's intro to CS class via their online program (http://see.stanford.edu/see/courseinfo.aspx?coll=824a47e1-135f-4508-a5aa-866adcae1111) and learned a little bit of Java through that. However, I have had trouble continuing and figuring out where to go next. I've dabbled in Python(using the google course), PHP(briefly), Rails(using Michael Hartl's Rails tutorial) and even tried doing GAE in Java. But I keep failing miserably. I need advice on a way for a total noob to get started with web programming. I know people who can answer questions about most languages so that's not a factor. I just need solid advice and a jumping off point.
======
Periodic
I think Rails or basic PHP are good places to start. There are plenty of
screen-casts and tutorials out there for both. They may not go into depth, but
they will help you learn the basics of web programming. You should move off of
either once you are comfortable as there really is a huge ecosystem of web
programming languages, frameworks, and practices and it will take some time to
find the one you really like best. I am going to assume that you are not
interested in the HTML, CSS, and JavaScript aspects of web programming at this
time.

PHP is a good start because it is simple. It is fairly trivial to set up a
quick LAMP (Linux-Apache-MySQL-PHP) server. The Ubuntu Server distribution
even has a system configuration option for it in the installer. It's also very
simple and easy to create a minimal dynamic page such as one that stores the
data from a form in a database and displays it, or does some minor
calculations. The ease of set up and the ability to just plop some <?php ?>
tags in HTML are PHPs real strengths for the beginner. PHP does not lend
itself to large applications without careful thought and experience with
organization.

Ruby on Rails is a decent framework for the beginner because it is so
opinionated and will do a lot of the defaults for you. You will likely
generate a few models and scaffolds and can fill in the gaps with your
application logic. It is a lot more complex than just starting with PHP,
particularly in terms of integrating with a real web server. The benefit is
the opinionated programming and sensible defaults. Having the framework make
some good guesses for you frees you from having to make every little decision
before you understand it. As you get better at the framework you will realize
why these defaults are so sensible and you will learn a style of web
programming that many smart people have worked to refine. The major limitation
will be that it can be hard to do things that the framework didn't expect, and
writing your own plugins is leap in complexity from setting up simple apps.

In short, PHP is very easy to set up for simple pages, but quickly gets
cumbersome without experience as the size of the application grows. Ruby on
Rails is also easy to get started with, and will expose you to many good
practices, but it provides a narrow path for development.

Start with one of those two, then try out whatever you think is cool once you
know what all the buzzwords on their home page mean.

------
rjbond3rd
1\. Learn HTML, at least enough to make a form.

2\. Learn CSS (just enough to stylize the form fields).

3\. Learn to validate the form with Javascript and the DOM.

4\. Create a very basic CGI script (in any language) to display (echo) what
you entered on the form.

5\. Extend the script so that you can store the contents of the form fields in
a SQL database.

6\. Feel confident. Now discover all the vulnerabilities and try to deal with
them.

7\. Learn to read and parse the Apache log files.

8\. Now pick any language, and any framework, and learn how to do all of the
above at a higher level of abstraction.

9\. Learn a couple more frameworks in different languages. Build the
obligatory web app (a content manager, a web crawler, search engine, reddit
clone, whatever).

10\. Now create your own framework from scratch. Whoa!

11\. Now dump the framework, and code again with no abstractions. How does it
feel? You are now a guru.

------
brunoc
My favorite easy yet powerful enough web framework to start with is probably
Sinatra. <http://sinatrarb.com> On top of that, Ruby in itself is one of the
easiest language to learn.

This is for the backend. The only thing that is semi-difficult with Ruby web
projects is that a lot of cheap hosting places do not make it possible for you
to use it. Ask around if you need a place to host your projects.

For the front-end (the presentation), learn to write HTML properly by focusing
on what the data you want to present "is" and using the appropriate markup.
This is in a nutshell what we call "semantic markup". CSS comes AFTER your
document looks right in its plain, unadorned html format.

Look at examples from your favorite websites ( Use "view source" in your
browser ). Use Firefox + Firebug to get an idea of how the document is
constructed.

Use google a lot.

~~~
bhoung
try <http://www.sinatrarb.com/> as <http://sinatrarb.com> seems to be
something else...

------
SingAlong
* Learn HTML -> create something simple

* Learn CSS -> create something simple

* Learn Javascript -> create something simple

* Learn to use git to maintain your projects.

* For the backend stuff... read this one: <http://pine.fm/LearnToProgram/> which is a very simple introduction to ruby.

Then try to create some simple stuff (that aren't web apps) with ruby. Like a
program that just helps you shorten your daily work (posting to twitter via
command line, etc).

Then do the Ruby Koans (today i completed 107 of the 269 koans). It's just
thinking + trying + fill-in-the-blanks + learn something on the way. They are
incredibly good and addictive. That way you'll also learn some testing and
good ruby :) <https://github.com/edgecase/ruby_koans>

Then move on to the rails tutorial you mentioned that you read (M.Hart's).
You'll be awesome enough to understand what you are doing. Host your rails
apps on Heroku for free in 2 commands. (heroku create and git push).

That's only the ruby direction. You may choose php or python or whatever you
like. But unless you try something you won't know what you like. So I
suggested the simplest: which is ruby because you also get to deploy the app
in a very simple way to heroku which saves you time to learn.

Hope to see your "Review HN" post soon :)

P.S: Somewhere along the way, learn some SQL :) You'll need it.

------
coryl
Build little things at a time. I'm actually just learning programming as well,
at 23, a bit older than you.

The other day I built my first login/registration system in PHP/MySQL. I was
up for about 6 hours doing it until the morning, but it was very fun and
satisfying. Now that I know how to make a login and register system, I can
start parlaying that into my next projects; maybe a site that has user
profiles, or that lets people post text, upload files, etc.

I tried learning Java a bit ago but didn't continue with it. It was difficult
to grasp OOP as a beginner, but I also had no idea what I wanted to make with
it, and where to start. I think you have to keep your expectations low, fuck
all the hottest libraries, languages, frameworks, etc. You can't expect
yourself to be using those off the start, it will only burden your morale when
you fail (and you will fail, because you have no foundation on which to use
those technologies).

Anyway, my suggestion is start building shit that's simple and neat and fun
for you. You can learn the science of programming along the way, but whats
more important is showing yourself that you can do it. Learning is easier when
the task is fun, so don't think that you have to catch up and put out
professional cutting edge scripts. Good luck!

------
kachilous
I think Java is a great language for web programming. I would recommend one of
these two books to get started: [http://www.amazon.com/Murachs-Java-Servlets-
JSP-2nd/dp/18907...](http://www.amazon.com/Murachs-Java-Servlets-
JSP-2nd/dp/1890774448/ref=sr_1_1?ie=UTF8&s=books&qid=1292984397&sr=8-1)
[http://www.amazon.com/Head-First-Servlets-JSP-
Certified/dp/0...](http://www.amazon.com/Head-First-Servlets-JSP-
Certified/dp/0596516681/ref=sr_1_1?ie=UTF8&s=books&qid=1292984667&sr=1-1)

These books cover jsp, servlets and other important aspects of java web
development. Once you fully understand these concepts then you can branch off
and use a framework such as: Spring, Grails, Struts, or Play! to ease the
development of web applications.

------
ig1
<http://railsforzombies.org/>

------
dstein
One trick is to not even try to learn _everything_. That makes programming
seam insurmountable, and may actually slow you down. Instead, stay goal
oriented, pick something to build, and learn how to build it, one step at a
time. You will learn to program by solving one little problem after another.

------
anthonycerra
It's awesome that you're starting so young! I'm learning too and a place I
love to hang out is the #rubyonrails channel on freenode. Look up IRC and
download a client if you're not familiar. There are so many friendly and
helpful people in that room at any given time.

------
knowsnothing613
if you want to learn programming download the CS podcasts from UC Berkeley.
You can get it on Itunes U, or through the Berkeley webcast. It covers 60% of
a CS undergrad program.

As for web programming in PHP, read the PHP cookbook. And the Definitive Guide
to ____ O'Reilly books.

Programming is an art. The more you practice it, the more you become a master.

~~~
knowsnothing613
you can also download a great PHP & javascript course from the University of
Tenessee off Itunes (Itunes U?). Hardvard also had an introductory course to
web development up on Itunes U. So go to ITunes U, and look for the numerous
free web courses being offered.

------
alexgodin
So I forgot to mention it, but I do know some HTML and CSS. (Enough to know
what I need to copy and paste)

~~~
rjbond3rd
Okay, follow-up question.

Can you hand-code an HTML form, trap the form's submission and perform some JS
validation, POST the data to a server-side script of some kind, un-bundle the
submitted fields and then echo them in the server-side response back to the
client? This is an ancient thing called CGI. It's a good starting point, and
of course it's very dangerous to do all that literally.

I see so many people get excited about frameworks, but you need to start as a
bricklayer, then work up to architect and city planner.

Start at the lowest level you can imagine. Standard input / standard output.
Tail the Apache log. Learn the difference between HTTP GET and POST. Use
LiveHTTPHeaders and look at the HTTP traffic. Don't reach for the shiny
framework until you get messy with the dirty bits. Muck around and have fun.

