Using Blitz as a website language

BlitzMax Forums/BlitzMax Programming/Using Blitz as a website language

ImaginaryHuman(Posted 2012) [#1]
Hey. I'm setting up a website and have decided to try using BlitzMax as an `offline` language for generation of page content, rather than a live server-side scripting language like php. The two major elements of using a server-side language I can see missing out on are personalized user accounts/login, highly dynamic pages, and live-updated social networking features like quickly-updated posts, status changes and user relationships. Some elements of that can be done with cookies in the browser, but they aren't features I really need for the site. It's mainly an informational site and I can support occasional user submissions of content which aren't updated on the site right away.

My plan is to write a piece of Blitz software which acts like a website builder, and which then pre-calculates/re-generates as many pages as need to be changed in order to implement updated content. I then basically re-upload all changed files periodically. The major benefit for the end user is download speed (raw html is always way faster than any script language even with heaps of caching techniques). It also saves a tonne of server load.

I'm finding there are a number of approaches to `faking` the impression of a dynamic site, such as pre-generating multiple versions of a page based on a particular combination of scenarios, using ajax to load dynamic content after the main page loads, cycling through hidden content using javascript/animation, etc. I think it's going to be quite cool. I'm surprised how much CAN be done `offline` which many sites would repeat a lot on a web server. Even a dynamic `seeming` site-wide search can be done with pre-calculated search results. After all, the site really doesn't need to change until new content is added.

I was just wondering if anyone has tried an approach like this - basically an `offline website generator`?


ImaginaryHuman(Posted 2012) [#2]
Come to think of it isn't this somewhat along the lines of what Dreamweaver can do? But I really don't like dreamweaver.


Mahan(Posted 2012) [#3]
BMX is as good as any language for this, looking just from the language perspective, but it does not have any community for web development. If you choose Python, Node.js, Ruby/RoR, Groovy, Cake/PHP you'll have an abundance of web frameworks/libs to choose from and also lots and lots of communities to ask for help and learn from.

Also: What you describe sounds a lot like you need a publishing system like wordpress, drupal or joomla. (Focus on mainly static content that is generated and changes over time.)

That is, provided that you manage to keep the site purely passive, and serve it with some non-blocking server like Nginx. As soon as you want some active/dynamic response from the web-server and you are concerned about massive performance you'll be much better of with Python-Tornado/GEvent or Node.js or another environment that focuses heavily on non-blocking, event driven, singlethreaded I/O.


(raw html is always way faster than any script language even with heaps of caching techniques)



Well that depends. When you start to get some content volume on your site and you use the static/hide-show approach you will have to load more and more data in the initial request, if content is mainly preloaded. With a heavily dynamic page your initial load can be much smaller and then the page will populate itself depending on what the user chooses to do.

Also: An established web framework usually represents man-years of boilerplate programming and optimization and thus experience on what works/does not work. If you check out a few you'll probably find one that you like and you'll adopt it, or it will give you good ideas on how to build your own.

edit: spelling

Last edited 2012


ImaginaryHuman(Posted 2012) [#4]
Thanks for the feedback. I did quite a bit of research into php frameworks before deciding on this. In particular I like CodeIgniter. But the thing is, in all benchmark tests I've seen, pages are still quite a lot slower in any server-side language than serving plain html pages. For parts of the site that really need dynamic content, like a forum, I plan to use a separate section of the site with php or whatever, but the majority of the site can be Blitz-generated. IF I were to go with php etc I would use CodeIgniter and benefit from the big community and add-ons etc. Maybe I'm partly lazy and don't want to learn php though ;D


ProfJake(Posted 2012) [#5]
Out of curiosity, do you need every last bit of performance or is it just a test?
Because it seems rather extreme to completely disregard the use of PHP generating cached content.

And if you don't want to learn it, why not write a CGI program?
This way you save yourself the hassle of uploading etc.


ImaginaryHuman(Posted 2012) [#6]
You have a point. I'm considering going just php. Speed is important to me, and to Google. But most people would be satisfied with normal site speed. I just like things to be really, really efficient and responsive.

I know php and CodeIgniter have a number of caching options and I've seen some benchmarks which look quite good, but then we're still talking like 4-5 times slower than plain html at best. So I'm on the fence. The potential of dynamic content is very appealing and there may be some things I want to do that just won't work without it. So we'll see.


Paul "Taiphoz"(Posted 2012) [#7]
I would go ahead and write it in max. if for nothing else than seeing if you can do it, at the end you might end up with soemthing really unique on your hands, and I think that has a value to it thats hard to pin down.

There are already so many other php frameworks and systems for creating dynamic content that I think making it something else would just be adding to an already full cup, if you follow me.


AntonyWells(Posted 2012) [#8]
Monkey has HTML5 output, that can run as a front end in a browser. If it helps.


slenkar(Posted 2012) [#9]
I use haxe for php,
basically you code in haxe (which is similar to actionscript) and it outputs PHP, this has many advantages,
you never get a blank page when you do something wrong, there is always a message to help you fix bugs.