views:

55

answers:

1

I am more interested in the design of the code (i.e functional design vs object oriented design). What are the best practices and what is the communities thoughts on this subject?

Not that it should matter, but I am working with Apache and Python technology stack.

+1  A: 

If you are using Apache+Python, this sounds like you are using Python for dynamic web pages. In that case, I would strongly urge you to look into Django. There are also other Python web development environments, but Django is perhaps the most popular; and it has excellent documentation such as The Django Book. The Django Book describes best practices for setting up a robust web site: how to use multiple servers for redundancy, how to set up the database server, how to set up a cache to reduce the load on your database, etc.

Other than that tip, good Python server-side code would be just good Python code. There was a question asked recently about how to become a good Python developer, and I would suggest you read that: http://stackoverflow.com/questions/1507041/how-do-i-get-fluent-in-pythonic/1507101#1507101

steveha
The more I think about it the real question is are web server applications built with a more procedural/functional design or with an object oriented design? Are there preferences for one over the other?
Mohan Gulati
Python is based on objects, and object-oriented design is a natural for Python. Typically the functions and procedures are organized by the objects as object method functions. There is nothing special about web server applications with respect to choosing between procedural/functional vs. object oriented. There are some best practices for how to organize the server setup: how to have several servers for redundancy, how to set up the database, etc. I'll say again: I suggest you get The Django Book and read it. It really is an excellent introduction to this stuff.
steveha
By the way, The Django Book is available for free on the Web, so there is absolutely no reason to not take a look at it. Here's the URL again: http://www.djangobook.com/
steveha