Is it worth starting "from scratch" in web dev? Straight Python, or Django?
I started with Dreamweaver, and then gradually learned how to write HTML and CSS from scratch. I then used Dreamweaver to patch together PHP/MySQL for database-driven sites, until I switched to ExpressionEngine because it met my needs for a flexible back-end database to run my sites from.
I've always been strong in design, and so regardless of how patchy my back-end has been, the results have spoken for themselves and achieved my goals. Good writing and design have compensated for a shitty back end (though in time, my HTMl and CSS have become acceptable in quality).
But whenever I talk to someone who knows how to program, it seems like slicing butter for them to do what's required for a web app. Like they can spend a few hours and have something that works. And I've always been strong in math and logic, so I think programming is not a bad fit for the way my brain works.
So here's my situation. I'm getting back into web dev after a couple years of management/product dev in a startup, and I want to build something that kicks ass -- but to start I just want to build a new blog for myself.
I'm asking myself whether I should (1) keep using ExpressionEngine or something similar, in order to get the fastest results possible (I'm not actually too interested in this option anymore); (2) use Python with Django, to benefit from what a framework offers; or (3) use Python to code something from scratch, with the aim to understand what I am doing at a more fundamental level.
I'm looking to strike the right balance between getting shit done fast, that just works, versus doing things in a more sustainable way (ie. actually understanding how to program and benefiting from the resulting flexibility and power).
Anyone have comments on this trade-off / what kind of learning curve to expect as I debate whether or not to use a framework like Django for my first real Python app?
I read through a couple books on Python this spring and liked it (but am by no means proficient yet), so that's my language of choice. The question is simply how deep to go. I want to spend the right amount of time learning, without heaping an unattainable amount of work on my shoulders so that I can never get anywhere.
(If I continue with python I'll probably also continue with the book "Software Engineering for Internet Applications" which I also started this spring.)
Also feel free to let me know if I'm even asking the right questions. I just hate the idea of wasting months of my time on the wrong path.
38 comments
[ 4.7 ms ] story [ 92.3 ms ] threadI would wait to roll your own web framework until you've had a little more programming time under your belt. Regardless of whether you may be a quick study or not, rolling your own framework is going to have all sorts of strange issues come up, and sometimes it's nice to be able to ask around on a forum, mailing list or IRC for help. Django has one of the largest (if not _the_ largest) Python community; at least as far as currently common frameworks go.
Django is quite nice as a framework as well, it may turn out that it's all you ever need. There are quite a few people out there who use it for every project they work on, with great results.
[Edit: Changed "webapp" to read "web framework"]
Also, keep in mind that if you haven't done a lot of programming it will take quite a lot of experience before you're writing apps that are maintainable and reliable.
You shouldn't try to learn a language with an application framework. I also recommend you don't try to learn Python with a web app. The web is a crazy hodge-podge of standards and a web-app is complicated by how many different problem domains it has to contend with. Write some programs to organize your mp3 collection or filter your email or something.
Also, keep in mind that if you haven't done a lot of programming it will take quite a lot of experience before you're writing apps that are maintainable and reliable.
There are merits to "understanding what you're doing at a more fundamental level" as you put it -- but that doesn't mean that you should waste time writing the same code many times. Understand it, write a library, and be done with it.
Like icey said, pick up Django and learn it - this will get you results far faster and of a higher quality then rolling you own straight out of the gate.
From your post, it sounds like you will be learning to program, learning python and possibly learning Django all at once - an ambitious goal to say the least. Combining the three - centered around Django I think will be the most practical approach for diving in - far easier than learning to program in python and tackling the particulars of designing a web app framework from the ground up. djangobook.com , despite its (over-come-able) errors, will give you a nice base to start from. "Practical Django Projects" is also getting some good reviews, but I have not had the chance to check this one out yet.
I think you will find most of Django relatively easy to learn - and what is not so easy, will highlight some of the tougher aspects of developing a web app framework so you know what to look closer at and beef up on in the case that you do roll your own in the future.
Also, like icey said, once you become versed in Django you can decide to dig around in its internals. This will give you the chance to see what is already optimally designed (no one should reinvent the wheel) and what you can stand reinvention or redesign.
a) Django is a framework in Python. If you are writing a site in django, you are writing it in python. I don't understand what you mean about 'writing it in django'.
b) How is django 'fragile' and how does your app break when you insert?
But that's just my opinion from seeing so many people not understand how frameworks work and try to use them.
Also, unless if you really, really think it is good for production use, regard the last part as well. Don't use it. I built a framework that was pretty decent, learned a lot about not just the language but also the framework and the MVC pattern, used it in production and it bit me in the ass later. Why? It wasn't good enough. If you're going go use it, make sure the framework you build isn't decent but excellent, and I'm only saying this because there are people who have written great frameworks before. The problem is that you might get caught up in your own "but I built this so it must kick ass" like I kind of did. Doing so is like using a software package from a sketchy vendor (no offense) and you wouldn't do that, would you?
You basically have hundreds if not thousands of people working on your project with you, fixing bugs, making it faster, more stable, and adding under the hood features. Something you would need to do yourself if you created your own framework.
Along with that, I think it is a good idea to play with a number of languages and frameworks. To me, the best test is building a simple application in them, a todo list or the like. Try things like Django, Rails, Merb, CodeIgniter, Cake, and others to see what feels most natural and fun to you.
Be sure to also think of what else matters to you about a language/framework. Check out communities, plugins and modules, and the documentation.
With that said, if you're doing this to try and learn something, then you will be doing yourself a disservice if you don't at least try to roll your own version of everything you will want to do with the web. Even if you start out with your own stuff and decide to swap in freely available components (open source, etc.), at least then you'll understand the infrastructure you're working with at a level you would otherwise not.
Worse Is Better gives you fast results with tradeoffs that you already knew of, while Right Thing approaches will allow you to discover hidden problems as you attempt to write the ideal program. So you learn more when you start from scratch, and that is a worthy goal.
Instead of using an ORM, I've discovered an amazingly flexible, efficient DSL for dealing with Postgres. It's called SQL. ;-)
I wrap my model objects around sql queries, so, externally, the objects have a nice ORMey OO interface, but internally I can do all sorts of wonderful Postgresql magic).
After the first time you do it, making a new microframework usually takes less than a day, depending on what else I have to get done. (The reason I reimplement is to prevent myself from adding useless features that I "might" need someday on some future project).
One of these days, I might release one, but strictly as a code-dump example, not as an ongoing project.
(Back on topic, my recommendation to the OP is to start with Django. It's beautifully designed, and has served me well even after I stopped needing its code).
If you are a designer and developer in one person, Django might not be the best match for you, unless you love something else about it (there are many things to love about Django)
I found that I don't use most of what web frameworks provide. But you could argue that just using Django's nice regex based request dispatching is worth it, even if you decide not to use their template engine at all (it's replaceable after all)
To sum it up, what is it that web frameworks do for you? It's basically request dispatching, forms processing (validation and stuff), view templates and ORM. If your applications handle a lot of form to database CRUD, using a framework is helpful. Otherwise you could just as well use naked mod_python because request dispatching is actually rather trivial and python already has a simple template engine built into the language.
So, I've decided to aim for "FAST" and use Django to get a working website out the door as soon as possible, and study programming at greater depth on the side (without expecting that effort to pay for itself immediately).
I started going through the book "Practical Django Projects" this evening and it feels right at my level.
Thanks for all your perspectives! I appreciate it a lot.
One thing you should try is WSGI after you're done with the blog. WSGI is a Python-level specification for how to interoperate with a Web server.
It's a layer above FastCGI (if you know what that is) and takes care of all the OS-level things such as network programming (but that is very good to know about).
One thing you'd really want to learn right now is HTTP. It is essential to Web development or design.
This really sucks. It means I have to over-sell an idea that I don't even know is good yet (because I haven't built it) and then I have to give up equity at the worst possible stage (before I have any traction).
I've got design and management experience under my belt and I'm pretty sure my brain is capable of enjoying playing with code, too. So I'm choosing this path to amplify what I'm capable of doing in life, and to follow my gut.
I worked in game development for many years... from my own studio. Very successful on that, but I started to get bored of that. I wanted to use my brain more. I was selling games for advertising so in a way it was like making online brochures, though they didn't work online (they were developed for trade shows mostly). So I started shifting fields, slowly changing my game dev skills and experience for other field skills and experience. I can say it worked for me in many ways, but it wasn't easy. However, I couldn't think of a better option than that. If game advertising isn't what makes me happy anymore, I shouldn't be working on that anymore. And probably that works for you too.
Sucked my heart right out from my rear end is what that did. So it is indeed time for me to find something that makes me more happy!
but let me put it this way. isn't it time that we forget about frameworks, starting from scratch, a lot of code that does the same thing 90% and only 10% innovation? Maybe it is better stitching actual services and "plugging" in the actual difference.
The wheel itself never was invention. It was its use. I bet the time when technology will be obsolete is approaching. It is what we can achieve what matters, not whats in the box.
I think the path of least resistance is to learn python and Django well, put some apps up, find out wehre the dev environment on Linux/BSD or mac is strong (editors, test tools, git/SVN), (and maybe make some decent money!).
Then branch out, start digging in to problems that web app frameworks solve, and solutions. These solutions would be the ORM, templating system, admin interface (Django's is admired and frequently copied), debuggers, performance profilers, testing stack, Ajax libs.
Look at the SQL generated, the HTML and CSS, how easy it is to rotate/analyze logs, DNS (subdomains, permanent redirects, etc), monitor/restart the proxy and servers, caching at all levels (pages and fragments, db queries, fixed assets in the browser). Also look at the mechanisms to plug in functionality, e.g. authentication, file uploads, multiple db connections, etc. That should teach you a lot.
Sure you can cut and paste the code from the tutorials and have a simple blog application and running in a week, but you won't really have a clue as to what's going on inside the framework.
There are a lot of parts of Python that Django uses that can be a little overwhelming to a noob programmer. For instance, URL's are crafted by using Regular expressions. Regexes might take you a couple of weeks to get your head around if you've never used them before. Django also tends to pass dictionaries around as arguments, which can be confusing and overwhelming if you've never seen them before. Same thing with it's use of list comprehensions under the hood. The use of args, kwargs or variable length arguments can be a bit confusing as well.
So, be patient with yourself. Django is certainly a great framework and well worth the time investment to learn. Python is also a great language, but again, these things take time to learn well.