Tuesday, January 24, 2006

Shake-n-bake templates

Will searching for some free images for on of my web apps, I ran across this site with a couples of free web site templates, logos and images. Some are dull, but since you got the Photoshop source you can use only parts, that's what I did, saves a lot of time.

Plus I found this site which matches color sets, that could be some help for web design dummies like myself.

About yesterday's post, here's an example of what the interpreter can do...

Instant C#, hack some code...
>>> string cool = "wow that's cool!";
>>> cool = cool.ToUpper();
>>> return cool;

I guess that could be helpful for quickly testing some code. Just like de console rails script where you can play with you model class and add record in the tables with the interpreter (running ruby script\console). I guess I could adapt this to work with Castle ActiveRecord classes. That would require to initialize the framework and reference the proper assemblies...

Sunday, January 22, 2006

Sharp and dynamic

While hacking some code generator app in c# I ran into some issues. Being a compiled language, extending some parts of the generator would require recompiling the app, so if I want to use it in my project that mean I'd have to drag the source code all around... I don't like the idea. I strongly think that all dev tools should be quickly extendable. I think that's the main reason more and more devs are turning on to python, ruby and other scripting language.
The problems is, I'm using c#, and I don't want to mix languages like that for the simple purpose of using a code generator... That's when something popped up in my head. I remember something, somewhere deep in the .NET System.CodeDom namespace that could dynamically compile c# code and run it in the actual assembly. Yeah! If I can do that I can run c# code as script!!!
Too bad Oleg Shilo thought about it before I did, here's the result http://www.csscript.net/.
I think this is opening a new world of possibility to the .net framework and .net dev tools. Imagine creating build script in c#, the only thing missing maybe is a couple of helper classes and methods...

Speaking of my code generator. You may ask why? Why another code generator, please! No! Not again! Let me explain...
All generator tools are based on the template to file pattern, or are optimized for this. Open a template, then parse it to a file, then use this file. I want to push this a step further, and I wont hide the fact that I'm porting some ruby's generator concepts. So the patterns should be, send the generator some arguments and the the files are generated and parsed directly in your app directory structured. Simple, clean and mostly FAST. But not very portable since you app directory structure is not mine... That why all the generator logic is one class that inherits Generator and overrides a run methods. In the methods you do what you have to do:

public class TestGenerator : Generator
public override void Run(string[] args)
AddParameter("test", args[0]);

ProcessTemplate("Test.vm", @"Temp\SomeTest.txt");

For now I'm using NVelocity template engine. I think this could get any more simple. You can pass parameters to the template and then create the structure and parse your templates or any other dependencies to the folder you want.
The generator is launch with this : generate test Hello.

And what if I could create a dynamic scripting language with the System.CodeDom stuff! humm..

Saturday, January 21, 2006

Long time no read...

I haven't post since long time now. Hopefully, I'll try to maintain this blog. The thing is : you post. It's fun. You post to yourself. It's getting boring. You don't get feedback. You give up. This is mainly the lifecycle of the average personal blog around the web I guess. So I've made a personal arrangment with myself. To post thing here has it comes out of my head and has the title of this blog mention, be lazy. But intelligently lazy... you know.

Speaking of being lazy, lets talk a bit about lazy friendly application frameworks, or what some other people like to call RAD framework of rapid application development frameworks. If you're a web developer and haven't heard or Ruby on Rails, then... man... that's BAD laziness, you know? Bad! the kind of laziness that leads you to end up with nothing! Not even some frozen dinner to eat or some starwars t-shirt full of holes smelling buritos flavor doritos 3d, N-O-T-H-I-N-G! You get my point. What was I talking about already? A yeah: http://www.rubyonrails.com.

I think Rails popularity is based on the fact that people are lazy. Yeah! really! I mean if you know what Rails is about, one of the sentences that comes around a lot when reading about it was ... "code less"! The framework comes fully packed with scripts and libs that, with a couple of command in the prompt, pops-up a fully functional web app in no time. Plus, all well structured in a directory structure and beautifully following the MVC pattern. Not to mention some other cool paterns like Martin Fowlers ActiveRecord.

Rails also inspired some other good frameworks, like Castle for the .NET framework : http://www.castleproject.org. Which is more then a port... well... It couldn't be anyway since ruby is a dynamic script language and .NET a static compiled one.