Forums

Web app thoughts

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Web app thoughts

Postby Charles » Tue Oct 19, 2010 10:38 am

As I mentioned before, I've done a little bit of work in this area, but I never get very far due to being busy with the compiler and other things. Below are my thoughts on creating a web application server in Cobra.

Well instead of all this work, maybe we just need some nice tutorials on using things like:

-- Mac or Linux + Mono + Cobra + Castle Monorail
-- Windows + .NET + Cobra + Castle Monorail

But if we build a new one, I was picturing an application server that hid behind a web server such as Apache or lighttpd. Communication would be via SCGI which I believe is the "current way to do things". We have an open source Cobra SCGI library at http://bitbucket.org/webnov8/overlap/wiki/Home

It's useful for an app server to have an option to serve HTTP for development and quick setup. But generally it would not be mature enough to put into production.

The above arrangement matches other projects including Webware for Python (which I founded) and Django (the most popular web app server in the Python community at this time).

Some additional random bits:

-- Especially during development, it is useful to have the app server "restart" or "reload" when code files changed. The standard library can already watch the file system and a build command could be issued by convention and/or configuration. That leaves the reloading part. I investigated using .NET app domains to reload code that had changed, but ran into some issues at least on Mono. Consequently, my plan became to use the Webware approach where the entire app server exits with exit code 3 in such cases and a wrapper script restarts it based on that. See the "while" loop at the bottom of http://svn.w4py.org/Webware/trunk/WebKit/AppServer. In practice this works great.

-- The treatment that web browsers give to relative URLs like <a href="foo"> is sensitive to whether the current url ends in / or not: http://example.com/baz vs. http://example.com/baz/. An app server could support both URLs in which case the links in your page will need to adapt to the two cases, which generally means putting them through a function. Alternatively, the app server can always redirect to the URL ending in / for consistency in which you always know what to expect. Django does this and I think it works well.

-- For each page, I prefer to use a class (like Webware) rather than a method (like Rails). I then use inheritance to get access to utility methods and other goodies.

-- I'm all for a command line tool like Django and Rails that is used to kick off a directory and do other things, but it should not be through the Cobra compiler.

-- I was thinking that the app server would not dictate anything about storage. Instead, the developer would use whatever they like such as NHibernate, Castle ActiveRecord, the repository pattern, Subsonic, MongoDB, etc.

-- I'm also influenced by the Pylons approach where you can mix and match pieces.

-- The project should have its own name and be hosted somewhere like Google Code or Bitbucket.

-- Of course, if you develop an app server, these things will be up to your discretion.

HTH
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Web app thoughts

Postby K. Houwen » Tue Oct 19, 2010 12:56 pm

For the moment I'm learning Cobra by using it for a MonoRail project. So far I can get the basic stuff working on IIS. I haven't tried to run Monorail on a linux based server with mono. Jackson H. is working on a webframework for mono calles Manos(http://jacksonh.tumblr.com/post/1159500 ... -manifesto). I will take a look at it when I find some time.

About creating a complete new webframework for Cobra, do we really need it? Because Cobra runs on top of .NET/Mono, what extras can a new webframework give us that asp.net mvc and Monorail hasn't for the moment?

Will take a look at the SCGI Cobra lib. So cool this already build for Cobra :-)

About the vision of how a webapp should been build, I think we differ a little bit :-) I like it to have a framework where I can start building something fast without learning how to hook up 3rd party libraries. That is why I've chosen Monorail instead of asp.net mvc. Seems like you're more for a solid base where you can hook up whatever you want.

I'll start with learning the in and outs about Cobra first, but using Cobra for webdevelopment is what I want to do. I keep you updated about how things works out with Monorail (and/or the building of a new webframework).
K. Houwen
 
Posts: 12

Re: Web app thoughts

Postby Charles » Tue Oct 19, 2010 11:03 pm

K. Houwen wrote:Because Cobra runs on top of .NET/Mono, what extras can a new webframework give us that asp.net mvc and Monorail hasn't for the moment?

I don't think new web frameworks give many extra features. Rather, they establish a way of working that the author or authors value as well as characteristics such as "elegant" or "scalable". For example, in the blog post that introduces Manos the author talks about simplifying things, not about extras.
Charles
 
Posts: 2515
Location: Los Angeles, CA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 30 guests