Chennai OpenCoffee Club

A place for the startup ecosystem around Chennai

Siddharta Govindaraj
  • Male
  • Chennai
  • India
Share 

Siddharta Govindaraj's Friends

RSS

Test Driven Development in Python

Here are the slides for my talk at Pycon India this weekend. The talk was on doing test driven development in Python and it looked at 3 frameworks - unittest, py.test and nose.

Continue

Pattern Matching With PEAK-Rules

I came across this interesting article on Pattern matching in Python. The article asks: Can we recreate in Python the pattern matching semantics present in languages like Haskell and Erlang.

For those not familiar with the way pattern matching works, I've copied the example from the article above.
%% handle(Path, Method)
handle("/", _) ->
not_a_resource;
handle(Path, 'PUT') ->
create_new_resource(Path);
handle(Path, 'POST') ->
update_resource(Path);
handle(Path, 'GET') ->
retrieve_resource(Path);
handle(_, _) ->
invalid_request.
What the above code does is to return "not a resource" if you call the handle function with the path parameter as "/" and any method. If you call handle with any path and method parameter as "GET" then it calls retrieve_resource(Path) and so on.

PEAK-Rules

A method to replicate this in Python was given using match objects, but I thought hey why go through all this trouble when PEAK-Rules does most of this for us?

Multimethod Dispatch

PEAK-Rules is a library that enables multimethod dispatch in Python. Those with an OO background will recognise a specific instance of this in method overloading. When an overloaded method is called, execution can go to different method implementations depending upon the type of the parameters passed. In generic multimethod dispatch, you can route execution based on any criteria that you define. PEAK-Rules brings this sort of generic multimethod dispatch to Python.

An Example

So lets take a concrete example. Our goal is to rewrite the above Erlang code in Python using two libraries: PEAK-Rules and an add-on called prioritized_methods that allows prioritised method ordering.

First, you'll need to get install PEAK-Rules and prioritized_methods. You can pick them up from the links given or if you've got setuptools, then you can just easy_install them.

Then type out the following code:
>>> from peak.rules import abstract, when
>>> from prioritized_methods import prioritized_when
>>> @abstract()
... def handle(path, method):
... pass
...
>>> @prioritized_when(handle, "path == '/'", prio=1)
... def not_a_resource(path, method):
... print "not a resource"
...
>>> @when(handle, "method == 'GET'")
... def get_resource(path, method):
... print "getting", path
...
>>> @when(handle, "method == 'PUT'")
... def create_resource(path, method):
... print "creating", path
...
>>> @when(handle, "method == 'POST'")
... def update_resource(path, method):
... print "updating", path
...
Here is what is happening:

We first define an abstract function handle(path, method). Do this by placing the @abstract() decorator on it.

Now consider this snippet:
>>> @when(handle, "method == 'GET'")
... def get_resource(path, method):
... print "getting", path
...
This defines one implementation for the handle function. It says, when the handle function is called, and the condition given is True (in this case method == "GET"), then call the implementation given below (here: the get_resource function).

Similarly we define the other implementations to be called on some other conditions.

The only thing left is the usage of @prioritized_when. Now, when a call is made to handle("/", "GET"), we see that the condition for not_a_resource as well as get_resource are satisfied. Which implementation should be called? In this case, we use the @prioritized_when decorator and set the priority to 1. This tells the system to give priority to this implementation in case of conflict in match.

Here is how the output looks:
>>> handle("/", "GET")
not a resource
>>> handle("/", "POST")
not a resource
>>> handle("/home", "PUT")
creating /home
>>> handle("/home", "POST")
updating /home
>>> handle("/home", "GET")
getting /home
Pretty cool! The best part of this is that you can dispatch on virtually any condition. While the resulting code is a little more verbose than the Erlang example, its not too bad and it does the job well.
Continue

Wall Street Arithmetic

From Philip Greenspun:
I attended a seminar this evening presented by one of our largest banks (name not mentioned to protect some friendships). A middle manager introduced Eugene White, an economist from Rutgers. “I earned nothing last year,” said the hard-working bank employee. “Zero for 2008. No bonus. No options. No stock.”

Over dessert and coffee I asked one of the guy’s subordinates if the boss wouldn’t also have gotten some sort of base salary. “Sure,” he replied, “but maybe as low as $500,000 per year.” How did that round to zero? “Well, he might have made $12 million the year before.”

And you thought Peano arithmetic was challenging….
Continue

10 Trends in ICT: My Talk At VIT Entrepreneurship Awareness Camp

Here are the slides from my talk at VIT yesterday. The slides may not make much sense without the actual talk though.

Continue

"Cutting Costs With Agile Software Development" Seminar In Chennai



The Ministry of Micro, Small and Medium Enterprises (Govt. of India)
(MSME) is organising a 1 day seminar series on "Cutting Costs with Agile
Software Development" on Friday, 20th of March.

Topics that will be covered:

  • Business Case for Agile Software Development

  • Introduction to Scrum

  • Adapting to changing requirements

  • Benefits of self organising teams

  • Releasing quality software

  • Agile metrics

Plus an open discussion where you can bring up the topics you're most
interested in.

Click the image on the left for all the details regarding content and registration.
Continue
 

Siddharta Govindaraj's Page

Latest Activity

It was compiled about a year ago, the link was circulated to the various OCC in india
November 13
Hey Pinched your above post for a response on Linkedin. view it here http://www.linkedin.com/groupAnswers?viewQuestionAndAnswers=&gid=44512&discussionID=9444654&split_page=1.
November 13
Here is one - http://enbase.net/index.php/Main_Page If I remember right there were a couple more too, but can't quite find them
November 13
Aren't there a couple of wikis that have a list like this?
November 13
Respected Sir / Madam , This is Ashwin ( Freelance Psychology & Soft skills Trainer ) from www.WinTraining.in I am into Training & Coaching , Business Consulting for various Corporates , Companies , Colleges & Universities , B Schools & enterpre...
November 2
That's a great achievement! May your tribe grow Siddarth!
November 1
Hi Guys u can call me as Eswar.s I started my career as Banker... in HDFC Bank and is going well.. i am new 2 this chennai cofee club my mail Id:eswarxplus@gmail.com
October 15
www.salesamachar.com is an online portal providing most upto date information on sale and discount deals across the city. The site has been designed to give the best user experience with easy navigation by category/sub category, Stores as well as ...
October 14

Profile Information

About Me:
I'm an entrepreneur from Chennai. My company, Silver Stripe Software writes a project management tool for agile software development. My passions are in the startup ecosystem (especially in India), agile management, and programming
Personal Website:
http://siddhi.blogspot.com
Company Website:
http://www.silverstripesoftware.com

Siddharta Govindaraj's Blog

Siddharta Govindaraj

Entrepreneurship Week 2009

This is the official mailer for EWeek 2009 conducted by NEN that I announced at the 1st Feb meet.

---

As the world tackles the problems of sustainability, entrepreneurs are emerging as change-makers, driving the momentum towards responsible development.

Entrepreneurship Week India 09, an initiative of the National Entrepreneurship Network (NEN), will celebrate this spirit of eco-preneurship from February 7 to 14 across the country through a range of activities and programs designed to embrace… Continue

Posted on February 3, 2009 at 2:24pm —

Siddharta Govindaraj

Chennai OpenCoffee Club Turns One

It's hard to believe but the Chennai OpenCoffee Club will soon turn 1 year old. Vaidhy and I started OpenCoffee in Chennai with the first meetup on the 5th of August, 2007 at Subway (Read about it here). Since then, OCC has spread out to Bangalore, Mumbai, Pune, Hyderabad, Delhi, Noida and Kolkata (S… Continue

Posted on July 25, 2008 at 10:06am — 3 Comments

Siddharta Govindaraj

10 Reasons Why Startups Fail

Check out this interesting link that lists out the top 10 reasons why startups fail. The reasons are

  1. Poor Execution

  2. No Viable Market

  3. Too Much Leverage

  4. Undercapitalizing the business

  5. Lack of competitive advantage

  6. Competing head-to-head with industry leaders

  7. Picking a niche that is too small

  8. Breakup of the founding team

  9. Poor pricing strategy

  10. Growing to

Continue

Posted on September 3, 2007 at 9:34am — 1 Comment

Siddharta Govindaraj

OpenCoffee meetups on the 2nd

2nd of September is a crowded day for OpenCoffee in India. There are going to be THREE meetups on that day. Apart from the Chennai OpenCoffee meetup, the second Bangalore OpenCoffee meet and the first Delhi OpenCoffee meet are also scheduled for the same day!

Posted on August 28, 2007 at 1:11pm —

Siddharta Govindaraj

OpenCoffee Club in Bangalore

Vaibhav and Ramjee are organising an OpenCoffee Club in Bangalore. Read more about the Bangalore OpenCoffee Club and if you are interested in attending, join the bangalore opencoffee google group.Continue

Posted on August 13, 2007 at 10:35am — 2 Comments

Comment Wall (35 comments)

You need to be a member of Chennai OpenCoffee Club to add comments!

Join this social network

At 12:25pm on October 31, 2009, Rtr. K. Saravanan said…
Hi, I'm Saravanan, Currently pursuing my B.E in Coimbatore. To say about me i'm crazy about Entrepreneurs & Entrepreneurship at my schooling right now i own my company Dealing with (Web Development, Software Packages, Database Management, Real Estates, Travels, Educational Consultancy's, Project & Training Centres Etc...)Corporate Business A to Z Avenues in this world. Firstly i'm privileged to read u r profile details.You can help and support the many young individuals in the forum ! even like me. I'd like to share few experience of mine to you. We need your support to grow.

And, Kindly help me regarding attending the E - MEET. I want to join in one of the E - Clubs & Planning to rise in our college. Do guide me, so that it would be helpful to us.
Thank You,
Rtr. K. Saravanan.
At 11:22pm on October 12, 2009, Sukesh Das said…
Hello Siddharta,

I have created a Coffee Club network for Kerala almost similar to chennai open coffee.
http://keralaopencoffee.ning.com/
Can you kindly include this address in the Resource part of the home page of Chennai Open Coffee Club.

Thanks
At 10:54am on September 20, 2009, Ambika M said…
HI Siddhart, I am a new member of Chennai Coffee Club, I would very much like to attend the SECOND MEET. Should I pay an entry Fee? Where Will more details about this meet be informed ? I am an MBA grad and firmly believe that I must be a employment generator.
At 2:53pm on August 13, 2009, Siva said…

hi and helo. jus a casual smile as i joined here visiting some pages to read their profile. and a smile as a token of friendship.
At 12:56pm on August 5, 2009, Nadakudathi Narasimma said…
Hi Siddharta,

I happened to check your blog and I am looking to connect with you for some suggestions on the development process for our start up.

Regards
Narasimma Prasad
At 11:26am on August 1, 2009, Nishant Neeraj said…
Hey Siddhi,

When and where is the next meet?

- Nishant
At 10:07pm on July 28, 2009, ashwin raju k said…
wens the next meet?
At 12:48pm on July 17, 2009, Prakash said…
Hi Sid,

Can you call me on 94451 52257? Got a requirement.
At 12:06pm on July 9, 2009, S.SUMATHI said…
sir,
I have invented a fuel saving and pollution reducing device for automobiles.I am trying to find out whether it has the same advantages in thermal plants.I need help to commercialise it
At 4:31pm on July 6, 2009, Sirajudeen said…
HI Siddharta,
Missed the 5th July Meet up unfortunately , kindly provide updates on proceeding and the list of participants..... great if there are any pics of the occasion.
Thanks
 
 

About

Badge

Loading…
 

© 2009   Created by Siddharta Govindaraj on Ning.   Create Your Own Social Network

Badges  |  Report an Issue  |  Privacy  |  Terms of Service