cs 001: so you don't know what you're doing
April 10, 2013 9:59 PM   Subscribe

I need a coding project, and I am completely lost.

You guys really helped me decide to leave the nest of Python tutorials and pick a project so I can start learning on my own. However, I don't really know where to start. I've started a few 'projects' online only to discover they used a package I didn't want to waste my time with. Maybe it used PyQt when I wanted to learn PyGTK. But then I read online somewhere that PyGTK has been deprecated in favor of PyGl and I don't know what that means so I give up on that altogether and maybe I should work on something else instead? You get the point.

Then I decided it would make more sense to make a web app, and I installed Apache/mySQL/PHP in order to do this one tutorial I never finished (it assumed a Windows GUI and I got confused after a couple pages). Then I tried Django. Then I tried CherryPy.

The problem is, I have no idea what I am doing or whether I am going off track a lot. Maybe I should learn HTML/CSS before I even look at web frameworks. For example, I installed CherryPy but I don't know what it's actually used for. What is Apache? Do you need it? How many things do you need to work with if you wanted to write a web app (e.g. CherryPy and Apache and Ajax)? And why am I so confused?

This is what I know right now: Websites are made with HTML/CSS. You can put JavaScript on top of it. Ajax is another word for JavaScript. You do things with jQuery and JSON. I don't really know what. You can make a website with Python, but only to connect all the HTML/CSS/JS pieces together. I don't really know how to connect the pieces except that there is some kind of referencing system you use inside the code. To make a website with Python, you can install a web framework. Django is used by most people. CherryPy is for small applications. You put the web framework on top of Apache, but I don't know what Apache is. I think it's some kind of web server. But then you also need web hosting, which you would get from a third party. Do I need to learn alllllllll these languages just to get started on something?

So how would I even get started? I tried Invent with Python but it's not very autonomous, it's kind of just another tutorial. I tried PyGame, and it seems kind of childish and not used for real things.

I also don't know what to focus on. I thought the next step was GUI programming, but then I didn't know whether to pick Qt or GTK, and there seem to be so many other options (Glade?). Then I decided to try web stuff, but realized there are too many pieces to try to fit together that I don't even know how to start building something.

*I'm not married to Python
*I'm trying to learn HTML on Codecademy
*I don't want to use packages that are only used in tutorials but not for real things
*I don't know the difference between back end and front end...I kind of look at them the same since I would probably be doing both making something myself
*How can I just get STARTED on something? I don't care what it is. It just seems like once I start something, things I read reference other things so I assume I have to learn that, which references something else, and it's an endless cycle! I just want to stick to something. Like even with CherryPy, it's all "it's so simple!" but I wouldn't know how to use it without taking two months to read all the documentation...
posted by lhude sing cuccu to Computers & Internet (11 answers total) 24 users marked this as a favorite
 
Response by poster: TL;DR:
I've read Learn Python the Hard Way and Think Like a Computer Scientist, and now I need to learn how to implement what I learned.
posted by lhude sing cuccu at 10:09 PM on April 10, 2013 [1 favorite]


Best answer: I think that the worst idea you could possibly get into your head is that learning a single tool is going to be some kind of turn-key solution for programming. Forget about turn-key and forget about making something polished and professional. You are learning to learn. Choose a package or a tool that is documented in a way you can read and understand. (Lots of people make cool things with PyGame, for example.) Learn how to use it and try to push it as far as you can. Use that tool for a project that is cruddy, ugly, and useless, but that you will have fun with. If it's fun, you'll keep coming back to work on it. This way, you'll at least have a foundation to take off from, instead of flailing amid a profusion of tools that form ecosystems you can't even understand yet.
posted by Nomyte at 10:15 PM on April 10, 2013


Best answer: This question stresses me out and I know many of these languages! Jumping around like that is probably making things even more overwhelming than they need to be.

Have you made a website with just HTML and CSS yet? If not, that is a great place to start. You don't even need a tutorial, just get a couple books from the library and google anything you don't know how to do. You should start with an idea of what the website should look like, and then figure how how to make that happen using basic code. Don't try to do something complex right away, that's probably why you've abandoned so many projects already.

Once you're solid on HTML and CSS, invent some JavaScript projects for yourself and make them happen. Then you'll know enough to understand what web frameworks are actually doing, and you can pick one and start on a more involved project.
posted by ella wren at 10:17 PM on April 10, 2013 [2 favorites]


Best answer: The web is good. You can write a web app using the rudimentary HTML and Python skills you've acquired from LPTHW, this is essentially what you're doing in exercise 51, so that's one place to start. Sure it'll be awkward by modern standards, but that's how the web itself started - just simple pages and forms all hooked together. Then you can get into formatting (advanced HTML and CSS), keeping data around (databases, MySQL, noSQL), and doing work in the browser (JavaScript, AJAX). And then you can get into web frameworks like CherryPy and Django, once you start to understand the pieces of all this that they doing for you (and hiding from you).
posted by lantius at 10:33 PM on April 10, 2013


I don't want to use packages that are only used in tutorials but not for real things
Like Nomyte says, this is wrong. The skill you're learning isn't knowledge of a particular library, it's how to read documentation and pick out the parts of a library that you can use to solve the problem at hand, along with fundamental concepts that are common to many programming languages (boolean control structures and so on).

If you're learning how to read, you probably want to start with "See Spot Run" instead of "Wuthering Heights", even though no one studies "See Spot Run" for it's literary value.
posted by anaelith at 11:23 PM on April 10, 2013 [1 favorite]


Best answer: Premature optimization is the root of all evil. You are worrying about things you may never need to know about, and which you certainly don't need to worry about right now.

The point of picking a project is to give yourself a target to shoot for, something to help motivate you through the rough spots and help you focus when you find yourself going astray.

A simple web app is a good place to start. By simple, I mean really simple. One page type, one data type. A basic blog engine with no commenting is a classic starter project.

Starting out building a rudimentary web page and then adding a little styling with css wouldn't be a bad place to start. You don't have to become expert at it. In fact, even the css might be overkill at this point.

Next step, Install the relase version of Django manually, then go through the Django tutorials on djangoproject.com. No need for apache, or mysql (or Postgres) at this point. Use sqlite and the built in development webserver.

Once you get through the tutorial take what you've learned and create your blog engine. Actually, you can probably get stated with the blog engine after the 3rd or 4th section of the tutorial. Once you have it working, there is lots of directions you could go with it, but not before you revisit the 5th section of the Django tutorial and create some unit tests for your app. from there, you could make it look better, or improve the admin/posting UI, or add tags, or categories, or comments, or you could tackle the challenge of getting it running on a server somewhere using a production-ready webserver, like Apache.

Don't worry, Django and python are good things to learn and appropriate for future projects.
posted by Good Brain at 1:32 AM on April 11, 2013


And for playing around with html and css, there's also the Python simplehttpserver trick.
posted by drwelby at 7:54 AM on April 11, 2013


Best answer: I think a webapp would be easier to put together than a desktop app, if nothing else than because documentation and help is easier to find online.

But you're taking on a big task, with lots of different components, so it would be best to break it down and wrestle each on its own:

- Server-side backend:
This is the invisible server side that does the heavy lifting for your app. This would be your python script.
At the most basic level this would be sending out a response whenever the user accesses the server from his browser. Sample app: return a random quote from a list of quotes.
Next add database connectivity: you'll have to add the code to initialize your database connection and read from it. Sample app: return a quote stored in the database.
Next write to the database. Sample app: every time the server gets accessed save the time/ip and increment a counter. Read these out and return them.

Congratulations you now have a functioning web app that reads and writes to a database.

- HTML/CSS:
OK your server is returning some text, and you can see that in the browser, but it looks like crap. Go read up on the basic HTML tags and wrap your returned text in some divs or uls. Prettify them with basic inline CSS styles. Now remove those inline styles and use CSS classes instead. Take it one step further, place your styles in their own file and include that stylesheet.

-Javascript:
There are lots of uses for javascript, many tools and frameworks too, but for starters just get used to the basics. Learn how to call javascript functions:use alert() to display a message as soon as the page loads. Take the next step by writing your own function: do some formatting to output a string which then gets alerted. Learn DOM interaction: instead of calling your function when the page loads trigger it when a specific element gets clicked.



Great. Now start iterating and adding functionality. Add forms to submit user data, save more info to the db, learn how to use a simple JS framework to add transitions or show/hide elements, do some basic user authentication, do some advanced user authentication, use AJAX to submit your forms in the background.... The list is endless.

Choose a new feature, break it down into basic components, learn how to do it.

There's a reason blogs and polls are very common learning apps, you can have somethibg extremely basic and functional, and keep adding more advanced features as you go along.
posted by xqwzts at 8:44 AM on April 11, 2013


I got dragged into learning a little html and later css because I began sharing info via a simple website. I didn't even know what an FTP program was at first. Someone else did the initial coding then gifted me the pages. I began with replacing code for colors and stuff like that, kind of like when you take a foreign language and say stuff like "The house is red," "The house is blue," "The house is green," etc. You don't need to really understand grammatical rules to change out one word and eventually some things sink in and you start doing other stuff.

So, other than "learn to code," what do you want to do? Do you have a hobby you want to share but WordPress isn't cutting it? Make a website. Do you have a thing you want to do but can't find an app for it? Make an app for it. Even if it sucks and never works right, you will learn more if you are interested and have some kind of goal or concept you are pursuing.

Alternately, you don't even need to be online to play with html and css. You can be on a computer that isn't even online and make a page and play with font size, color, etc. I used to do that when bored while in training for something else.
posted by Michele in California at 10:09 AM on April 11, 2013


My suggestion would be: Think up something simple that you would actually like to use yourself. For example, automating something that you find yourself doing manually a lot. (Or automating something that you care about but don't actually bother doing much because it is too much hassle to do manually.)

I thought the next step was GUI programming

After you have a project idea for something useful to you, the next steps might be....

- Write some functions you can use manually in the Python interpreter
- Write a way to run it from the Windows (or whatever) command line
- Write a desktop GUI wrapper to easily use your functions and show results

If you are going the GUI route, which is probably a good idea, tkinter is the simplest choice, and I'd stick to that.

If you are as yet still trying to get your head around programming in general, and the Python language in particular, I would not go into creating web apps just yet. What you can likely do though is make a desktop app to interact in a useful way with something on the web that you care about.

For example, you can grab a webpage with urllib2, extract out pieces of it with regular expressions or BeautifulSoup, or use Mechanize to do something you'd do by hand in a browser, but automated in Python. Also pretty much anything that is widely used is likely to have a Python API that lets you interact with it fairly easily in your code.
posted by philipy at 11:49 AM on April 11, 2013


Just to set the record straight, Ajax is not another word for Javascript. It describes a set of technologies that allow your web browser to communicate with the web server in the background. I'm oversimplifying a little because there are other ways to achieve the same effect, but that's essentially what it is.

As for your question: Web development is a great way to get started. I'd recommend starting with something simple in HTML and Javascript, so you don't even need a server. You can literally just open/run the file in your web browser straight from your hard drive. Maybe design a web form (in HTML, possibly with a WYSIWYG editor) with buttons and other input elements and then try getting the buttons to do something.

There's a bunch of stuff you can do with just HTML and Javascript alone. Maybe try writing a magic 8-ball or a tic-tac-toe game.

Server-side stuff can come later if you're interested in continuing with Web development.

If you want to do something with a GUI and are running Windows (you mention Qt and GTK, which make me think otherwise), I'd actually recommend playing around with WinForms and .NET. It's incredibly easy to do GUIs with WinForms and Visual Studio Express is free. Of course, eventually you might want to do something with a GUI toolkit like Qt/Gtk/Tk, but WinForms is a fun way to get started.
posted by retypepassword at 4:33 PM on April 11, 2013


« Older Not much good at anything, still need to work   |   Insurance assurances Newer »
This thread is closed to new comments.