Re: Experiences developing a crowdfunding site for open source projects in Clojure (from a Python background)

902 views
Skip to first unread message

Vinzent

unread,
Jul 27, 2012, 3:37:51 PM7/27/12
to clo...@googlegroups.com
Very cool! Thanks for sharing. It's interesting to read such a detailed report about experience with the language.

Unfortunately, I can't access your site: http://kodefund.com/ gives me "The domain name you have requested isn't available". The idea sounds good though, and I'll definitely try kodefund once domain issues will be resolved.

About something like PEP8: there is clojure style guide somewhere on dev.clojure.org, but I think we need more than that. Ideally, there should be a community wiki where everyone would be able to publish common tips-and-trick and gotchas. I bet many beginners would find such a thing useful.

Moritz Ulrich

unread,
Jul 27, 2012, 3:49:35 PM7/27/12
to clo...@googlegroups.com
On Fri, Jul 27, 2012 at 9:37 PM, Vinzent <ru.vi...@gmail.com> wrote:
> Unfortunately, I can't access your site: http://kodefund.com/ gives me "The
> domain name you have requested isn't available".

Looks like your DNS server hasn't received the updated record yet.
Works fine on Google DNS.

Aaron Lebo

unread,
Jul 27, 2012, 4:06:46 PM7/27/12
to clo...@googlegroups.com
It is http://www.kodefund.com.

I haven't setup the "naked" domain, as heroku advises against that. Perhaps I should?

Mark Rathwell

unread,
Jul 27, 2012, 4:10:41 PM7/27/12
to clo...@googlegroups.com
> I haven't setup the "naked" domain, as heroku advises against that. Perhaps I should?

Usually you can setup a 301 redirect from the naked domain to www with your registrar.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Mark Rathwell

unread,
Jul 27, 2012, 4:12:02 PM7/27/12
to clo...@googlegroups.com
> > I haven't setup the "naked" domain, as heroku advises against that.
> > Perhaps I should?
>
> Usually you can setup a 301 redirect from the naked domain to www with
> your registrar.

Should have said, where ever you are hosting DNS, but most registrars
provide this capability if you are using them for DNS.

Aaron Lebo

unread,
Jul 27, 2012, 4:15:46 PM7/27/12
to clo...@googlegroups.com
Yes, I actually just set it up. Very easy. Thank you.

Vincent thanks for pointing that out.
>> clojure+unsubscribe@googlegroups.com

Aaron Lebo

unread,
Jul 27, 2012, 4:17:04 PM7/27/12
to clo...@googlegroups.com
Vinzent rather.

Vinzent

unread,
Jul 27, 2012, 4:19:12 PM7/27/12
to clo...@googlegroups.com
Actually http://www.kodefund.com gives me DNS error, but anyway, looks like  the issues is on my side.

суббота, 28 июля 2012 г., 2:06:46 UTC+6 пользователь Aaron Lebo написал:

Mark Rathwell

unread,
Jul 27, 2012, 4:24:18 PM7/27/12
to clo...@googlegroups.com
> Yes, I actually just set it up. Very easy. Thank you.

Not sure how you are specifying the redirect url, but if you have a
trailing slash, you may want to try removing it.

kodefund.com/about redirects to http://www.kodefund.com//about/

Also, completely nitpicking here, but you might also want to redirect
from http to https for the login page. I don't know if Heroku
provides a way to do that at the web server level, otherwise it has to
be done in code.

Otherwise, nice looking site, and idea, hope it does well.

- Mark
>> >> clojure+u...@googlegroups.com
>> >> For more options, visit this group at
>> >> http://groups.google.com/group/clojure?hl=en
>> >
>> >
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com

Takahiro Hozumi

unread,
Jul 28, 2012, 12:45:13 PM7/28/12
to clo...@googlegroups.com
Hi Aaron,
Thank you for the interesting post.
I guess we all here have quite similar experience as code size shrink.

> I found myself digging around in github repos to actual read code instead of documentation a lot more than I ever did with Python.
Agreed. In fact, for emacs/swank-clojure users this is one key-stroke(M-.) task.

Cheers,
Takahiro.

On Friday, July 27, 2012 4:59:46 AM UTC+9, Aaron Lebo wrote:
Hello!

Sometime around 2 and a half months ago, I started to work on a new project using Clojure. I've been using Python heavily for about 6 six years working for a small direct mail company and before that started programming with Ruby on Rails. This new project was something out of left field, so I had different options on what technology to use. I ended up choosing Clojure, and my work on the site has been my first real experience using a lisp, Clojure, and the JVM. I'd like to share my experiences and how that has differed with my previous Python work.

Before that, I'd like to make a little plug for my site. It is called kodefund (www.kodefund.com). The basic idea is to take the familiar Kickstarter model but to really focus on applying that to open source development. I feel that previous crowdfunding efforts have shown that there is an interest by developers to fund projects that they are enthusiastic about. When this works, everyone wins: the developer working on the project can devote their full time and effort on the actual project and still make a living and others get the benefits of the open source software. I feel like it is preferable over selling licenses to proprietary software or other efforts.

So, every project on kodefund is required to be open source. This differentiates it from other crowdfunding sites, and helps to apply a filter: you know what you are getting when you go there instead of seeing dozens of projects for unrelated stuff.

One other difference is that you can also start a project which is more or less a "reverse" Kickstarter. This allows you to take an idea for a project or issue you want fixed, raise funding, and find someone who will actually implement the project. Other users get to submit "applications" and you choose from them to find the most capable candidate. Once you chose an application, that person takes over the project.

Finally, one other push I want to make is to open up proprietary software. Maybe your company has written some software in-house, but there's no real incentive to release it. What if you could crowdfund the software, get paid to release it, and the open source community as a whole could benefit from that?

I feel like crowdfunding and open source software are an ideal fit.

I'm getting off track here. I'll shift to my actual experiences using Clojure. I was more than a little nervous about using the JVM. It always seemed like some huge, scary thing, and digging into Java libraries was not something I wanted to do. Something which resolved this was leiningen. I feel like it is absolutely brilliant, and it really makes adding libraries to your project a non-issue. Things have slowly changed in Python, but it used to be that downloading dependencies was a global process and you ended up with a site-packages that was full of dozens of old libraries that you used for other projects. Being able to specify in my project.clj file exactly which libraries I need and those getting downloaded automatically is a really nice feature that I will look for similar functionality in other languages from now on.

I was also pleasantly surprised by the library availability. The vast majority of things that I needed such as oauth2 support and such already have decent Clojure wrappers. When I did drop down into Java, I found that to be painless. The JVM really does have a wide swath of functionality already available. Some of the things that I ended up using were email libraries, date formatting libraries, and an rss feed generator. There never was a point where I felt like I was going to have to just roll things by hand. Most of the hard work has been done.

Considering the language itself, one of the first things I noticed (or didn't) was the parentheses. I don't remember when, but they simply are a non-issue after a short amount of time. One slight thing I did have a problem with was that inserting a parenthesis at the wrong place could completely alter the flow of code and it was not immediately obvious. This is not an issue when you are closing off a line or two of expressions, but when you are halfway down the page, insert a paren and everything breaks, it could get frustrating. This is probably resolved through better editor usage. I unfortunately could never get emacs with clojure-mode and goodies working properly on my Windows machine, so I ended up using the counterclockwise Eclipse plugin. It was not a horrible experience but things such as auto-indenting a large block of code was something I never figured out.

Continuing on the surface, some of my favorite parts of the language are little syntax additions. I absolutely love the syntax for anonymous functions. Python obviously has limitations with lamdas anyway, but in Clojure, having a block of code like: (do (println test) (+ 3 3)) and being able to instantly convert that to an anonymous function by sticking a # on the front is really nice. Not having to explicitly name function arguments helps as well.

Destructuring syntax is amazing. Being able to break a map or a vector down and bind numerous variables in a let or function is something that simply is not easily done in Python without some magic. It was nice to have a function definition of something like (defn index [request] ...) in a view and to be able to grab relevant needed variables using the {:keys ...} syntax.

The language is full of these little bits that are really convenient, and I was constantly surprised by something new which significantly reduced the amount of code I was writing.  Having used it, it is straight up painful in my opinion to write markup in anything else. The -> operator, hash maps as functions, etc.

One thing which surprised my was the macros. Initially I didn't use a single macro in my code, and I really couldn't figure out why the were so lauded and considered important by lots of lisp developers. That changed later in the project when I noticed a familiar pattern in my code. The basic problem was that pretty much every single web request has a familiar flow:

Does the resource exist? If not, throw a 404.
Does the user have the proper permissions to access the resource? If not, redirect to login or throw up a permission denied page.
Is this a post? If not, render a form.
If it is and the post is valid, do some work and redirect. If not valid, render the form.

This got used over and over. In Django you often see this in the form of:

def index(request):
    item = get_object_or_404(...)
    form = Form(request, item)
    if request.method == 'POST' and form.valid():
        do stuff
        redirect()
    render('index.html', dict(form=form))

This isn't the worst thing in the world, but its just extra code that gets in the way of the literal intent of the code. When I noticed this pattern I ended up writing a macro which handled the resource check, the auth check, the validation check, the redirection, etc, for me. Once I got to this point, I really "got" macros and their power. You simply don't have the ability to implement your own flow control this easily in Python.

Now, to thinking and working functionally. Python is imperative in parts. One of my favorite parts in it is the list comprehensions, which can be very functional. But for loops and destructive updates abound. Coding without for and accumulators was maybe the most difficult adjustment for me. However, once I started using map (with the aforementioned excellent anon function syntax), I started wanting to use it everywhere I could, because the concept was so simple. The same goes for reduce. Much of the pain of lacking destructive updates is mitigated with things like update-in, and such.

I guess for me the real question is whether programming functionally actually reduces the number of errors as some functional advocates put forward. The problem is that it is so damn hard to objectively compare the two. Did I have more errors when I was programming in Python compared to Clojure? I'd say most of my errors actually came from unfamiliarity of libraries or functionality. The idea that errors can be reduced is interesting, but I'm not ready to fully commit to that suggestion unless we really see hard data. I do know that there are places where destructive updates would be convenient, but I can appreciate basis of programming functionally.

Was there anything I missed when using Clojure compared to Python? The libraries seem to be a wash, the languages themselves are comparable. If anything I did want maturity in some of the libraries. For example, noir has an excellent error validation library. However, compared to Python libraries which do validation and conversion, I found myself writing and debugging extra functionality that I had to implement. I found myself digging around in github repos to actual read code instead of documentation a lot more than I ever did with Python. Obviously these are just issues of time, and they'll improve. Clojure docs and the cheatsheet help a lot, though.

Stacktraces can take a while to get used to, and some of the error messages are cryptic. I can't say how many hours I spent figuring out why #([:key "test"]) wasn't working (you can't place a vector literal directly inside an anonymous function like this. Maybe that should have been obvious to me, but once I ran across these issues and understood them, the pain of understanding stacktraces was mitigated by a large margin.

I guess if there is anything I'd love to see is some kind of style guide. Python has the PEP8 style guide, which more or less suggests how code should be written, not that it has to be written that way. There were lots of times I found myself wondering whether the "right" way was to indent the if form after the conditional or first argument, or whether it was considered "bad" form to nest multiple lets, and how that should be handled. The current cheat sheet is similar, but its not very prescriptive. I'd love to see something which suggests how common tasks should be done, I feel like it might help newbies like me feel more at ease. Does such a thing like PEP 8 exist for Clojure?

Well, those are some of my notes on using Clojure. I feel a little embarrassed writing this up because I feel like someone will pick it to death, and I'm wish I could delve further into hard details instead of dwelling so much on little syntax differences. It has been a fun, useful learning experience, anyway. I feel like anyone who has not worked with a lisp or a functional programming language owes it to their own development to work with Clojure, it really does help you to understand the whats and whys of the JVM, macros, and functional programming.

I'd especially love to see, kodefund, used by the Clojure community. I feel like it is a great way to get new libraries off the ground, or to find people to fix bugs, or even to open up previously  closed software.

If there was a project that you were considering putting on Kickstarter or one of the other crowdfunding sites, please consider kodefund. Unlike the bigger sites, you will have my full attention to your project, and I'm more than willing to work with you to improve and change parts of the site which make crowdfunding more suitable to open source projects.

I've worked really hard to make things as simple as possible. You can start or fund a project no matter where you live, all that is needed to make a pledge is a credit card, and github, twitter, facebook, google are all supported to sign up. Give it a try, let me know what you think. I've tried to explain the rationale further here: http://www.kodefund.com/about/

So, if you've got any questions about kodefund or Python/Clojure, I'm happy to answer them. Thanks to those who have spent their time making this such a useful language!

John Gabriele

unread,
Jul 29, 2012, 11:38:48 AM7/29/12
to clo...@googlegroups.com
On Thursday, July 26, 2012 3:59:46 PM UTC-4, Aaron Lebo wrote:
{snip} 
 The JVM really does have a wide swath of functionality already available. Some of the things that I ended up using were email libraries, date formatting libraries, and an rss feed generator. There never was a point where I felt like I was going to have to just roll things by hand. Most of the hard work has been done.

Curious: If you didn't find what you needed in Java's standard class library, where else did you go looking for Java libraries?
 
{snip} I found myself digging around in github repos to actual read code instead of documentation a lot more than I ever did with Python. Obviously these are just issues of time, and they'll improve.

One way that seems to me a good way to help projects get more docs is to create a fork and add and/or improve existing docstrings.

Another way might be to fork, create a top-level doc dir, write and add a .md file or two, and send a pull-request.

Another way might be to just add docs to the project's wiki, or write your own docs (or even a blog post) and add a link to them from the project's wiki.

Clojure docs and the cheatsheet help a lot, though.

Love these two resources. Note that there's some nice versions of the cheatsheet with tooltips at http://jafingerhut.github.com/
 
I guess if there is anything I'd love to see is some kind of style guide. {snip} There were lots of times I found myself wondering whether the "right" way was to indent the if form after the conditional or first argument, {snip} Does such a thing like PEP 8 exist for Clojure?

It seems to me that the 3 major style rules are:

1. line up args vertically,
2. use 2-space indents, and
3. let Emacs otherwise do indenting for you.

Minor note: that 3rd rule can be difficult to follow if, say, you're not using Emacs. :)


> I'd love to see something which suggests how common tasks should be done, I feel like it might help newbies like me feel more at ease.

This sounds like a job for a community-driven cookbook. There's a cookbook at http://en.wikibooks.org/wiki/Clojure_Programming , but I'd always figured that wikibooks was for "books", rather than for use as a general wiki (please, correct me if I'm wrong here.). There also appears to be a cookbook at http://www.gettingclojure.com/cookbook:clojure-cookbook .

It seems to me that a community-driven wiki would be a good place for a cookbook (and other misc things) to live. (Personally, I like [gitit](http://gitit.net/).

Well, those are some of my notes on using Clojure. I feel a little embarrassed writing this up because I feel like someone will pick it to death, {snip}

Great post. Thanks for writing this up!

---John

Andrew Kondratovich

unread,
Jul 29, 2012, 3:15:50 PM7/29/12
to clo...@googlegroups.com
getting http 500 after registration =(

Aaron Lebo

unread,
Jul 29, 2012, 3:23:40 PM7/29/12
to clo...@googlegroups.com
Hi Samrat.

Could you explain how you are trying to access the site (address) and what is happening?

I started out in noir, and ended up using a lot of the design patterns and validation library. I stopped using noir for two reasons: I like being able to see the routes of all of my urls on a single page (noir binds them to their function definition), and a lot of the tutorials out there concerning different libraries are based on raw Ring or Compojure. I didn't want to get stuck debugging some minor issue simply because I didn't understand the differences between using a library with noir/Compojure, which did happen once.

I really enjoyed noir, though, particularly the validation, it is very clever, though as I said earlier I'd love it if it did conversion as well as validation.

Using Compojure was a blast. It rarely got in the way, which, imo is what a routing framework should do.

On the templating side I used Hiccup. That might be one of my favorite libraries in any language. I desire writing templates in Python because you are stuck opening and closing every brace. It is tedious and error-prone. Hiccup cuts down on that tremendously.

<div class="row">
  <div class="eight columns">
    <p id="test">test</p>
  <div id="yep" class="four columns">
    <span>yep</span>
  </div>
</div>

turns into:

[:div.row
  [:div.eight.columns
    [:p#test "test"]]
  [:div#yep.four.columns
    [:span "yep"]]]

You can't beat that. Notice particularly how easy it is to define ids and classes. Plus it is just Clojure, so you end being able to use the whole power of the language templating.

On the db side I used korma. It beats the hell out of writing raw db statements, but it too stays out of the way. I really like the way that it just inserts joins as part of your result hash maps.

(defentity profile)
(defentity user
  (has-one profile))

(select user (where {:id (*user* :id)}) (with profile))

Something like that would automatically join profile to user and return a single hash map.

It is a contrived example, but you get the gist. Only problem I had with it was that you end up writing by hand more complex stuff like unions. Not a big deal but you want the same convenience.

On Sat, Jul 28, 2012 at 12:12 AM, Samrat Man Singh <samratm...@gmail.com> wrote:
I can't access your site. Also, I wanted to ask whether you used Noir or used a lower-level option(Compojure,etc)? 

Aaron Lebo

unread,
Jul 29, 2012, 3:45:00 PM7/29/12
to clo...@googlegroups.com
Curious: If you didn't find what you needed in Java's standard class library, where else did you go looking for Java libraries?

Usually it was just a matter of Googling something like "java rss" if I was in need of an rss library. Once I found a library which seemed useful and supported, in this case, ROME I'd then look for the maven link on their site or googled "rome maven".  Usually you can find the link pretty fast, but the mvn repository also seems like a could place to check.

Once you find the most recent version you just stick that in your project.clj file and let lein handle the rest. It isn't an exact process by any means but it worked well.

One way that seems to me a good way to help projects get more docs is to create a fork and add and/or improve existing docstrings. ...

 Yeah, when I stated that I found myself digging around on github there's actually two sides to it. Yeah it was a bummer that there aren't docs on more libraries, but the flip side of the coin is that it is a testament to the language that I could actually do so and grok other people's code after only a few weeks of use.


It seems to me that the 3 major style rules are:

1. line up args vertically,
2. use 2-space indents, and
3. let Emacs otherwise do indenting for you.

Minor note: that 3rd rule can be difficult to follow if, say, you're not using Emacs. :)

Thank you. One of my big disappointments with the project was that I couldn't use Emacs working. I've always been awed by some of the descriptions of emacs lisp editing environments and I wanted to experience that myself. Unfortunately there is some issue with Windows 7 and file permissions and I setting up the Emacs side that I could never resolve through googling. Perhaps it would be worth spending more time to fix, but I hadn't even used the language and I just wanted to use something that worked, which for its faults, Eclipse and counterclockwise did.


This sounds like a job for a community-driven cookbook. There's a cookbook at http://en.wikibooks.org/wiki/Clojure_Programming , but I'd always figured that wikibooks was for "books", rather than for use as a general wiki (please, correct me if I'm wrong here.). There also appears to be a cookbook at http://www.gettingclojure.com/cookbook:clojure-cookbook .

It seems to me that a community-driven wiki would be a good place for a cookbook (and other misc things) to live. (Personally, I like [gitit](http://gitit.net/).

 Certainly sounds useful. Here's PEP 8 as an example of what I'm talking about:
http://www.python.org/dev/peps/pep-0008/

Thanks for your comments.
 

Aaron Lebo

unread,
Jul 29, 2012, 3:47:10 PM7/29/12
to clo...@googlegroups.com
What would we do without bugs? :) :(

I've noticed that several people have gotten in using regular registration as well as even logging in through github or Facebook. What method are you using?

Aaron Lebo

unread,
Jul 29, 2012, 3:49:29 PM7/29/12
to clo...@googlegroups.com
Just saw that you are actually in the system here:

http://www.kodefund.com/users/8/

The 500 error probably was in sending off the validation email, which you dont need to login. Sorry, some of these little things pop up from time to time.

Samrat Man Singh

unread,
Jul 30, 2012, 7:38:00 AM7/30/12
to clo...@googlegroups.com
I got an error when I went to the link, you posted in the original post.

John Gabriele

unread,
Jul 30, 2012, 1:02:47 PM7/30/12
to clo...@googlegroups.com
On Sunday, July 29, 2012 3:45:00 PM UTC-4, Aaron Lebo wrote:

> Here's PEP 8 as an example of what I'm talking about:

Ivan Koblik

unread,
Aug 1, 2012, 3:05:07 AM8/1/12
to clo...@googlegroups.com
Hi Aaron,

Thank you for such an interesting post.

You wrote that you could not setup Emacs on Windows. I decided to show you an easy way to do it.
1. Download vanilla Emacs from here:

Latest version at the moment is here:

2. Unpack it to a directory where you'll run it from.

3. Download this configuration:

I prepared it on Linux but it works perfectly on Windows. I used it myself to 2 windows machines with no issues.

4. Unpack it to %APPDATA% (i.e. c:\Users\YOUR_USER_NAME\AppData\Roaming). If you had .emacs or .emacs.d there already, move them somewhere else.

That's it! Your Emacs is now configured. Easiest way to use it as REPL is to launch your application with: "lein swank" and then in Emacs M-x (Alt-x), slime-connect, enter, press enter 2 more times.

Cheers,
Ivan

Maik Schünemann

unread,
Aug 1, 2012, 4:50:08 AM8/1/12
to clo...@googlegroups.com
I very recently set up emacs on windows for work with clojure. (finally using clojure at work :))
Nowadays it is not difficult to install ist just get emacs and set the home variable of your system where you want to put your
.emacs and .emacs.d.
then downloading clojure mode and installing slime like in the instructions and you can do M-x clojure-jack-in

Your post was very interesting

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
Reply all
Reply to author
Forward
0 new messages