Thursday, November 13, 2008

More Scheme Development Envy

A while back, I mentioned that I was getting more and more interested in doing some web development in PLT-Scheme. Well, my interest has only increased.

  1. Jay McCarthy has published a fine set of nuts and bolts articles on the practicalities of writing Scheme web apps. Articles like, how to control the URL structure of your app, or how to run a SSL based server.
  2. Lately I've been doing some GUI (MrEd) development using the latest version of PLT-Scheme. I've pretty much become addicted to Contracts. The notion behind contracts is that you can attach type checking to a particular function. It's cleanly integrated with the module system, so all public functions can easily be annotated like this. You can do simple checks like:
     (provide/contract
       [balance  (account? . -> . number?)])
    
    You can also express more complicated contracts, such as passing in and returning functions, or expressing a variety of return types. Here's the contract for a function that takes in a string or number and returns back a function, that when invoked with a string, appends the original content (got that?):
      (provide/contract
        [make-appender ((or/c string? number?) . -> . (string? . -> . string?))])
    
    Finally, what's really cool is that these contracts are just regular functions, so you can build abstractions around them. For example, we can clean up that previous contract to say:
      (define string-or-number/c (or/c string? number?))
      (define string->string/c (string? . -> . string?))
      (provide/contract
        [make-appender (string-or-number/c . -> . string->string/c)])
    
    The contract functionality not only provides for error checking and debugging but also provides a nice - always up to date - type of documentation.

There are still a few items I need to hash about before I start doing any type of development, though:

  • I'd have to figure out what kind of server do I need to reliably run this puppy. I'd probably start off with a VPS from my friends at Rimuhosting.com. This should give me full control over what I run there. But still, I wonder what kind of memory usage I'd want to plan for?
  • I'd have to test out PostgreSQL or MySQL db support to make sure it was strong
  • I'd have to sort out what the deployment cycle is like. Just copy over files and restart? Could I do hot deployment of some kind, by reloading scheme files (one of my favorite tricks in the book)? PHP has spoiled me in this respect, it's a simple - push files, and you're done.
  • What's the best production web server arrangement. Should I just have clients talk directly to plt-scheme, or should I proxy them through Apache first?

It's nice to see the technology evolving. At some point I'll hit that tipping point, where the risk of Scheme will be outweighed by the benefits of it's features. And then Bam!, I'll be good to go.

Update: Untyping answered my questions above! Thanks Noel, you rock! And, best of all, you're taking away my excuses.

7 comments:

  1. I answered your questions on Untyping

    ReplyDelete
  2. Thanks Noel - really appreciate it.

    -Ben

    ReplyDelete
  3. Its highly informative. I would be visiting your blog hereafter regularly to gather valuable information.

    Freelance Web Designer India

    ReplyDelete
  4. Oh, FreeWebDesignerIndia - you're too kind!

    Flattery will get you everywhere...I'll let you comment spam stand as is ;-)

    ReplyDelete
  5. This comment has been removed by a blog administrator.

    ReplyDelete
  6. Anonymous4:45 AM

    We add Life to your Vision. We listen to you, understand your ideas and thoughts with an endeavor to give you an outstanding web presence complete with the optimal solution for your business model.Technologies and CMS: (PHP, Cold Fusion, Zend, .NET, ASP, ASP.NET, or any CMS based websites).Thanks. Web Designing in India

    ReplyDelete
  7. Great post and very well written, that will really help you to learn Web Design, web development and SEO Strategies to help businesses web design company . You can find out many useful information about web design, seo and his work by visiting his blog and I Just wanna say thanks you for the information you have shared. Web Design Company India

    ReplyDelete