kodos96 comments on (Virtual) Employment Open Thread - Less Wrong

35 Post author: Will_Newsome 23 September 2010 04:25AM

You are viewing a comment permalink. View the original post to see all comments and the full post content.

Comments (276)

You are viewing a single comment's thread. Show more comments above.

Comment author: kodos96 25 September 2010 08:09:30AM 6 points [-]

Back end programming just means the programming of what you want your site to actually do, as opposed to how you want it to look. i.e. it's the part that actually qualifies as "programming" (coders really hate it when web designers refer to web design as "programming").

If you're just setting up a web site based on an existing code base (like how LW is based on the reddit code), then there may not be any back end programming that needs to be done. But if you're actually creating something original, somebody needs to actually write the code to make it do what you want it to do.

Like say we were trying to create LW from scratch. You've laid out all your HTML and CSS and images and whatnot for how you want everything to LOOK. But there are all these buttons and stuff, like the "Create New Article" button in the top right. You can lay out where that button is and what it looks like, but what actually happens when a user clicks on it? That's where back end programming comes in - probably you respond to the click by creating a new row in an article table in your database, which has a schema you've created, specifying all the fields that need to appear - the article content, the article author, timestamp, maybe the article karma would get stored there too. Then it generates from that a stub article which it passes back to the frontend which then decorates it and renders it for the user.

And then of course there would have to be code written to handle commenting and the karma system. Those would probably be stored in their own db tables with their own schemas you've designed, and you'd have to write the code that takes a user action, like clicking "comment' or "vote up" and actually doing something with that, incrementing the comment's karma count by one and storing that back to the database.....

...thats's back end programming. And as you can see, its definitely not something a hosting provider could just do for you, cause it's very specific to your site and what exactly you want your site to do.

Sorry for being rambly and incoherent.... i took an ambien about a half hour ago and am in that ambien half asleep/half awake/half stoned state

Comment author: Will_Newsome 25 September 2010 08:20:27AM 4 points [-]

Thanks, I'm significantly less confused now, and back end programming now sounds like fun.

Comment author: wedrifid 25 September 2010 08:24:35AM 1 point [-]

It's a lot of fun. Now you're making me whimsical! ;)

Comment author: Will_Newsome 25 September 2010 08:35:48AM *  1 point [-]

Hmuh, this is intimidating. I was gonna pick up some PHP but to actually use it for a project I'll need MySQL and for that I'll need to set up an Apache web server of some kind... which is intimidating, and I'm probably approaching this the wrong way, especially as I'm not sure yet what I'd even be scripting for. Also I feel alienated as a Windows user; I have Ubuntu but it's frickin' annoying sometimes. How do most people get started with this whole hacker thing?

EDIT: Eff it, I'll switch to Linux and play with Django, it seems easiest. Stupid Linux.

Comment author: wedrifid 25 September 2010 09:26:29AM 7 points [-]

There is essentially no reason to bother with PHP these days. It's a relic and you'd end up having to learn all sorts of arbitrary distracting things.

I can empathise with the intimidation. There was a whole heap of linux administration stuff that I had to pick up to get started. Fortunately, you don't need to do anything like that any more and it can be even easier on windows! You can install the whole stack (ie. Ruby, Rails, apache and mysql) all at once. From there you can just find a tutorial to follow then start copy and pasting stuff from similar applications till you have one that does what you want. (You didn't hear 'develop by cut and paste and google' from me! ;))

RubyStack is one option. The one I have used is InstantRails. I think that one is getting out of date (about a year old) but it probably doesn't make any difference for your purposes.

I don't know what the options are for other web development frameworks. I'm sure there is something simple out there for Python somewhere but I just haven't had reason to look into it.

So if you wanted to get started it is easy enough. Depends on your interest.

How do most people get started with this whole hacker thing?

When I have something I want to do I go do it. Sometimes that means learning stuff like programming. Sometimes it means learning pharmacology. That's probably the underlying spirit behind the 'hacker' mindset.

Comment author: Nic_Smith 26 September 2010 05:08:35PM 0 points [-]

There is essentially no reason to bother with PHP these days. It's a relic and you'd end up having to learn all sorts of arbitrary distracting things.

I rather like PHP. Examples of "arbitrary distracting things"?

Comment author: Will_Newsome 25 September 2010 09:32:38AM 0 points [-]

Thanks! Ruby looks good, but I know more Python/Django folk, so it's tempting to leave Windows for a bit. I guess I'll start with the RubyStack and see what I can build. I'm guessing a lot of the basic skills I need are transferable to Django development anyway.

Comment author: wedrifid 25 September 2010 09:38:27AM 0 points [-]

I wonder if there is a "DjangoStack" for windows about someplace. Maybe your friends would know? Not that I'm saying linux is bad, just that you've already got enough stuff to be absorbing without cramming in two languages and frameworks at once. (But you are right, the fundamental concepts are the same.)

Comment author: Will_Newsome 25 September 2010 10:03:56AM *  0 points [-]

I downloaded RubyStack and the install process doesn't do anything; not sure why. It flashes a BitNami logo and then goes blank, but the process is still sitting there in my task manager... maybe it doesn't play nice with 64 bit Windows 7. At any rate BitNami also has a DjangoStack! So I'll try that instead. :/

...and that also didn't work, so it looks like Ubuntu for me, where my problems will be even greater. I hate computers.

Comment author: Morendil 25 September 2010 01:17:54PM *  3 points [-]

So the good news is, you need none of these "stacks". Really. What you're trying to do here is run before you've learned to walk.

Web programming is as simple as writing a program that does

puts "<html>Hello World</html>"

and redirecting the output to "index.html" when you run this from shell. This gets you a dynamic Web site generated from a program that you wrote.

If that's too simple for you, congratulations: you've mastered enough of the fundamentals to get on to the next step. Something like parametrize the Web page to greet you by your name.

You may be protesting at this point that running the program whenever you want to update the Web site wasn't your idea of "Web programming" - you want a Web site that updates on the fly.

Now we're talking about Web frameworks. But still you don't need a "stack", you need to build up an understanding of how Web servers work, and maybe study a few architectures of historical interest:

  • CGI (the way Web programming was done for years, basically a hack to get the "invoke program from command line and redirect output to a Web connection" idea to work on-the-fly)
  • PHP as an Apache module, or what happened when the Web server coders realized the hacks weren't going away anytime soon
  • frameworks like Sinatra, a gentle introduction to Web frameworks in a modern language without excessive baggage

With something like PHP or (if you lean toward Ruby) Sinatra, you're reaching the point of building up arbitrarily complex Web pages in response to HTTP requests, on the fly. At this point you'd better have a solid understanding of how the dance unfolds between Web clients (typically browsers, but not just) and Web servers. What are requests and responses, headers, parameters.

Rewrite your Hello World example in Sinatra. The next exercise is to orchestrate a simple interaction where your Web app displays a form with a text box asking for your name, and a Submit button which takes you to a page greeting you by name. Just this little loop requires you to stay on top of a surprisingly large number of abstractions spanning several layers.

Note that at this point you still don't need a database, knowledge of CSS is superfluous, and client-side scripting very much not even on the agenda. Discussion of design patterns like MVC should be deferred until you have experienced for yourself the issues that these patterns are supposed to solve. (That way, you can judge for yourself to what extent the big frameworks like Rails actually solve the issues. Affective Death Spirals are just as deadly in programming as in the rest of your intellectual development.)

When you feel comfortable with this kind of program (check that by writing a more complex one like a calculator or a tic-tac-toe game), you can move on to one that handles arbitrarily large sets of data. By now if you feel like tackling MySQL, go ahead and do that, but you could also focus on your learning programming (as opposed to learning technology). Get your data from a text file, maybe YAML which is like XML, only much more friendly.

Anyway, that's the kind of learning that works for me: instead of getting in way over my head, I try to cut it down into chunks that I can master one at a time.

Comment author: gwern 26 September 2010 10:10:21PM 0 points [-]

puts "<html>Hello World</html"

This comment inadvertently recalls to my mind Perlis's epigram: 'most people find the concept of programming obvious, and the doing impossible'.

Comment author: Will_Newsome 26 September 2010 09:30:39PM 0 points [-]

Get your data from a text file, maybe YAML which is like XML, only much more friendly.

I'm confused, you're talking about data for a tic-tac-toe game, which should be stored in YAML? I got a tad confused because YAML sounds like HAML and I'd just been reading about HAML, then I realized I'd never used XML and didn't even realize what it was for, so I tried to see if it was related to HTML which I've used a lot of, but it looks like it's not, it's just a way to format text files so that programs/scripts can import data from them. HAML on the other hand is a prettier version of ERB which is a way/template to use Ruby to make HTML use variables. So HAML is this thing I shouldn't be using yet because it's complicated and I should be focusing on Sinatra/Ruby whereas YAML I should start using eventually because it's a way to format data for easy interpretation by ruby scripts and the like. Or did you mean YAML should be used for other things? Am I totally off?

Comment author: Will_Newsome 26 September 2010 05:01:30PM *  0 points [-]

I think I'm limited to just playing around with Ruby on Windows for now; my wireless card doesn't work in Linux. And the thing that might work to fix that is in a package that I need the internet to download. I hate Linux so much, it's seriously a horrible operating system. GRUB actually knocked out access to all of my partitions once, meaning I couldn't even get to GRUB and therefore Windows 7; there's no way I would've been able to fix that without SIAI folk. I'm also running it in VMWare and the internet works there but Gems doesn't: the paths are messed up somehow so that gems don't run, and the internet isn't helpful in fixing that. Stupid stupid operating system. No wonder everyone owns a Mac.

Comment author: arundelo 25 September 2010 12:24:28PM 0 points [-]

Welcome down the rabbit hole!

Comment author: rhollerith_dot_com 25 September 2010 11:40:48AM *  2 points [-]

I am not a web developer, but as a Linux user of 15 years let me explain why it might not be as bad as you think.

Get any old computer and put Linux, Apache, MySQL on it. (Those softwares require very little in the way of hardware resources unless you are serving 100s or simultaneous users.) Network the Linux machine with your Windows machine. Even better if your Windows machine has enough memory, run Linux on a virtual machine on Windows. I do not know what the cool kids are using these days in the way of virtualization software, but VMWare would work.

Use a web browser on Windows to test your web app of course.

Editing of text files (mostly config file for Apache, etc) on the Linux box or Linux virtual machine can probably be done using whatever text editor you already use on Windows though I do not know the details of how to set that up in any editor other than Emacs. (For Emacs I would probably use the FTP protocol. The SMB and NFS protocols are alternatives.)

True, you will probably need to interact with a shell on the Linux box or the Linux virtual machine occasionally (using something like PuTTY on Windows), but this way saves you the trouble of having to learn anything about Linux's graphical user interfaces. The good thing about the shell is that it lends itself very well to textual tutorials, with the result that there are 10s of 1000s of blog posts and web pages describing in exact detail how to do stuff in the shell. I would be happy to answer questions by email about the shell, but I do not know about Apache or MySQL.

This way of working with Linux -- by establishing connections to it with browsers, text editors, FTP clients and ssh clients like PuTTY on Windows is very common.

Everything I have described is the worst-case scenario. You can probably either install Apache, MySQL, etc on Windows like wedrifid says or avail yourself of some online service that will host the software for you and allow you to configure and administer it using a web interface.