Showing posts with label Tech. Show all posts
Showing posts with label Tech. Show all posts

Extension Methods

I was working on a Ruby on Rails project. I was partly influenced by the syntactic sugars.

Here is the extension method in C# for Ruby times
   1:  using System;
   2:   
   3:  namespace ConsoleApplication1
   4:  {
   5:      class Program
   6:      {
   7:          static void Main(string[] args)
   8:          {
   9:              5.Times(DoSomething);
  10:          }
  11:   
  12:          private static void DoSomething(int x)
  13:          {
  14:              // Do something with x
  15:          }
  16:      }
  17:   
  18:      internal static class Extensions
  19:      {
  20:          public static void Times(this int times, Action<int> action)
  21:          {
  22:              for (var i = 0; i < times; i++)
  23:                  action(i);
  24:          }
  25:      }
  26:  }

Posted in Labels: , | 0 comments

Program Verification And Automated Theorem Proving

Presented @ XConf, ThoughtWorks, Chennai

Posted in Labels: , | 0 comments

Ruby on Rails

Recently I was working on a XML feed generation task in a RoR project. I did a cursory performance analysis recording file size against time. The interesting thing was the time taken to generate file increased exponentially with increasing file size. So I decided to compare ruby's performance against Lava, C, C++, Scala and Javascript. I have tabulated the results of the benchmark tests from http://shootout.alioth.debian.org.


The results were surprising though hardly any N Body solutions would be implemented with Ruby in reality (included just for visualising performance @ heavy computation load).

I realized that RoR is ideal for projects that don't have computation heavy / memory intensive operations in backend. Or even, we can build such backend systems in other languages that are cpu & memory efficient and have frontend built with RoR. We shouldn't be expecting RoR to do that.

I am not undermining RoR but I think we should contemplate on nature of the system that we will be building.

Posted in Labels: , , , | 2 comments