Re: Simple things should be simple
On Fri, 10 Sep 2010 01:08:06 -0400 John Newman john...@gmail.com wrote: (use '[clojure.contrib.server-socket :only (create-server)] '[clojure.contrib.duck-streams :only (read-lines)]) (create-server 8080 (fn [in out] (when-not (empty? (read-lines in)) (spit out Hello, World!\n 4/0/0 Nah, 4/0/1 - I count the implementation language as a tool in every case. Unless you forgot the clj script and the #!/usr/bin/env clj line, so it's 5/0/2. Believe it or not, on at least one occasion I've put things on that level into production on the public internet. It met the requirements, including scalability for any foreseeable growth. I think that Java's strength is enterprise-level, highly scalable web servers make people assume that every problem must be a nail for that hammer. The thing is, out here in the real world, the vast majority of web-based applications have no need to be highly scalable. Sure, if you put an app on the public internet, you ought to be prepared for it to go viral and have a plan for serious scalability. But most web applications aren't on the public internet. Look around your own office - or even your own house. How many lan-only web serves do you have? They're never going to scale beyond the size of your company. I've got about six such running here (two for real services, two for development, and two for doing test builds on the deployment platform). And calibre, which runs a web server to transfer ebooks from my library to ebook readers. If you count the not-http-apache modules I'm working on, and the servers that speak that protocol, that adds another half dozen. Apps running on those don't need to be highly scalable, so why should someone deploying to them have to deal with such cruft? Now look for any kind of network appliance: routers, printers, NAS boxes, who knows what else. Chances are they have a web server embedded in them somewhere. There's no good reason for them to need to deal with two simultaneous connection, but most use an open source server that's a bit better than that. I've got at least five of those on my LAN, and I'd be surprised if the cable modem doesn't run one. They only way they'll get the kind of traffic that would require scalability is if someone DDoS's them. Further, they tend to run on boxes with very limited resources, so not only do they not need the overhead for scalability, but providing it is liable to make a noticeable impact on system performance elsewhere. Finally, for a real kicker, up through iPhone OS 3, Apple failed to provide a standard method to move data between the iPhone and desktop applications. So applications that wanted to do that tended to run a web server for the purpose (except for one oddball app that ran an ftp server). I had three or four of those before I switched to Android. Since Android lets apps write to disk that can be mounted via USB on your desktop, most do that - but I wouldn't be surprised if there was at least one web server lurking in the system somewhere. Even more limited resources, and slower CPUs thanks to the battery issues. And before you complain that Java's not appropriate for that environment, consider Java ME and Dalvik. Nah, web servers that simply don't need to be scalable far out number those that do. The only question is whether the curve is a bell curve or an inverse logarithm, but in either case things that need to be highly scalable web servers are out under the tail of the curve. The fast majority of web servers don't need that, they just need a simple way to get the code running. Which is why simple things should be simple is important - there are a lot more of them than there are of the others. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
Hi, On 9 Sep., 20:46, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: The first problem with that is that this stuff seems show up *everywhere* in Javaland. It's not just web apps, it's pretty much anything. You just lost me completely with your argumentation. I wrote a small desktop utility (simple problem, simple solution, simple program) which is distributed to different locations in the company. It works on Windows and Unix w/o adaption to the system. Download jar and double-click / execute via java -jar. It works without library version hell, complicated Makefiles, system differences and other shenanigans. I'm quite willing to pay more complexity upfront to have it easier in the end. It is obvious that Clojure doesn't fit your needs. Then simply don't use it. Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
2010/9/10 Meikel Brandmeyer m...@kotka.de: Hi, On 9 Sep., 20:46, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: The first problem with that is that this stuff seems show up *everywhere* in Javaland. It's not just web apps, it's pretty much anything. You just lost me completely with your argumentation. I wrote a small desktop utility (simple problem, simple solution, simple program) which is distributed to different locations in the company. It works on Windows and Unix w/o adaption to the system. Download jar and double-click / execute via java -jar. It works without library version hell, complicated Makefiles, system differences and other shenanigans. I'm quite willing to pay more complexity upfront to have it easier in the end. It is obvious that Clojure doesn't fit your needs. Then simply don't use it. Meikel, while I admit I haven't read *all* the answers to Meikel's question in their entirety, what I've understood is that : * he's not talking about clojure the language, but its ecosystem (the JVM host and the J2EE stuff -de facto standard for webapps) = so I disagree with you, clojure *may* fit its needs * AFAIK the state of the art for clojure hosted on the JVM is not fixed, so I don't see why your advice to him is to not use it. All, Beware trying too hard to defend a position which is not defendable. Lee said it with probably less provocative terms than Mike, but Mike being a bit provocative doesn't mean Mike's point is wrong. And Mike's examples being a bit (ok maybe a lot) caricatural (is this the idiomatic english word for what I mean?) doesn't mean his point is invalid. These last few months, working on ccw has been particularly interesting because I've had feedback from users, especially Lee. Lee has challenged a lot of what I had considered to be simple things in ccw. I can say that when you're in a position of expert, it's hard to change your mind, because at first, you reject the new user's points as invalid. I think that I finally got some points, and have implemented them in ccw. I've learned something from this : the It's harder to do/design simple things than complex ones maxim is soo true. But what I also learned is that one point that makes it hard to follow the maxim is when you consider that you've reached the nirvana of simplicity for your system (either public interface or internals) and there's nothing more to do. Probably Apple with its iPhone is a popular example of great minds having been able to be the first in the market to offer interfaces simpler that what everybody else, used to classic user interface ergonomics, would have imagined possible. I guess a lot of people switch to clojure because they recognize in it that the simpler paradigm to start with with your program (functional programming), the better the program. By doing so they are recognizing that Java is not a good example of Simple things made simple. And the same problem Java the language has, the same problem all its ecosystem has (to some level, those are gross approximations, of course). What Matt told several posts above about conjure seem to be an interesting step towards simplicity, without affecting incremental addition of features/essential complexity to the growing program. Peace my friends, cheers, -- Laurent -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
Hi, On 10 Sep., 10:27, Laurent PETIT laurent.pe...@gmail.com wrote: while I admit I haven't read *all* the answers to Meikel's question in their entirety, what I've understood is that : * he's not talking about clojure the language, but its ecosystem (the JVM host and the J2EE stuff -de facto standard for webapps) = so I disagree with you, clojure *may* fit its needs I'm also not talking about clojure the language, but about the ecosystem. To deploy my simply (a detail, but since we are talking about Hello, World...) clojure (a detail, could written in groovy, scala, java, ...) program I used gradle (written in Groovy, useful for other JVM stuff), several maven repos and the JRE (part of the JVM environment). I just packed everything in jar distributed it around the world and it worked in a heterogeneous environment without further support. How much simpler can it get? What I actually wanted to point out: there is no simple. simple is highly subjective and talking about simple in absolute terms is a mistake. * AFAIK the state of the art for clojure hosted on the JVM is not fixed, so I don't see why your advice to him is to not use it. Because it obviously doesn't fit his needs. Mike wants a simple solution for simple problems. It seems that at the moment there is no JVM solution that is simple enough for Mike's context. So he shouldn't use Clojure. Or Groovy. Or Scala. Clojure being just a detail of his problem (Mike states several times, that he talks about the JVM environment not the language.) When things change and complexity is reduced for his context, Mike can re-evaluate the use of Clojure. And if the whole system fits the bill, he might even choose to use Clojure for future projects. Isn't that a reasonable approach? Beware trying too hard to defend a position which is not defendable. I'm not defending a lost position. There are other tools which fit Mike's needs better than clojure *at the moment*. So there is no point trying to convince him. That doesn't mean that we shouldn't change the situation and make things simpler (for some definition of simple). Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
2010/9/10 Meikel Brandmeyer m...@kotka.de: Hi, On 10 Sep., 10:27, Laurent PETIT laurent.pe...@gmail.com wrote: while I admit I haven't read *all* the answers to Meikel's question in their entirety, what I've understood is that : * he's not talking about clojure the language, but its ecosystem (the JVM host and the J2EE stuff -de facto standard for webapps) = so I disagree with you, clojure *may* fit its needs I'm also not talking about clojure the language, but about the ecosystem. To deploy my simply (a detail, but since we are talking about Hello, World...) clojure (a detail, could written in groovy, scala, java, ...) program I used gradle (written in Groovy, useful for other JVM stuff), several maven repos and the JRE (part of the JVM environment). I just packed everything in jar distributed it around the world and it worked in a heterogeneous environment without further support. How much simpler can it get? What I actually wanted to point out: there is no simple. simple is highly subjective and talking about simple in absolute terms is a mistake. * AFAIK the state of the art for clojure hosted on the JVM is not fixed, so I don't see why your advice to him is to not use it. Because it obviously doesn't fit his needs. Mike wants a simple solution for simple problems. It seems that at the moment there is no JVM solution that is simple enough for Mike's context. So he shouldn't use Clojure. Or Groovy. Or Scala. Clojure being just a detail of his problem (Mike states several times, that he talks about the JVM environment not the language.) When things change and complexity is reduced for his context, Mike can re-evaluate the use of Clojure. And if the whole system fits the bill, he might even choose to use Clojure for future projects. Isn't that a reasonable approach? Beware trying too hard to defend a position which is not defendable. I'm not defending a lost position. There are other tools which fit Mike's needs better than clojure *at the moment*. So there is no point trying to convince him. That doesn't mean that we shouldn't change the situation and make things simpler (for some definition of simple). That's what I wanted to read, 'cause the state of your previous answer seemed so negative ! :-) Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@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 clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Sep 9, 6:06 pm, Phil Hagelberg p...@hagelb.org wrote: On Thu, Sep 9, 2010 at 8:38 AM, Mike Meyer mwm-keyword-googlegroups.620...@mired.org wrote: And two tools - lein and clojure itself. I'm not sure Clojure should be counted separately since you're not installing it yourself. So we go from 3, 0, 1 to 6, 4, 2. I'm not sure that qualifies as simple, but at least there's less boilerplate for the tools than there is actual source code. Really I think your complaint boils down to not being able to modify the classpath at runtime. If the JVM had a real load-path like other lisps offer then this would be enough: (use 'ring.adapter.jetty 'ring.util.response) (run-jetty (constantly (response hello world)) {:port 8080 :join? false}) ...and we're back to three lines. Now I'm not defending the fact that the classpath is fixed at JVM-launch time--it's an awful hack that is an embarrassment to the awesome engineering prowess that has gone in to other parts of the JVM. But we do have tools to work around that flaw, and it's good to recognize the root of the problem rather than its symptoms. Except the classpath is *not* fixed at all! The concept of classpath does not exist inside the JVM. Classloaders do. Classloaders are objects like any other - you can create new instances of them, and alter their state. Classpath is just an environment variable / command- line argument to java, used to conveniently initialize the system classloader from the outside world. In fact, many JVM-based dynamic languages allow the classpath to be changed at runtime. I know for sure BeanShell does, and ABCL does too - I contributed the patch to it. As for the OP's quest for simplicity - I agree that often things are overly complicated in the Java world. However, I think that comparing Apache's cgi-bin with .war packaged applications is unfair, since they do have different goals. If you want the same drop file in diredirectoryctory and be done with it experience, follow these steps: 1) download Tomcat and unzip it in $tomcat 2) put clojure.jar is $tomcat/webapps/ROOT/WEB-INF/lib this installs the server. Then, for each application, put a .jsp file in $tomcat/webapps/ROOT containing: % out.print(clojure.lang.RT.eval((foo bar baz))); % (or whatever the right incantation is to eval from Java). done. Browse http://localhost:8080/scriptName.jsp to run it. Of course, I'd NOT recommend this, but you seem to know what you want. Cheers, Alessio -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Sep 9, 11:47 am, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: On Thu, 9 Sep 2010 16:28:48 +0100 Edmund Jackson edmundsjack...@gmail.com wrote: Hi Mike, Could you perhaps present a counter-example of greater simplicity ? $ cat - /usr/local/www/apache22/cgi-bin/hello-world.sh #!/bin/sh echo 'Content-type: text/plain\n' echo Hello World ^D $ chomd 755 /usr/local/www/apache22/cgi-bin/hello-world.sh Done. Three lines of source code. 0 lines of framework setup. 1 tool (sh). Pretty much the same thing works for python, perl, etc. It's about as robust as can be asked for - that's the nature of apache. Performance is going to be mediocre at best. That's the trade-off for simplicity. mike cat - /usr/local/www/apache22/cgi-bin/hello-world #!/usr/local/bin/clj (println Content-type: text/plain\n) (println Hello, World!) ^D Is that simple enough? For better startup performance, you can use Nailgun. -John -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
Just to be contrary ;) A one time investment of 2 minutes (I did have to scrounge in contrib to locate these after all): (defn make-stupid-simple-script [f content] (spit f content) (sh chmod 755 (.getName f))) for the eternal pleasure of using: user= (make-stupid-simple-script (File. /usr/local/www/apache22/cgi- bin/hello-world.sh) #!/bin/sh\n echo 'Content-type: text/plain\\n' echo Hello World) Feel free to take this and run with it :) On Sep 9, 9:47 am, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: On Thu, 9 Sep 2010 16:28:48 +0100 Edmund Jackson edmundsjack...@gmail.com wrote: Hi Mike, Could you perhaps present a counter-example of greater simplicity ? $ cat - /usr/local/www/apache22/cgi-bin/hello-world.sh #!/bin/sh echo 'Content-type: text/plain\n' echo Hello World ^D $ chomd 755 /usr/local/www/apache22/cgi-bin/hello-world.sh Done. Three lines of source code. 0 lines of framework setup. 1 tool (sh). Pretty much the same thing works for python, perl, etc. It's about as robust as can be asked for - that's the nature of apache. Performance is going to be mediocre at best. That's the trade-off for simplicity. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail -www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Fri, Sep 10, 2010 at 4:47 AM, John Cromartie jcromar...@gmail.com wrote: #!/usr/local/bin/clj (println Content-type: text/plain\n) (println Hello, World!) ^D Is that simple enough? That was my thought too, java/clojure console app should not be more complex than python etc. The issue is the startup time For better startup performance, you can use Nailgun. How can nailjun help here ? I am not too familiar with it. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
Finally, cat - /usr/local/www/apache22/cgi-bin/hello-world #!/usr/local/bin/clj (println Content-type: text/plain\n) (println Hello, World!) ^D I can start using Clojure again :) John -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Sep 10, 1:32 am, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: I think that Java's strength is enterprise-level, highly scalable web servers make people assume that every problem must be a nail for that hammer. I think that Unix's strength is small independent programs communicating over standard I/O makes you assume that every environment must be a hammer for that nail. The JVM environment is philosophically quite different from Unix. Don't use a JVM language to write one-liners that have to be loaded every time they're run. There's not much point in people continuing to defend Clojure and/or the java ecosystem; unix has its place and so does java. You've noticed a symptom of something fundamental in java, you're not particularly happy about it, so choose a different tool. Hashbang script hacks, nailgun, or other workarounds aren't going to change your mind. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Fri, Sep 10, 2010 at 1:27 AM, Laurent PETIT laurent.pe...@gmail.com wrote: These last few months, working on ccw has been particularly interesting because I've had feedback from users, especially Lee. Lee has challenged a lot of what I had considered to be simple things in ccw. I can say that when you're in a position of expert, it's hard to change your mind, because at first, you reject the new user's points as invalid. dang. well said, and needs to be said more! somebody buy this man a thank you drink :) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Fri, 10 Sep 2010 00:03:22 -0700 (PDT) Meikel Brandmeyer m...@kotka.de wrote: Hi, On 9 Sep., 20:46, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: The first problem with that is that this stuff seems show up *everywhere* in Javaland. It's not just web apps, it's pretty much anything. You just lost me completely with your argumentation. I wrote a small desktop utility (simple problem, simple solution, simple program) which is distributed to different locations in the company. It works on Windows and Unix w/o adaption to the system. Download jar and double-click / execute via java -jar. It works without library version hell, complicated Makefiles, system differences and other shenanigans. I'm quite willing to pay more complexity upfront to have it easier in the end. Ok, let's see how this goes: With simple things are simple tools, for a simple problem with a simple solution and a simple program, the solution goes like this: 1) Write program in chosen unix-friendly interpreted language. 2) Distribute program text file. Users can then run it via double-clicking (mac windows), running it directly on the command line (mac unix) or - under extreme duress - running it via the interpreter on the command line. As far as I can tell, to do the same thing with Java tools, the steps are: 1) Write program in chosen language that runs on the JVM. 2) Compile program to class file(s). 3) Use some tool to create a manifest file. 4) Run jar to create jar file. 5) Distribute jar file. Users can then run it via double-clicking (mac windows) or via the interpreter on the command line (mac unix). There is no option to run it directly on the command line. Possibly some tool will do steps 3 and 4 in single step for you. So the Javaland tools take at least twice as many steps, and deliver a solution that's harder to use in some cases. Of course, I'm not as familiar with Javaland tools as I am Unix tools, so maybe I got it wrong. If so, *please* tell me the better way! It is obvious that Clojure doesn't fit your needs. Then simply don't use it. Wrong. It may be that the Java infrastructure that Clojure runs in is baroque enough that I won't be willing to use it. Then the same would be true of any language running on the JVM. On the other hand, a Clojure that ran on, oh, Parrot just for instance, wouldn't have any of these problems. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Fri, 10 Sep 2010 07:11:18 -0700 gary ng garyng2...@gmail.com wrote: On Fri, Sep 10, 2010 at 4:47 AM, John Cromartie jcromar...@gmail.com wrote: #!/usr/local/bin/clj (println Content-type: text/plain\n) (println Hello, World!) ^D Is that simple enough? That was my thought too, java/clojure console app should not be more complex than python etc. The issue is the startup time For better startup performance, you can use Nailgun. How can nailjun help here ? I am not too familiar with it. Nailgun is a java server, for want of a better term. You start it with the classpath you want. You then run a front end that you pass the classname arguments you'd normally hand to java, and it runs them. Instead of exiting when they end, it hangs around so the next time you run it, you don't have to reload the classes. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Fri, Sep 10, 2010 at 12:17 PM, Mike Meyer mwm-keyword-googlegroups.620...@mired.org wrote: 1) Write program in chosen language that runs on the JVM. 2) Compile program to class file(s). 3) Use some tool to create a manifest file. 4) Run jar to create jar file. 5) Distribute jar file. Users can then run it via double-clicking (mac windows) or via the interpreter on the command line (mac unix). There is no option to run it directly on the command line. It's true that the command-line situation with java is awful. Here's one solution that does a pretty good job of promoting the JVM to a first-class CLI citizen: http://hashdot.sourceforge.net/ Of course, it would also help a lot if Clojure shipped with its own shell script. -Phil -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
Hi, Am 10.09.2010 um 21:17 schrieb Mike Meyer: 1) Write program in chosen unix-friendly interpreted language. You lost exactly here. unix-friendly. Since you keep putting your context over everything, I will also keep on putting mine over everything. Ruby, Python, Perl, Tcl, ... are all not installed on the machine I have to target. So writing things in them requires me to have two month dance with corporate IT only to get no support in the end. I'm sorry, but unix friendly interpreted language is *not* simple. Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Fri, 10 Sep 2010 23:21:01 +0200 Meikel Brandmeyer m...@kotka.de wrote: Hi, Am 10.09.2010 um 21:17 schrieb Mike Meyer: 1) Write program in chosen unix-friendly interpreted language. You lost exactly here. unix-friendly. Since you keep putting your context over everything, I will also keep on putting mine over everything. Ruby, Python, Perl, Tcl, ... are all not installed on the machine I have to target. So writing things in them requires me to have two month dance with corporate IT only to get no support in the end. I'm sorry, but unix friendly interpreted language is *not* simple. Fair enough. But Java is not installed on the machines *I* have to target, so writing things in a JVM language requires *me* to go through the multi-month dance with security just to be allowed to use it. (Come to that, I've already had clojure rejected by my current client because the JVM hasn't been vetted for security, and doing so wasn't worth the effort). In the real world, you get one of two situations: 1) Most linux distros, and a few Unix distros (including Macs) come with Java, Python, Perl, Ruby and most popular languages already installed. 2) Windows, the rest of the Unix distros and a few oddball Linux distros come *without* Java, Python, Perl, Tcl, Ruby etc. installed, so you have to go through some kind of dance to get them. As far as I can tell, neither one has an advantage over the other, unless you're in an environment where one has already been approved, and the other hasn't. I'm trying to be fair, and ignore things that are local aberrations that only need to be overcome once. I mean, really - if I complained that Clojure had a problem because it ran on the JVM and my clients don't want to go to the effort to vet the JVM, you'd be quite right in laughing at me and pointing out that the problem is with my clients, not with clojure. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Convenience (was Simple things should be simple)
On Fri, 10 Sep 2010 17:29:24 -0400 Stuart Halloway stuart.hallo...@gmail.com wrote: Hi Mike, I think this is more about convenience than simplicity. In both Unix and Java deployment is complex, and often complicated as well. In spite of this, small, one-off things should be convenient to deploy, and Unix does this better in some contexts. There is no reason we can't make one-off scripting convenient in Clojure. The specific example you raised (deploying one-off scripts) could be addressed by a standard launcher. Several have been written, and we need to take the simplest design and include it in Clojure. There is already a ticket for this: https://www.assembla.com/spaces/clojure/tickets/366-multiplatform-command-line-clojure-launcher, and I would love to see it in the next release. That said, your example was one representative example of a general problem. Inconvenience bubbles up from the Java ecosystem in many places. Fortunately, these inconveniences are easier to fix in Clojure that elsewhere, since Clojure is such a simple language. :-) Bingo. I think it's deeper than that. The reason that the Unix version is so simple isn't just a simple launcher script, or the #! hack, or any one things. It's that simple things should be simple is axiomatic for those tools (I'm not sure which came first - the software tools project or unix, but they both share this philosophy, and software tools project ran on damn near everything when they were still supported). All those things derive from that philosophy, and combine to make simple things simple. I.e. - someone claimed that this boils down to not being able to tweak CLASSPATH in the program. Well, that would help, but it's not quite enough. Most simple/simple programs don't have to tweak their search path for loadable modules, because - no matter where they are running - the default path to look for loadable modules includes the current directory, possibly the directory the application was launched from, and the appropriate library directory for that installation of the system. Which means that 95% of the time, you don't have to worry about the path at all. Simple things - loading standard modules (even if they're optional), loading application-specific modules, or even invocation-specific modules - are simple, because the appropriate elements are *already* in the search path. Ditto for compiled binaries: if they're built properly, they know where to find all their shard libraries, and you don't have to muck about with LD_LIBRARY_PATH. The default CLASSPATH is ., so to do anything more complicated than running a .class file from the current directory (and really - how often do you do that?) you have to do something complicated. Ok, fixing this in clojure would require the ability to change the class path - or a smarter classloader - that looked in the right places to start with. So that ability is a first step in this direction. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Simple things should be simple
I've spent far more time evaluating clojure than I had expected to. Part of the problem is that I'm of two minds. I love the language - it seems to mix in just the right bits of LISP, data structures from modern dynamic languages, and functional programming. On the other hand, I'm repelled by the java infrastructure around it. Having been brought up on Unix systems and the software tools approach (well, exposed to them relatively early, anyway), I'm a firm believer that simple things should be simple, and complex things should be possible. That's fundamental, but the Java world seems to have forgotten it, and everything is targeted at building large systems. If you want to do something simple, it seems you still have to go through the dance required to do complex things. So, I'm asking for someone to show me I'm wrong. In particular, if I wanted to deploy a simple web app (the classic Hello World) on your favorite java or clojure web framework, how many lines of text do I have to deal with? Most importantly, how many of those are program text, and how many are framework boilerplate(*)? Finally, how many tools do I have to use to get it deployed(+)? For good Unix tools, the answers are 3, 0 and 1. mike *) If some tools generates files that are used, only files that I have to change count, but all the lines in those files count. Blank lines added to improve readability don't count. +) Not counting whatever is required to get the web server ready to deploy arbitrary applications (war files or whatever), or a text editor, so long as it's *any* text editor, and not a specific one. -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
2010/9/9 Mike Meyer mwm-keyword-googlegroups.620...@mired.org: I've spent far more time evaluating clojure than I had expected to. Part of the problem is that I'm of two minds. I love the language - it seems to mix in just the right bits of LISP, data structures from modern dynamic languages, and functional programming. On the other hand, I'm repelled by the java infrastructure around it. Having been brought up on Unix systems and the software tools approach (well, exposed to them relatively early, anyway), I'm a firm believer that simple things should be simple, and complex things should be possible. That's fundamental, but the Java world seems to have forgotten it, and everything is targeted at building large systems. If you want to do something simple, it seems you still have to go through the dance required to do complex things. So, I'm asking for someone to show me I'm wrong. In particular, if I wanted to deploy a simple web app (the classic Hello World) on your favorite java or clojure web framework, how many lines of text do I have to deal with? Most importantly, how many of those are program text, and how many are framework boilerplate(*)? Finally, how many tools do I have to use to get it deployed(+)? Is there a limit on the line length ? :-p For good Unix tools, the answers are 3, 0 and 1. mike *) If some tools generates files that are used, only files that I have to change count, but all the lines in those files count. Blank lines added to improve readability don't count. +) Not counting whatever is required to get the web server ready to deploy arbitrary applications (war files or whatever), or a text editor, so long as it's *any* text editor, and not a specific one. -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@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 clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
Hi, I don't know what the full definition of deploy is, but here is an example, that should serve as a starting point: http://m.3wa.com/?p=472 Sincerely Meikel -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, Sep 9, 2010 at 10:07 AM, Mike Meyer mwm-keyword-googlegroups.620...@mired.org wrote: So, I'm asking for someone to show me I'm wrong. In particular, if I wanted to deploy a simple web app (the classic Hello World) on your favorite java or clojure web framework, how many lines of text do I have to deal with? Most importantly, how many of those are program text, and how many are framework boilerplate(*)? Finally, how many tools do I have to use to get it deployed(+)? If you're going for simplicity over robustness and you have lein installed, all you need to do is the following: lein new nano-web Edit your project.clj (defproject nano-web 1.0.0-SNAPSHOT :dependencies [[org.clojure/clojure 1.2.0] [org.clojure/clojure-contrib 1.2.0] [ring 0.2.5]]) So far we have 4 lines to define our dependencies. Edit src/core/nano_web.clj (ns nano-web.core (use [ring.adapter.jetty :only [run-jetty]] [ring.util.response :only [response]])) (defn hello-world [req] (response Hello World!)) (defonce server (run-jetty hello-world {:port 8080 :join? false})) That's the 8 lines of actual code needed to have a full functioning web application. Let's start it: lein repl user= (load nano_web/core) So 12 lines of code and 2 command line operations, 1 expression at the REPL. Cheers, David -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, 9 Sep 2010 07:46:22 -0700 (PDT) Meikel Brandmeyer m...@kotka.de wrote: Hi, I don't know what the full definition of deploy is, but here is an example, that should serve as a starting point: http://m.3wa.com/?p=472 That's a good example of simple things not being simple. Before I've seen a single line of code, I see I need to create an order of magnitude more lines of boilerplate than lines of code in the application using a framework that makes simple things simple. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
Hi Mike, Could you perhaps present a counter-example of greater simplicity ? Edmund On Thu, Sep 9, 2010 at 4:03 PM, Mike Meyer mwm-keyword-googlegroups.620...@mired.org wrote: On Thu, 9 Sep 2010 07:46:22 -0700 (PDT) Meikel Brandmeyer m...@kotka.de wrote: Hi, I don't know what the full definition of deploy is, but here is an example, that should serve as a starting point: http://m.3wa.com/?p=472 That's a good example of simple things not being simple. Before I've seen a single line of code, I see I need to create an order of magnitude more lines of boilerplate than lines of code in the application using a framework that makes simple things simple. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.comclojure%2bunsubscr...@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 clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
2010/9/9 Mike Meyer mwm-keyword-googlegroups.620...@mired.org: I've spent far more time evaluating clojure than I had expected to. Part of the problem is that I'm of two minds. I love the language - it seems to mix in just the right bits of LISP, data structures from modern dynamic languages, and functional programming. On the other hand, I'm repelled by the java infrastructure around it. Having been brought up on Unix systems and the software tools approach (well, exposed to them relatively early, anyway), I'm a firm believer that simple things should be simple, and complex things should be possible. That's fundamental, but the Java world seems to have forgotten it, and everything is targeted at building large systems. If you want to do something simple, it seems you still have to go through the dance required to do complex things. So, I'm asking for someone to show me I'm wrong. In particular, if I wanted to deploy a simple web app (the classic Hello World) on your favorite java or clojure web framework, how many lines of text do I have to deal with? Most importantly, how many of those are program text, and how many are framework boilerplate(*)? Finally, how many tools do I have to use to get it deployed(+)? For good Unix tools, the answers are 3, 0 and 1. Out of curiosity, can you explicit the numbers 3, 0 and 1, so that it'll be easier to see whether we're compared cats with cats ? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
I'm not sure what your point is. If I want to write a hello world php script on a unix system, but apache and mod_php weren't setup. I'd first have to install them and configure them. This is only easy these days because most linux come with apache installed, php installed, mod_php preconfigured for you. You want something simple that requires no config, this can happen during dev. Just write the hello world, and start the embedded jetty using ring. If you really just want to serve hello world, you don't need to resort to deploy a war file. you can just take that hello world script, start the embeded jetty and mod_proxy to it. That's hardly the production way, but then I don't know that writing a web app that prints 1 line is really very production either. Now it's true that there are some overhead to make sure your webapp produce a war file and can be deployed to ANY containers. It's not 3/1/0 as you claimed. But it's a pretty small part of the web app dev cycle in my experience. I mean, it's not like I spend 90% of my time writing config files and 10% of my time writing clojure/groovy/java/(insert whatever jvm language) code, web dev or otherwise. On Thu, Sep 9, 2010 at 11:03 AM, Mike Meyer mwm-keyword-googlegroups.620...@mired.org wrote: On Thu, 9 Sep 2010 07:46:22 -0700 (PDT) Meikel Brandmeyer m...@kotka.de wrote: Hi, I don't know what the full definition of deploy is, but here is an example, that should serve as a starting point: http://m.3wa.com/?p=472 That's a good example of simple things not being simple. Before I've seen a single line of code, I see I need to create an order of magnitude more lines of boilerplate than lines of code in the application using a framework that makes simple things simple. -- Omnem crede diem tibi diluxisse supremum. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
I'm not sure what your point is. If I want to write a hello world php script on a unix system, but apache and mod_php weren't setup. I'd first have to install them and configure them. This is only easy these days because most linux come with apache installed, php installed, mod_php preconfigured for you. You want something simple that requires no config, this can happen during dev. Just write the hello world, and start the embedded jetty using ring. If you really just want to serve hello world, you don't need to resort to deploy a war file. you can just take that hello world script, start the embeded jetty and mod_proxy to it. That's hardly the production way, but then I don't know that writing a web app that prints 1 line is really very production either. Now it's true that there are some overhead to make sure your webapp produce a war file and can be deployed to ANY containers. It's not 3/1/0 as you claimed. But it's a pretty small part of the web app dev cycle in my experience. I mean, it's not like I spend 90% of my time writing config files and 10% of my time writing clojure/groovy/java/(insert whatever jvm language) code, web dev or otherwise. On Thu, Sep 9, 2010 at 11:03 AM, Mike Meyer mwm-keyword-googlegroups.620...@mired.org wrote: On Thu, 9 Sep 2010 07:46:22 -0700 (PDT) Meikel Brandmeyer m...@kotka.de wrote: Hi, I don't know what the full definition of deploy is, but here is an example, that should serve as a starting point: http://m.3wa.com/?p=472 That's a good example of simple things not being simple. Before I've seen a single line of code, I see I need to create an order of magnitude more lines of boilerplate than lines of code in the application using a framework that makes simple things simple. -- Omnem crede diem tibi diluxisse supremum. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, 9 Sep 2010 16:28:48 +0100 Edmund Jackson edmundsjack...@gmail.com wrote: Hi Mike, Could you perhaps present a counter-example of greater simplicity ? $ cat - /usr/local/www/apache22/cgi-bin/hello-world.sh #!/bin/sh echo 'Content-type: text/plain\n' echo Hello World ^D $ chomd 755 /usr/local/www/apache22/cgi-bin/hello-world.sh Done. Three lines of source code. 0 lines of framework setup. 1 tool (sh). Pretty much the same thing works for python, perl, etc. It's about as robust as can be asked for - that's the nature of apache. Performance is going to be mediocre at best. That's the trade-off for simplicity. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
How are you going to handle session? How are you going to handle database from a echo script? I mean, I can counter by just create a hello.html in apache and put hello world in there. It's 1 line, 0 to deploy. And it's FAST. It's even cached and uses no cpu time being served. that doesn't really mean that using web dev only using html is simple or is desirable. Having done web dev using cgi long ago, I don't think I want to go back to that. On Thu, Sep 9, 2010 at 11:47 AM, Mike Meyer mwm-keyword-googlegroups.620...@mired.org wrote: On Thu, 9 Sep 2010 16:28:48 +0100 Edmund Jackson edmundsjack...@gmail.com wrote: Hi Mike, Could you perhaps present a counter-example of greater simplicity ? $ cat - /usr/local/www/apache22/cgi-bin/hello-world.sh #!/bin/sh echo 'Content-type: text/plain\n' echo Hello World ^D $ chomd 755 /usr/local/www/apache22/cgi-bin/hello-world.sh Done. Three lines of source code. 0 lines of framework setup. 1 tool (sh). Pretty much the same thing works for python, perl, etc. It's about as robust as can be asked for - that's the nature of apache. Performance is going to be mediocre at best. That's the trade-off for simplicity. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- Omnem crede diem tibi diluxisse supremum. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, Sep 9, 2010 at 11:38 AM, Mike Meyer m...@mired.org wrote: Yup - the goal is simplicity. Robustness is important, but I expect the web server to take care of that. What I'm really expecting to lose here is performance. performance? You mean src/nano_web/core.clj. Good catch. So we go from 3, 0, 1 to 6, 4, 2. And looking over your later post on using apache + cgi. 6, 4, 2 is for a *very* high performance HelloWorld that can envolve sanely over time (5000-7000 req second on a naive benchmark on a new-ish laptop). Can't say that much about serving bash shell scripts over apache. David -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
Lines of code are a terrible metric for language complexity. If I write a function and abstract away half the code, have I made Clojure twice as simple? If you want to really evaluate Clojure, write a non-trivial application and see whether the complexity is still manageable. Code golf doesn't tell you anything. Zach On Sep 9, 8:38 am, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: On Thu, 9 Sep 2010 10:59:28 -0400 David Nolen dnolen.li...@gmail.com wrote: If you're going for simplicity over robustness and you have lein installed, all you need to do is the following: lein new nano-web Yup - the goal is simplicity. Robustness is important, but I expect the web server to take care of that. What I'm really expecting to lose here is performance. Edit your project.clj (defproject nano-web 1.0.0-SNAPSHOT :dependencies [[org.clojure/clojure 1.2.0] [org.clojure/clojure-contrib 1.2.0] [ring 0.2.5]]) So far we have 4 lines to define our dependencies. Edit src/core/nano_web.clj You mean src/nano_web/core.clj. (ns nano-web.core (use [ring.adapter.jetty :only [run-jetty]] [ring.util.response :only [response]])) (defn hello-world [req] (response Hello World!)) (defonce server (run-jetty hello-world {:port 8080 :join? false})) That's the 8 lines of actual code needed to have a full functioning web application. Let's start it: The blank lines don't count, so it's six lines of code. lein repl user= (load nano_web/core) And two tools - lein and clojure itself. So we go from 3, 0, 1 to 6, 4, 2. I'm not sure that qualifies as simple, but at least there's less boilerplate for the tools than there is actual source code. Thanks for the answer. And, since I forgot, thanks to Meikel Brandmeyer for his earlier answer as well. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail -www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, 9 Sep 2010 11:30:51 -0400 Wilson MacGyver wmacgy...@gmail.com wrote: I'm not sure what your point is. If I want to write a hello world php script on a unix system, but apache and mod_php weren't setup. I'd first have to install them and configure them. That simple things should be simple. Setting up a web server - and associated tools - to the point that you can install applications on it isn't necessarily simple, so I don't expect it to be simple. On the other hand, I only have to do that *once*, not once per application (at least, I hope I don't have to do it once per application!). This is only easy these days because most linux come with apache installed, php installed, mod_php preconfigured for you. Just one of the reasons there's nary a linux box to be found in my house. You want something simple that requires no config, this can happen during dev. Just write the hello world, and start the embedded jetty using ring. David Nolan just described that. It's not bad at all. Given a shell script to launch it, it might even be usable for the projects I have in mind. It would have been a lot more impressive if leinigen hadn't made at least two incorrect assumptions about what I wanted to do in other operations that I'd have to fix. If you really just want to serve hello world, you don't need to resort to deploy a war file. you can just take that hello world script, start the embeded jetty and mod_proxy to it. That's hardly the production way, but then I don't know that writing a web app that prints 1 line is really very production either. But again, running a proxy just to wire up a simple web app takes you out of the realm of simple. There are production web services that print a single line. Well, ok, these days they print a line or two of controls and 20 lines of advertising as well, but still wind up printing one value of interest: current temperature at some location, current stock price for some stock, current exchange rate for some currency, etc. I chose hello world because the question is more about how much overhead using even simple java infrastructure adds than about the application. Now it's true that there are some overhead to make sure your webapp produce a war file and can be deployed to ANY containers. It's not 3/1/0 as you claimed. A) I didn't claim I could do this with war files - those are a java thing, and it's the java infrastructure that annoys me; I claimed (and just posted the example) that I could do it with Unix tools. B) It's 3/0/1, not 3/1/0. But it's a pretty small part of the web app dev cycle in my experience. I mean, it's not like I spend 90% of my time writing config files and 10% of my time writing clojure/groovy/java/(insert whatever jvm language) code, web dev or otherwise. Of course not - you don't spend all your time doing simple projects. Nobody does. But simple projects taking 10 times as long as they should because of that still sucks. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, Sep 9, 2010 at 8:38 AM, Mike Meyer mwm-keyword-googlegroups.620...@mired.org wrote: And two tools - lein and clojure itself. I'm not sure Clojure should be counted separately since you're not installing it yourself. So we go from 3, 0, 1 to 6, 4, 2. I'm not sure that qualifies as simple, but at least there's less boilerplate for the tools than there is actual source code. Really I think your complaint boils down to not being able to modify the classpath at runtime. If the JVM had a real load-path like other lisps offer then this would be enough: (use 'ring.adapter.jetty 'ring.util.response) (run-jetty (constantly (response hello world)) {:port 8080 :join? false}) ...and we're back to three lines. Now I'm not defending the fact that the classpath is fixed at JVM-launch time--it's an awful hack that is an embarrassment to the awesome engineering prowess that has gone in to other parts of the JVM. But we do have tools to work around that flaw, and it's good to recognize the root of the problem rather than its symptoms. -Phil -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
You assume the presence of a configured web server but not a text editor ? The only constructive thing I can say is that the set of things that may be considered simple in the clojure setup above is vastly greater than the alternative you present. If the cost is a 4 line 'boilerplate' (and I'm pointedly not going to compare that to /etc/apache/conf.d) I think its a low price. On Thu, Sep 9, 2010 at 4:47 PM, Mike Meyer m...@mired.org wrote: On Thu, 9 Sep 2010 16:28:48 +0100 Edmund Jackson edmundsjack...@gmail.com wrote: Hi Mike, Could you perhaps present a counter-example of greater simplicity ? $ cat - /usr/local/www/apache22/cgi-bin/hello-world.sh #!/bin/sh echo 'Content-type: text/plain\n' echo Hello World ^D $ chomd 755 /usr/local/www/apache22/cgi-bin/hello-world.sh Done. Three lines of source code. 0 lines of framework setup. 1 tool (sh). Pretty much the same thing works for python, perl, etc. It's about as robust as can be asked for - that's the nature of apache. Performance is going to be mediocre at best. That's the trade-off for simplicity. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, 9 Sep 2010 11:57:23 -0400 David Nolen dnolen.li...@gmail.com wrote: On Thu, Sep 9, 2010 at 11:38 AM, Mike Meyer m...@mired.org wrote: Yup - the goal is simplicity. Robustness is important, but I expect the web server to take care of that. What I'm really expecting to lose here is performance. performance? Yup: And looking over your later post on using apache + cgi. 6, 4, 2 is for a *very* high performance HelloWorld that can envolve sanely over time (5000-7000 req second on a naive benchmark on a new-ish laptop). Can't say that much about serving bash shell scripts over apache. Right. Delivering real performance isn't simple :-). The thing is, the same thing works for python, or perl, or any number of other things. Those you can switch to mod_language or an external CGI daemon running embedded language or similar things to get performance. On the other hand, tossing a CGI shell script onto a heyu installation to read an outside thermometer is a perfectly reasonable thing to do. I don't expect even 10 requests a second for the temperature on my porch. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, Sep 9, 2010 at 12:05 PM, Mike Meyer m...@mired.org wrote: On Thu, 9 Sep 2010 11:30:51 -0400 Now it's true that there are some overhead to make sure your webapp produce a war file and can be deployed to ANY containers. It's not 3/1/0 as you claimed. A) I didn't claim I could do this with war files - those are a java thing, and it's the java infrastructure that annoys me; I claimed (and just posted the example) that I could do it with Unix tools. B) It's 3/0/1, not 3/1/0. sorry, I should've been more clear, I meant to say that creating war files isn't not 3/0/1 lines compared to your unix tools.. I poorly worded that. -- Omnem crede diem tibi diluxisse supremum. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, 9 Sep 2010 09:03:38 -0700 (PDT) Zach Tellman ztell...@gmail.com wrote: Lines of code are a terrible metric for language complexity. If I write a function and abstract away half the code, have I made Clojure twice as simple? Ah, I'm sorry - I'm not looking at *language* complexity. I'm looking at the complexity of the java/clojure *environment*. It seems to take a lot non-clojure boilerplate to do *anything* in java-land than seems reasonable to me. But I don't know javaland very well, which is why I asked for other people's opinions. If you want to really evaluate Clojure, write a non-trivial application and see whether the complexity is still manageable. Code golf doesn't tell you anything. Been there, done that. More than once. Well, maybe, depending on your definition of trivial. http://blog.mired.org/ Clojure great. No questions about that. WAR files, CLASSPATHs, having to wrap *every little command* in it's own script - that's what I'm looking at. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, 9 Sep 2010 09:06:49 -0700 Phil Hagelberg p...@hagelb.org wrote: On Thu, Sep 9, 2010 at 8:38 AM, Mike Meyer mwm-keyword-googlegroups.620...@mired.org wrote: And two tools - lein and clojure itself. I'm not sure Clojure should be counted separately since you're not installing it yourself. Installation isn't the issue, use is the issue. I have to run or interact with clojure at some point. Since the same is true for any implementation language, it could be dropped as well. So we go from 3, 0, 1 to 6, 4, 2. I'm not sure that qualifies as simple, but at least there's less boilerplate for the tools than there is actual source code. Really I think your complaint boils down to not being able to modify the classpath at runtime. If the JVM had a real load-path like other lisps offer then this would be enough: (use 'ring.adapter.jetty 'ring.util.response) (run-jetty (constantly (response hello world)) {:port 8080 :join? false}) ...and we're back to three lines. Yes, that would help. But I'm not sure that means I wouldn't have to use lein at all? And it's more the more lines of config than source than the lines of source that's an issue. Now I'm not defending the fact that the classpath is fixed at JVM-launch time--it's an awful hack that is an embarrassment to the awesome engineering prowess that has gone in to other parts of the JVM. But we do have tools to work around that flaw, and it's good to recognize the root of the problem rather than its symptoms. Fair enough. But having to use those tools is what keeps simple things from being simple. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, Sep 9, 2010 at 12:22 PM, Mike Meyer mwm-keyword-googlegroups.620...@mired.org wrote: Clojure great. No questions about that. WAR files, CLASSPATHs, having to wrap *every little command* in it's own script - that's what I'm looking at. I've already shown that you don't need WAR files. If you really, really hate the CLASSPATH you should look at cake. It does require ruby, but it let's you essentially write instant-on Clojure shell scripts as well as give you access to things like the working shell directory if that's the way you want to work with Clojure. #!/usr/bin/env cake run (println Hello world!) Other people have felt your pain and have started building solutions. You can help them out by using those solutions and giving feedback :) David -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
Mike, Your point has been made, simple things are simple. When you need to print hello world you don't need to bring Clojure into the picture. You could have given a much simpler example of needing to print hello world on the command line. echo hello world is much simpler than what you would need to do in Clojure. When faced with any problem to solve, you have to look at the tools you have available and then determine what the simplest solution will be. In your case, all of the software you need is already installed, configured and running. So it's simple. If you gave me a system with Tomcat installed, configured and running then I could do the exact same thing. It has nothing to do with Java, it has to do with what you are given to work with. For David Nolan's example above, what you are getting compared to how much code you have to write is actually quite amazing. And when you start that way, the answer to the question What if I wanted to do X? is usually much simpler. And I agree with everything Zach said above. Brenton On Sep 9, 9:22 am, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: On Thu, 9 Sep 2010 09:03:38 -0700 (PDT) Zach Tellman ztell...@gmail.com wrote: Lines of code are a terrible metric for language complexity. If I write a function and abstract away half the code, have I made Clojure twice as simple? Ah, I'm sorry - I'm not looking at *language* complexity. I'm looking at the complexity of the java/clojure *environment*. It seems to take a lot non-clojure boilerplate to do *anything* in java-land than seems reasonable to me. But I don't know javaland very well, which is why I asked for other people's opinions. If you want to really evaluate Clojure, write a non-trivial application and see whether the complexity is still manageable. Code golf doesn't tell you anything. Been there, done that. More than once. Well, maybe, depending on your definition of trivial.http://blog.mired.org/ Clojure great. No questions about that. WAR files, CLASSPATHs, having to wrap *every little command* in it's own script - that's what I'm looking at. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail -www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, 9 Sep 2010 11:52:30 -0400 Wilson MacGyver wmacgy...@gmail.com wrote: How are you going to handle session? How are you going to handle database from a echo script? What, you've never generated HTML directly from an SQL script? Any good SQL system will do that for you. All of these things are *possible* using CGI and a shell script. That doesn't mean it's desirable - I don't use the shell much for anything that requires more than two loops myself. The point is that these things aren't *required* for all applications, and I shouldn't have to deal with complexity they incur if I don't need them. Simple things should be simple. It seems to me as if once you drag java into the equation, nothing is simple. I'm trying to figure out if that's correct or not. I mean, I can counter by just create a hello.html in apache and put hello world in there. It's 1 line, 0 to deploy. And it's FAST. It's even cached and uses no cpu time being served. Yup. And you can use SSI to do other simple things as well. I never used SSI - I pretty much detested what it did to web servers - but it was very popular, because it made *simple things simple*. that doesn't really mean that using web dev only using html is simple or is desirable. Actually, it simple *if you're doing simple things*. Yeah, the Java tools may rock if you're doing complicated, enterprise-style applications. Having to deal with that level of complexity to turn off my garage light before I go to bed sucks. Having done web dev using cgi long ago, I don't think I want to go back to that. I'm not asking you to. I'm asking if there's anything that's that simple that can be used for simple tasks if your application runs on the JVM. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
Mike, If you are happy with cgi and if we posit that clojure is a compiled language and leiningen is the same as make. The I submit the following bit of fluff: At a prompt: $ lein new hw $ cd hw $ lein deps Then edit project.clj to look as follows: (defproject hw 0.0.1 :description The smallest hello world that will work. :dependencies [[org.clojure/clojure 1.2.0] [org.clojure/clojure-contrib 1.2.0]] :aot [hw.core] :main hw.core) Then edit hw/core.clj as follows: (ns hw.core (:gen-class)) (defn -main [ args] (println Hello World.)) At a prompt: $ lein uberjar And create the following shell script hw.sh #! /bin/bash java -jar hw-0.0.1-standalone.jar I'm sure you can wire the shell script into your apache. And this isn't as short as a shell/python/perl script that does print or echo. I also fear this is descending into perl golf, but I fancied having a crack at this anyway on a brain fried day. cheers, Bruce -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
I think the point is missed with this example. Given your hello world example, how much effort does it take you to add URL args, make it operate like a RESTful resource, change the route that triggers it, add user sessions, address security concerns, template out responses, tweak those templates without touching the code, etc. Some in that list are easy to do via the method above, others are painstaking. What you give up in simplicity, you gain in extensibility and scalability (often, not always). This is true across almost all of the primary non-functional requirements. A good framework is one that lets you build up to a problem, using only the pieces you need and minimizing the time you spend operating with the framework. The mindset in this community naturally gravitates to that solution (function and component combination), but you can find it in other frameworks/languages (Pylons is a great example). Paul On Sep 9, 8:47 am, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: On Thu, 9 Sep 2010 16:28:48 +0100 Edmund Jackson edmundsjack...@gmail.com wrote: Hi Mike, Could you perhaps present a counter-example of greater simplicity ? $ cat - /usr/local/www/apache22/cgi-bin/hello-world.sh #!/bin/sh echo 'Content-type: text/plain\n' echo Hello World ^D $ chomd 755 /usr/local/www/apache22/cgi-bin/hello-world.sh Done. Three lines of source code. 0 lines of framework setup. 1 tool (sh). Pretty much the same thing works for python, perl, etc. It's about as robust as can be asked for - that's the nature of apache. Performance is going to be mediocre at best. That's the trade-off for simplicity. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail -www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, Sep 9, 2010 at 12:05 PM, Mike Meyer mwm-keyword-googlegroups.620...@mired.org wrote: On Thu, 9 Sep 2010 11:30:51 -0400 Wilson MacGyver wmacgy...@gmail.com wrote: I'm not sure what your point is. If I want to write a hello world php script on a unix system, but apache and mod_php weren't setup. I'd first have to install them and configure them. That simple things should be simple. Setting up a web server - and associated tools - to the point that you can install applications on it isn't necessarily simple, so I don't expect it to be simple. On the other hand, I only have to do that *once*, not once per application (at least, I hope I don't have to do it once per application!). Am I right in that what you're asking for is something akin to PHP where you upload a jar or *.clj and it Just Works(tm) ? I want that too, but this isn't a complaint simply of clojure, it's of web architectures in general. -- http://apgwoz.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, Sep 9, 2010 at 12:32 PM, David Nolen dnolen.li...@gmail.com wrote: On Thu, Sep 9, 2010 at 12:22 PM, Mike Meyer mwm-keyword-googlegroups.620...@mired.org wrote: Clojure great. No questions about that. WAR files, CLASSPATHs, having to wrap *every little command* in it's own script - that's what I'm looking at. I've already shown that you don't need WAR files. If you really, really hate the CLASSPATH you should look at cake. It does require ruby, but it let's you essentially write instant-on Clojure shell scripts as well as give you access to things like the working shell directory if that's the way you want to work with Clojure. #!/usr/bin/env cake run (println Hello world!) Other people have felt your pain and have started building solutions. You can help them out by using those solutions and giving feedback :) Woah. I knew cake did some funky build stuff, but I didn't realize you could make use of it's global project like that. The global project seems to amount to something like Python's site-packages or Ruby's gems, right? Just a repo of installed packages for the system? What's the reason that this couldn't be done directly in clojure? (probably not the best place to start this conversation of course) -- http://www.apgwoz.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, 9 Sep 2010 12:32:27 -0400 David Nolen dnolen.li...@gmail.com wrote: On Thu, Sep 9, 2010 at 12:22 PM, Mike Meyer mwm-keyword-googlegroups.620...@mired.org wrote: Clojure great. No questions about that. WAR files, CLASSPATHs, having to wrap *every little command* in it's own script - that's what I'm looking at. I've already shown that you don't need WAR files. If you really, really hate But only if I'm willing to deploy every application in it's own web server. At least as far as I can tell. And you lose the robustness of apache. the CLASSPATH you should look at cake. It does require ruby, but it let's you essentially write instant-on Clojure shell scripts as well as give you access to things like the working shell directory if that's the way you want to work with Clojure. #!/usr/bin/env cake run (println Hello world!) Um, #!/usr/bin/env clj (println Hello world!) works fine for me. Better yet, if I know I have a running nailgun, I can do: #!/usr/bin/env clojure (println Hello world!) (one of these days, I'll patch nailgun to launch itself if it can't find a server) And get much quicker responses. The question now is, how well do all these things interact with each other? mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, 9 Sep 2010 17:15:09 +0100 Edmund Jackson edmundsjack...@gmail.com wrote: You assume the presence of a configured web server but not a text editor ? Actually, I did assume a text editor - provided any text editor would do. I chose to use my favorite simple text editor (cat) here. The only constructive thing I can say is that the set of things that may be considered simple in the clojure setup above is vastly greater than the alternative you present. If the cost is a 4 line 'boilerplate' (and I'm pointedly not going to compare that to /etc/apache/conf.d) I think its a low price. The difference is that that 4 lines has to be repeated *for every project*. Yeah, /usr/local/etc/apache/conf.d is a lot more complicated. But I only need to do it once, and it works for every application. The thing is, I can write stand-alone servers with Unix tools as well. They're a bit longer than the clojure version, but they still require no external configuration, and just the language processor. I mean, make is a nifty tool for doing builds, but I don't bother with make files for single-file programs or programs that don't need to be built. I'd be much less happy with it if it if I was required to use it for such simple things - which seems to be where the java world is. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, 9 Sep 2010 16:35:15 +0100 Bruce Durling b...@otfrom.com wrote: Mike, If you are happy with cgi and if we posit that clojure is a compiled language and leiningen is the same as make. The I submit the following bit of fluff: At a prompt: $ lein new hw $ cd hw $ lein deps Then edit project.clj to look as follows: (defproject hw 0.0.1 :description The smallest hello world that will work. :dependencies [[org.clojure/clojure 1.2.0] [org.clojure/clojure-contrib 1.2.0]] :aot [hw.core] :main hw.core) Then edit hw/core.clj as follows: (ns hw.core (:gen-class)) (defn -main [ args] (println Hello World.)) At a prompt: $ lein uberjar And create the following shell script hw.sh #! /bin/bash java -jar hw-0.0.1-standalone.jar I'm sure you can wire the shell script into your apache. And this isn't as short as a shell/python/perl script that does print or echo. I also fear this is descending into perl golf, but I fancied having a crack at this anyway on a brain fried day. Yup, and I've seriously thought about something like that. Two issues: my measurements show that using a jar doesn't really improve runtime that much. The other is that, lein works sorta-kinda like make. I like make. But as I just posted, I don't use it for one-file programs or programs that don't need building. That doesn't seem to be possible with lein. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, 9 Sep 2010 09:06:33 -0700 (PDT) Paul deGrandis paul.degran...@gmail.com wrote: I think the point is missed with this example. Given your hello world example, how much effort does it take you to add URL args, make it operate like a RESTful resource, change the route that triggers it, add user sessions, address security concerns, template out responses, tweak those templates without touching the code, etc. I think you've missed the point of the example. Not everything requires arguments, restful resources, session tracking, etc. If I need those things, I have no problem using a framework that gives them to me. The thing is, if I don't need them, I don't *want* to have to deal things that provide them. Simple things should be simple. Say I'm having a problem with the cpu in a web server overheating. I want to install a simple hack so I can check the temperature on my phone's browser when I'm home (or connected in through the vpn). The shell script/CGI to do this is pretty much identical to the hello world example: #!/bin/sh echo 'Content-type: text/plain\n' sysctl dev.cpu.0.temperature If I didn't have a server installed, it'd be a little bit more complicated, but not a lot. The problem is so simple I don't need to build up to it, but the Java world still seems to insist I have that ability - and the complexity that goes with it. Which means that simple things aren't so simple. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, 9 Sep 2010 12:23:25 -0400 Andrew Gwozdziewycz apg...@gmail.com wrote: On Thu, Sep 9, 2010 at 12:05 PM, Mike Meyer mwm-keyword-googlegroups.620...@mired.org wrote: On Thu, 9 Sep 2010 11:30:51 -0400 Wilson MacGyver wmacgy...@gmail.com wrote: I'm not sure what your point is. If I want to write a hello world php script on a unix system, but apache and mod_php weren't setup. I'd first have to install them and configure them. That simple things should be simple. Setting up a web server - and associated tools - to the point that you can install applications on it isn't necessarily simple, so I don't expect it to be simple. On the other hand, I only have to do that *once*, not once per application (at least, I hope I don't have to do it once per application!). Am I right in that what you're asking for is something akin to PHP where you upload a jar or *.clj and it Just Works(tm) ? I want that too, but this isn't a complaint simply of clojure, it's of web architectures in general. Exactly. Well, I'd say java web architectures, but I'm hoping there is a simple solutions for simple applications out there. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, 9 Sep 2010 09:41:09 -0700 (PDT) Brenton bashw...@gmail.com wrote: Mike, Your point has been made, simple things are simple. When you need to print hello world you don't need to bring Clojure into the picture. You could have given a much simpler example of needing to print hello world on the command line. echo hello world is much simpler than what you would need to do in Clojure. The thing is, I'm evaluating clojure - that's what drags clojure into it. If I wasn't interested in using clojure, I'd never have asked the question. Printing hello world is just a simple, well-understood example application. There are *lots* of applications worth putting on the web that aren't much more complicated than that. I chose it to emphasis how much extra work the environment that clojure seems to be inextricably linked with adds. When faced with any problem to solve, you have to look at the tools you have available and then determine what the simplest solution will be. In your case, all of the software you need is already installed, configured and running. So it's simple. If you gave me a system with Tomcat installed, configured and running then I could do the exact same thing. It has nothing to do with Java, it has to do with what you are given to work with. I thought I *gave* you all those things to work with when I said not counting the web server and whatever else it needs to be ready to run applications. Could you show me (or point me to an web page showing) how I'd go from a simple .clj script to an application running on Tomcat that's been installed and is ready to run applications? If that's as simple as the apache/cgi example, I'll be very happy. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, Sep 9, 2010 at 10:07 AM, Mike Meyer mwm-keyword-googlegroups.620...@mired.org wrote: The difference is that that 4 lines has to be repeated *for every project*. Yeah, /usr/local/etc/apache/conf.d is a lot more complicated. But I only need to do it once, and it works for every application. until you need to change it to support a new application's needs, and run the risk of fubaring some or all of the previous applications. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
Mike, While evaluating Clojure, just remember, you don't have use it for everything. When you need something simple, as in your examples, then use cgi. When you need to do something more complex then Clojure can help. You cannot deploy a .clj script on a running Tomcat (yet). When you install Tomcat, you have a ROOT context into which you can place .html and .jsp files and they will be dynamically loaded. This gives you about the same functionality as you would get from php and apache. Even though Clojure doesn't already have what you are looking for it would not be difficult to make it work. For example, you could create a generic web app that would have an embedded REPL as well as the ability to dynamically load code from external files. You would then just need to install Tomcat (which is easy) and drop this war into it. Form then on out you would just create simple .clj scripts and drop them into a directory. You could also connect to the REPL and dynamically add and remove code from the application. This hasn't been done yet because I don't think many people would find it useful. Clojure is new so when you see something missing, build it. That is why all of this other stuff is so simple, someone built it. Brenton On Sep 9, 10:40 am, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: On Thu, 9 Sep 2010 09:41:09 -0700 (PDT) Brenton bashw...@gmail.com wrote: Mike, Your point has been made, simple things are simple. When you need to print hello world you don't need to bring Clojure into the picture. You could have given a much simpler example of needing to print hello world on the command line. echo hello world is much simpler than what you would need to do in Clojure. The thing is, I'm evaluating clojure - that's what drags clojure into it. If I wasn't interested in using clojure, I'd never have asked the question. Printing hello world is just a simple, well-understood example application. There are *lots* of applications worth putting on the web that aren't much more complicated than that. I chose it to emphasis how much extra work the environment that clojure seems to be inextricably linked with adds. When faced with any problem to solve, you have to look at the tools you have available and then determine what the simplest solution will be. In your case, all of the software you need is already installed, configured and running. So it's simple. If you gave me a system with Tomcat installed, configured and running then I could do the exact same thing. It has nothing to do with Java, it has to do with what you are given to work with. I thought I *gave* you all those things to work with when I said not counting the web server and whatever else it needs to be ready to run applications. Could you show me (or point me to an web page showing) how I'd go from a simple .clj script to an application running on Tomcat that's been installed and is ready to run applications? If that's as simple as the apache/cgi example, I'll be very happy. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail -www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, 9 Sep 2010 11:00:48 -0700 Raoul Duke rao...@gmail.com wrote: On Thu, Sep 9, 2010 at 10:07 AM, Mike Meyer mwm-keyword-googlegroups.620...@mired.org wrote: The difference is that that 4 lines has to be repeated *for every project*. Yeah, /usr/local/etc/apache/conf.d is a lot more complicated. But I only need to do it once, and it works for every application. until you need to change it to support a new application's needs, and run the risk of fubaring some or all of the previous applications. That problem exists no matter how you do the configuration. But the less per-application configuration you have to do, the less likely it is to happen. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, 9 Sep 2010 11:16:11 -0700 (PDT) Brenton bashw...@gmail.com wrote: While evaluating Clojure, just remember, you don't have use it for everything. When you need something simple, as in your examples, then use cgi. When you need to do something more complex then Clojure can help. The first problem with that is that this stuff seems show up *everywhere* in Javaland. It's not just web apps, it's pretty much anything. Second, just because a *problem* is complex and would benefit from Clojure doesn't mean that the requirements for deployment are complex and need more than a simple cgi (for example!) would require. Yes, when the choice is 150 lines of C with 0 lines of config vs. 20 lines of Clojure with with 10 lines of config, it doesn't look so bad - but 30% of the work being overhead still sucks. You cannot deploy a .clj script on a running Tomcat (yet). When you install Tomcat, you have a ROOT context into which you can place .html and .jsp files and they will be dynamically loaded. This gives you about the same functionality as you would get from php and apache. I didn't ask how do I deploy a .clj script on a running Tomcat. I asked how do I go from a .clj script to an application running on Tomcat? I can't deploy a C program on running Apache server either - I have to compile and link it first. Not a problem. My 3/0/1 solution could just as well have been: $ cat - hello.c main() { puts(Content-type: text/plain\n\nHello world!\n) ; } ^D $ cc hello.c $ cp a.out /usr/local/apache22/cgi-bin/helloworld Anything even close to that for Tomcat and clj? Clojure is new so when you see something missing, build it. That is why all of this other stuff is so simple, someone built it. Good advice. That's what I've been doing so far. On the other hand, I'd rather spend my time building the things that interest me rather than reinventing wheels for which I already have adequately round examples. If my expectations of adequately round are much higher than the communities, then I'll wind up doing to much of the latter and not enough of the former, and will probably be happier elsewhere. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, Sep 9, 2010 at 11:17 AM, Mike Meyer m...@mired.org wrote: That problem exists no matter how you do the configuration. But the less per-application configuration you have to do, the less likely it is to happen. (i might be not-quite-following, but) no, i think the problem i mentioned explicitly doesn't exist in the case of lots of separate config files, one per application, that have duplicated content. sure, it has /another/ problem to replace the one i mentioned, but it is a different thing. in other words: i think there isn't a silver bullet. everything is about context. choose your pain. etc. sincerely. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Sep 9, 1:40 pm, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: The thing is, I'm evaluating clojure - that's what drags clojure into it. What exactly are you evaluating Clojure for? Because unless it's teaching elementary school children, the LOC it takes to deploy a hello world webapp is irrelevant. Luke -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, 9 Sep 2010 14:27:48 -0400 David Nolen dnolen.li...@gmail.com wrote: On Thu, Sep 9, 2010 at 2:17 PM, Mike Meyer mwm-keyword-googlegroups.620...@mired.org wrote: run the risk of fubaring some or all of the previous applications. That problem exists no matter how you do the configuration. But the less per-application configuration you have to do, the less likely it is to happen. Also note that you have a certain bias as some us do based on prior experience. I for one do not like Apache at all and will not shed a tear if I never use it again for my own projects. I'd never use bash shell scripting for anything beyond my .profile, much less writing a web app. Which is why I started with I can do it with 0 configuration with my favorite tools installed, how close can javaland tools come to that? It wasn't until someone asked me to demonstrate that apache and sh (god save us from bash) entered into it. Of course, the choice of apache and sh is irrelevant. I could have used pretty much any Unix web server, and pretty much any programming language which plays well in that environment, with about as much effort. There might have been some trivial changes to adopt things to some of them (compiled vs. interpreted, .cgi suffix vs cgi-bin directory, etc.), but the point remains that the underlying philosophy of this ecosystem means that simple things are simple. Note, that if I don't know anything about apache or bash, then you have no valid point. There is nothing simple about installing apache from scratch. There's nothing simple about bash shell scripting. On *some* systems getting these installed is easier, on other systems it's harder. Depending on which tools/languages/databases (and, god forbid, which versions) I'd rather use, it can be much, much, much harder. Which is why I *explicitly* asked people to show me how to do this using *their favorite tools*. So enough about simplicity. What we're really talking about here is familiarity. It's takes me no time at all to get a working Clojure web app and running. I have no idea to do the things that you are describing as being simple with apache, httpd.conf, and bash. No, it's not about familiarity, it's about boilerplate. You provided an example that was much better than anything I expected to find. I'd still like to see what it takes to use that to create something I can deploy on Tomcat or GlassFish or whatever, than as a standalone server. Having to run standalone servers for every little applcation - isn't simple mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, 9 Sep 2010 11:48:36 -0700 (PDT) Saul Hazledine shaz...@gmail.com wrote: On Sep 9, 8:16 pm, Brenton bashw...@gmail.com wrote: Even though Clojure doesn't already have what you are looking for it would not be difficult to make it work. For example, you could create a generic web app that would have an embedded REPL as well as the ability to dynamically load code from external files. You would then just need to install Tomcat (which is easy) and drop this war into it. Form then on out you would just create simple .clj scripts and drop them into a directory. You could also connect to the REPL and dynamically add and remove code from the application. This hasn't been done yet because I don't think many people would find it useful. This would be really cool. Especially if, after playing around at the repl, you could call something like: (create-war example.war) and it would produce a deployable web application using the .clj files you had loaded. Gee, that sounds like the web apps I was building a decade ago, except it was standalone. It pretty much loaded all the code in the deployment directory, let you telnet into a repl to poke around in the guts of the system, including reloading modules, adding new ones, resetting things. Unfortunately, times have changed, and I'm looking for better tools. Clojure definitely a better language mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
just skimming the thread all I see is mention of war files, which, well, who cares? just get ring and the ring jetty adapter, you don't even after to presume the existence of an installed webserver or servlet container. http://github.com/hiredman/place-for-things is something I have been playing with that uses ring and jetty. On Thu, Sep 9, 2010 at 12:33 PM, Mike Meyer mwm-keyword-googlegroups.620...@mired.org wrote: On Thu, 9 Sep 2010 11:48:36 -0700 (PDT) Saul Hazledine shaz...@gmail.com wrote: On Sep 9, 8:16 pm, Brenton bashw...@gmail.com wrote: Even though Clojure doesn't already have what you are looking for it would not be difficult to make it work. For example, you could create a generic web app that would have an embedded REPL as well as the ability to dynamically load code from external files. You would then just need to install Tomcat (which is easy) and drop this war into it. Form then on out you would just create simple .clj scripts and drop them into a directory. You could also connect to the REPL and dynamically add and remove code from the application. This hasn't been done yet because I don't think many people would find it useful. This would be really cool. Especially if, after playing around at the repl, you could call something like: (create-war example.war) and it would produce a deployable web application using the .clj files you had loaded. Gee, that sounds like the web apps I was building a decade ago, except it was standalone. It pretty much loaded all the code in the deployment directory, let you telnet into a repl to poke around in the guts of the system, including reloading modules, adding new ones, resetting things. Unfortunately, times have changed, and I'm looking for better tools. Clojure definitely a better language mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- And what is good, Phaedrus, And what is not good— Need we ask anyone to tell us these things? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, 9 Sep 2010 12:04:34 -0700 (PDT) Luke Renn luke.r...@gmail.com wrote: On Sep 9, 1:40 pm, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: The thing is, I'm evaluating clojure - that's what drags clojure into it. What exactly are you evaluating Clojure for? Because unless it's teaching elementary school children, the LOC it takes to deploy a hello world webapp is irrelevant. Here I thought I could save time by choosing a nice, simple example application that everyone would understand, rather than spending a lot of time explaining (or abstracting out) irrelevant details of some real-world application before asking the question about the overhead required to deploy java web apps. Instead, I seem to be spending a lot more time explaining what example means. Ok, lets use a different example. I'm going to deploy a web app. Let's call it SuperDuper. It's going to take two arguments. The first argument is used to locate, lock and load a collection of data. If the data is already locked, it just spits out an error. If the data isn't locked, it uses the second argument to process the data IN A WAY FOR WHICH CLOJURE IS IDEAL, possibly changing it, and finally spits out it's a result. I expect the initial version to have to handle no more than a few hundred requests a day while we do usability testing, and decide if we want do any further development. Now, given that I have a clj file that implements (SuperDuper datalocation processingdirective), how much manure do I have to spread around it to get it to grow into a functioning web app deployed on your favorite web server? The key word is on - we may want to run more multiple variants, and don't want to have to deal with multiple servers. Further, if this works, we'll be working on other, similar, applications. All of which means we run one server and put applications on it, rather than putting every application on it's own server. If I wrote this in any language that plays well in the Unix environment (which lets out a lot of LISP-like languages), on most any reasonable Unix server, the answer is Create an executable and name it properly. Java-based languages seem to have trouble with the first step (which is why I'm willing to consider *your* favorite server), much less the second one. FWIW, most of the languages I use can do the run our own private server hack. They usually take a little more overhead code than Ring. On the other hand, writing a rock-stupid http server that just does sockets and query parsing doesn't take a lot more overhead than Ring. But for reasons previously stated, this case is uninteresting. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On 9 September 2010 19:16, Brenton bashw...@gmail.com wrote: Mike, While evaluating Clojure, just remember, you don't have use it for everything. When you need something simple, as in your examples, then use cgi. When you need to do something more complex then Clojure can help. You cannot deploy a .clj script on a running Tomcat (yet). When you install Tomcat, you have a ROOT context into which you can place .html and .jsp files and they will be dynamically loaded. This gives you about the same functionality as you would get from php and apache. Even though Clojure doesn't already have what you are looking for it would not be difficult to make it work. For example, you could create a generic web app that would have an embedded REPL as well as the ability to dynamically load code from external files. You would then just need to install Tomcat (which is easy) and drop this war into it. Form then on out you would just create simple .clj scripts and drop them into a directory. You could also connect to the REPL and dynamically add and remove code from the application. Or use something like jnotify to notify your application that the directory has been changed and have it automagically load/reload the code. I did this once a few months back - if I changed my .clj file or added a new one, the app detected it and loaded it. This hasn't been done yet because I don't think many people would find it useful. Clojure is new so when you see something missing, build it. That is why all of this other stuff is so simple, someone built it. Brenton On Sep 9, 10:40 am, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: On Thu, 9 Sep 2010 09:41:09 -0700 (PDT) Brenton bashw...@gmail.com wrote: Mike, Your point has been made, simple things are simple. When you need to print hello world you don't need to bring Clojure into the picture. You could have given a much simpler example of needing to print hello world on the command line. echo hello world is much simpler than what you would need to do in Clojure. The thing is, I'm evaluating clojure - that's what drags clojure into it. If I wasn't interested in using clojure, I'd never have asked the question. Printing hello world is just a simple, well-understood example application. There are *lots* of applications worth putting on the web that aren't much more complicated than that. I chose it to emphasis how much extra work the environment that clojure seems to be inextricably linked with adds. When faced with any problem to solve, you have to look at the tools you have available and then determine what the simplest solution will be. In your case, all of the software you need is already installed, configured and running. So it's simple. If you gave me a system with Tomcat installed, configured and running then I could do the exact same thing. It has nothing to do with Java, it has to do with what you are given to work with. I thought I *gave* you all those things to work with when I said not counting the web server and whatever else it needs to be ready to run applications. Could you show me (or point me to an web page showing) how I'd go from a simple .clj script to an application running on Tomcat that's been installed and is ready to run applications? If that's as simple as the apache/cgi example, I'll be very happy. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail -www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- Daniel Kersten. Leveraging dynamic paradigms since the synergies of 1985. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Sep 9, 4:13 pm, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: Here I thought I could save time by choosing a nice, simple example application that everyone would understand, rather than spending a lot of time explaining (or abstracting out) irrelevant details of some real-world application before asking the question about the overhead required to deploy java web apps. The subject of the thread is Simple Things Should Be Simple. Others in this thread have done a good job attempting to explain that they are in fact simple so I won't continue. Perhaps you should play around with ring and/or Compojure a bit and learn yourself. This is something you would have to do for any serious evaluation anyway. I will answer your specific question about deploying applications. While creating a war file may involve some of what you conceive to be boilerplate, it does so to simplify deployment of multiple applications to a single server; which is exactly what you're now asking about. Download jetty, copy a war into the webapps directory and start the server. Done. Don't like Jetty for some reason? Download tomcat, copy the war to the webapps directory, start server. Done. Want another app in that server, just copy the war into webapps. It's the same with the scripts really. You think project.clj, lein, a main class and running java -jar myapp.jar is silly when you can just gcc myapp.c and run it with myapp. Sure, but that only works on a single platform. The java -jar will work anywhere. Like I said, you might think some things are boilerplate or unnecessary, but they're done that way to provide benefits that are beyond simplicity. Best of luck to you. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Sep 9, 2:46 pm, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: I have to compile and link it first. Not a problem. My 3/0/1 solution could just as well have been: $ cat - hello.c main() { puts(Content-type: text/plain\n\nHello world!\n) ; } ^D $ cc hello.c $ cp a.out /usr/local/apache22/cgi-bin/helloworld Anything even close to that for Tomcat and clj? Again, I'll just say, why is this relevant to a serious evaluation? How simple is it for you to add a dependency to 10 3rd party libraries and link against them? What if you want it to run on linux, windows, and OSX? What you call boilerplate isn't boilerplate. It's there to make things that actually matter simple. Luke -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Sep 9, 2010, at 3:04 PM, Luke Renn wrote: What exactly are you evaluating Clojure for? Because unless it's teaching elementary school children, the LOC it takes to deploy a hello world webapp is irrelevant. Luke From the sidelines -- because I know little about web apps per se in any environment -- Mike's original question resonated with me and I want to second his call for making simple things simple. Clojure makes many important things simple, particularly within the Clojure code itself, but for someone new to the java world some of trappings are really not simple (yet!) and I think it's probably hard for those of you with more experience and all of the tools installed and boilerplate memorized to have perspective on this. I'm not teaching elementary school but I am teaching college students with experience in a variety of languages (some know some java but some don't) and myself (some experience in a lot of languages, but the deepest experience in Lisp), and both they and I aim to do significant work in Clojure (and I think I already am, even though I'm still pretty clueless about most of the java-world stuff that gets discussed here). More than once I've seen people write that something is simple here and then found that the explanation required more steps than I would have guessed and tools that I never heard of. It's quite possible that these methods/tools are excellent and the best way to do the things eventually, but providing really simple ways to do the really simple things can really help in a lot of contexts, especially (but not only) for newcomers who may eventually enrich the community in many ways. To take one non-webapp example regarding basic tooling, it seems like Leiningen is one thing that can make many things relatively simple but since I've settled on Eclipse/CCW as my development/teaching environment to keep other things simple, and since I don't yet have any idea how to use Leiningen from within Eclipse/CCW, a lot of things aren't yet simple for me. I've posted about this on the CCW list and I expect that will lead to good things -- I've found the CCW folks to be extremely helpful so far -- but right now a lot of things aren't simple in my environment. One of my favorite examples of making the simple stuff simple is Processing (processing.org), which can be downloaded and installed with a single click, and allows you to make an applet with the graphical equivalent of HelloWorld with one line of code, entered in an intuitive IDE with a few very nice features like quick access to documentation, and a single click on an Export button. Then move the resulting folder to your server and your applet is live on the web. Add a little more code and you can quickly scale up to rich, interactive, and beautiful applets. If you want more you can add arbitrary java code and do many more things, although there are some limits imposed by the applet target and I guess this isn't a fully general programming platform. But I think it's a superb example of making the simple stuff simple while also allowing those who want to do more complicated things to do so. And it contrasts starkly with my experience with Clojure which, as much as I love the language itself (and I really really do), has had me fighting with classpaths, directory structures, emacs configs, tools that don't talk to each other, etc. to do a variety of things that seemed like they should have been simple. I know that Clojure and its associated tools are works in progress and I'm not complaining that things aren't instantly perfect. But I want to stress that it really is a very good thing to make the simple stuff really simple, and to remind people with more expertise that they themselves are not in a very good position to judge what's simple (because they are polluted by their expertise). -Lee -- Lee Spector, Professor of Computer Science School of Cognitive Science, Hampshire College 893 West Street, Amherst, MA 01002-3359 lspec...@hampshire.edu, http://hampshire.edu/lspector/ Phone: 413-559-5352, Fax: 413-559-5438 Check out Genetic Programming and Evolvable Machines: http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, Sep 9, 2010 at 5:53 PM, Lee Spector lspec...@hampshire.edu wrote: One of my favorite examples of making the simple stuff simple is Processing (processing.org), which can be downloaded and installed with a single click, and allows you to make an applet with the graphical equivalent of HelloWorld with one line of code, entered in an intuitive IDE with a few very nice features like quick access to documentation, and a single click on an Export button. I started using Processing since version 22 (around 2003/4). Let's just say... that it takes a lot of time and external contribution to reach the level of documentation, stability and cross platform reliability that Processing now has. David -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, 9 Sep 2010 14:11:44 -0700 (PDT) Luke Renn luke.r...@gmail.com wrote: On Sep 9, 2:46 pm, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: I have to compile and link it first. Not a problem. My 3/0/1 solution could just as well have been: $ cat - hello.c main() { puts(Content-type: text/plain\n\nHello world!\n) ; } ^D $ cc hello.c $ cp a.out /usr/local/apache22/cgi-bin/helloworld Anything even close to that for Tomcat and clj? Again, I'll just say, why is this relevant to a serious evaluation? How simple is it for you to add a dependency to 10 3rd party libraries and link against them? What if you want it to run on linux, windows, and OSX? Well, the original version *would* work on all three of those systems. And I can do that in something more suitable to large-scale programming as well - like I said, pretty much any language that plays well on Unix, whether it's interpreted, compiled or both. And if I needed to link in extra dependencies, I'd use a make file, or CPAN, or whatever was appropriate. The thing is, the software tool/unix philosophy of simple things should be simple means that I don't *have* to have a make file (or whatever) for simple things. The Java philosophy is apparently we'll make sure there are no simple things. What you call boilerplate isn't boilerplate. It's there to make things that actually matter simple. Doesn't matter - it keeps simple things from being simple, which is what I'm asking about. Of course, you're only half right - a lot of it *is* boilerplate, in two different senses of the word. Look at just *one* example of the *four* files I have to create to create a war file: web.xml. Six lines right off the top that are going to be the same in *every* application. That's boilerplate, as surely as main() { in my example is. It's just that there's twice as much text there as there is in the *entire system* above. I have to repeat the app name in three places in the file: more boilerplate, of a more insidious nature. Yeah, if you want to get fancy, those may wind up being different. I don't want to get fancy, I want something simple, so why not provide a default that works for the simple cases? The way it is now is like C++ requiring that I type variable types twice to create a variable. I'm sure people who are used to that kind of crap consider it simple too. Pretty much everything else in the deployment process is equally bad: I have to tell the system things that should be the obvious defaults, many of those defaults being things I've already told the system. Sure, there may eventually be a leningen module to deal with all this. And yeah, compared to what it shelters you from, leningen is a great tool, and makes life a lot easier. But the fact that you *need* something like leningen is as much an indication of the failure of the underlying system as the fact that someone wrote cdecl is an indication of the failure of C's type declaration syntax. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
no this discussion is going to be ... won't say it. Quiz: - is your solution functional (regarding the requirements= - is your solution scallable? (groing large or running plattformindependent?) - is your solution easily maintainable (in the sense of mutating it some days to get complex and have 10 LOC) - is it very easily testable Sure you stated out for simple things. now have java installed, or .net (i'm actually a .net guy). I could complain about this solution not running on windows .. I do not. You have the choice, you make the move. Why should clojure fit into your micro world of doing administrativ scripting? Being a dev for 13 years I really don't like system that don't fullfill my questions. I was a maintainer of a system containing of 8.000.000 LOCs (were I was responsible for round about 300.000) I can tell you tons of horrible stories. Now how is this realted to your question? The right tools for the right job. I won't use any more tools, that don't fullfill my 4 questions. Why, you could ask? because of the experience going the hard way over and over again. Because some businesspeople told me to not use technologie x. Because they don't trust my expertise. In your unix consulting world this maybe the right choice. So the simplest possible hast nothing todo with the right choice, from my point of view. Its not only a matter of having the power at your fingertipps (in only using 2 lines of code). There are even dynamic vs. static language wars. There's no winner, there's no looser. It depends. Be open minded and use the right tool for the right job an don't complain about technologie x or y. Have you ever used .NET or Mono? Yes, No, Why? Im not biased to *nix (actually i'm running a win7 dev machin, because my job requires it) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, 9 Sep 2010 14:01:19 -0700 (PDT) Luke Renn luke.r...@gmail.com wrote: On Sep 9, 4:13 pm, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: Here I thought I could save time by choosing a nice, simple example application that everyone would understand, rather than spending a lot of time explaining (or abstracting out) irrelevant details of some real-world application before asking the question about the overhead required to deploy java web apps. The subject of the thread is Simple Things Should Be Simple. Others in this thread have done a good job attempting to explain that they are in fact simple so I won't continue. Perhaps you should play around with ring and/or Compojure a bit and learn yourself. This is something you would have to do for any serious evaluation anyway. No, they've explained what *they* consider to be simple. That isn't the same thing as actually *being* simple. I will answer your specific question about deploying applications. Well, part of it, anyway While creating a war file may involve some of what you conceive to be boilerplate, it does so to simplify deployment of multiple applications to a single server; which is exactly what you're now asking about. How does typing the name of the namespace my code lives in three times into the web.xml simplify deployment of multiple applications? Clojure got this right - if I need to generate a class, the default name is the name of the namespace, which is right 20% of the time. Download jetty, copy a war into the webapps directory and start the server. Done. Don't like Jetty for some reason? Download tomcat, copy the war to the webapps directory, start server. Done. Want another app in that server, just copy the war into webapps. I'll take you at your word for it, though it isn't working yet (not sure I managed to correctly change the default port from the one that half the unprived apps in the world use, including calibre, but that's not a java issue). But there's still far more work in generating a war file than in doing the equivalent when it's well-designed. It's the same with the scripts really. You think project.clj, lein, a main class and running java -jar myapp.jar is silly when you can just gcc myapp.c and run it with myapp. Sure, but that only works on a single platform. The java -jar will work anywhere. You *really* want me to start the parade of variations of that three-line theme that would work on pretty much any platform that a jar file works on? Any interpreted language will do, though primitive platforms might require a wrapper to invoke the interpreter for them. Like I said, you might think some things are boilerplate or unnecessary, but they're done that way to provide benefits that are beyond simplicity. Of course they are. Trouble is, they've ignored simplicity completely in the process. This reminds me of the config system for an ETL I dealt with once: it consisted of about 300 files of a dozen or so lines each (one file for each of the dozen or so processes that ran on each of the 25 or so machines involved). The original developers thought that was simple, but changing the config almost invariably caused something to break. In the second version, I applied a little thought to the configuration process, made the master program smart enough to choose intelligent defaults and count things itself, and reduced the same configuration to a single file - shared across all the machines - of about 30 lines. The new config system could do everything the old one did, but by making the common choices and previously entered values the defaults, it made simple configuration simple. Which meant that changing the config rarely broke things. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Sep 9, 5:53 pm, Lee Spector lspec...@hampshire.edu wrote: On Sep 9, 2010, at 3:04 PM, Luke Renn wrote: What exactly are you evaluating Clojure for? Because unless it's teaching elementary school children, the LOC it takes to deploy a hello world webapp is irrelevant. Luke From the sidelines -- because I know little about web apps per se in any environment -- Mike's original question resonated with me and I want to second his call for making simple things simple. Clojure makes many important things simple, particularly within the Clojure code itself, but for someone new to the java That was kind of my point. I would expect these kinds of questions, examples, and objections from someone looking at Clojure/Ring to teach with, not necessarily someone who want to deploy highly scalable web applications. I'm sure many here would disagree with me, but I would not recommend Clojure for a college level Lisp course just yet. I would probably recommend Racket or Dr. Scheme. Luke -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, Sep 9, 2010 at 4:02 PM, Mike Meyer mwm-keyword-googlegroups.620...@mired.org wrote: No, they've explained what *they* consider to be simple. That isn't the same thing as actually *being* simple. +1 :-) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, 9 Sep 2010 14:20:29 -0700 (PDT) Rainer Schuster schuster-rai...@web.de wrote: no this discussion is going to be ... won't say it. Quiz: - is your solution functional (regarding the requirements= Yes. - is your solution scallable? (groing large or running plattformindependent?) It will run on any of a large number of platforms, work with any of a large number of languages and web servers, and will work with far more clients than I ever expect to be able to connect to it. - is your solution easily maintainable (in the sense of mutating it some days to get complex and have 10 LOC) The chosen deployment methodology doesn't care how many LOC there are in the program being deployed. - is it very easily testable Yup. Why should clojure fit into your micro world of doing administrativ scripting? Being a dev for 13 years I really don't like system that don't fullfill my questions. I was a maintainer of a system containing of 8.000.000 LOCs (were I was responsible for round about 300.000) I can tell you tons of horrible stories. Because it's a programming language, and the questions I'm asking are *orthogonal* to questions about the programming language. I build medium-size distributed systems that do things like process hundreds of gigabytes of data a day, or build 10s of thousands of distinct Linux distributions over that same 24 hours. They use the same languages and technologies I'm talking about here. But - because they play well in an environment where simple things should be simple is an axiom, they also let me do zero-config deployment of simple applications. There's no fundamental reason clojure can't be used that way. Nuts, I've done it. I'm discovering that the Java community doesn't seem to care about this - or rather, is so used to the current situation that they find it acceptable. Now how is this realted to your question? The right tools for the right job. Yup. But a deployment tool and a programming language are different things. That the deployment tools available for clojure are so far out of line with the language itself is sad. So the simplest possible hast nothing todo with the right choice, from my point of view. Its not only a matter of having the power at your fingertipps (in only using 2 lines of code). Once again, that the application only takes two lines of code is immaterial. It could take two million. It's what it takes to get it deployed that's the problem. There are even dynamic vs. static language wars. There's no winner, there's no looser. It depends. Be open minded and use the right tool for the right job an don't complain about technologie x or y. Can I complain when the right tool doesn't exist? That's where I am now. There's a great language. There are some tools that are - at least at first glance - right tools for deploying enterprise applications built in that language. There don't seem to be any tools that are right for deploying simple applications. Of course, I'll continue complaining about technologies when they suck. If people don't complain about them, there's no chance of them ever getting fixed. Isn't that the point of MS's Windows 7 is my fault ads? Have you ever used .NET or Mono? Yes, No, Why? Im not biased to *nix (actually i'm running a win7 dev machin, because my job requires it) I've never looked at .NET or mono beyond looking over the C# language and deciding it didn't offer enough of an improvement over Java or C++ - neither of which I consider a suitable tool for real-world work - for it to be worthwhile. I've largely ignored Java outside of Clojure, and expect to continue doing so. I still like OO programming, and don't want to ruin that. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Thu, 9 Sep 2010 16:06:54 -0700 (PDT) Luke Renn luke.r...@gmail.com wrote: That was kind of my point. I would expect these kinds of questions, examples, and objections from someone looking at Clojure/Ring to teach with, not necessarily someone who want to deploy highly scalable web applications. I'm curious - what makes you think highly scalable web applications and simple things have anything to do with each other? mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Sep 9, 2010, at 6:36 PM, David Nolen wrote: I started using Processing since version 22 (around 2003/4). Let's just say... that it takes a lot of time and external contribution to reach the level of documentation, stability and cross platform reliability that Processing now has. Understood. It will take time for Clojure too. I'm just pointing out that this level of simplicity for the simple stuff is a worthy goal to aim for. Some others in this thread seem to think it's unimportant because real world applications aren't simple, or because we should assume that developers can handle the complexity, etc. Or maybe they don't see the complexity. In any event my aim was just to argue that it really is important and that there are some good models out there to aim for, eventually. -Lee -- Lee Spector, Professor of Computer Science School of Cognitive Science, Hampshire College 893 West Street, Amherst, MA 01002-3359 lspec...@hampshire.edu, http://hampshire.edu/lspector/ Phone: 413-559-5352, Fax: 413-559-5438 Check out Genetic Programming and Evolvable Machines: http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
i don't know if this has been said as such, but: a) there's an inflection / transition point from simple things to complex things. b) some systems are in the simple world, but when you get complex they restrict you or fall apart (rails?). vs. other systems are fine in the large, but suck for the simple (java web ecosystem?). c) does anybody know how to make the dial work smoothly all along the gamut of simple to complex? or do you require reworking of your simple thing over time to make it work in the complex? sincerely. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
On Sep 9, 2010, at 7:06 PM, Luke Renn wrote: I'm sure many here would disagree with me, but I would not recommend Clojure for a college level Lisp course just yet. I would probably recommend Racket or Dr. Scheme. I've taught with Dr. Scheme but I like Clojure a lot better than Scheme! My course is being taught in an unusual context (e.g. no grades and it's project-based), so I don't think it's crazy to do it in Clojure. Still, the simpler things could be simpler, not only for the students but also for me, and I want to reinforce the view that this is a good thing to aim for. -Lee -- Lee Spector, Professor of Computer Science School of Cognitive Science, Hampshire College 893 West Street, Amherst, MA 01002-3359 lspec...@hampshire.edu, http://hampshire.edu/lspector/ Phone: 413-559-5352, Fax: 413-559-5438 Check out Genetic Programming and Evolvable Machines: http://www.springer.com/10710 - http://gpemjournal.blogspot.com/ -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
You cannot deploy a .clj script on a running Tomcat (yet). In the unstable 0.8 version of Conjure, you can create a war file by simply adding leiningen-war to your dev-dependencies and running lein uberwar. You can then simply drop the war file into a Tomcat server. The web.xml file is already created for you with a default configuration which will work with your Conjure app out of the box. Of course, if the web.xml file doesn't do what you need, you can still edit it. The only reason I've not released 0.8 yet, is that I'm trying to make deployment on Google App Engine nearly as easy. Unfortunately, Google App Engine doesn't like all of the reflection stuff in Conjure. Obviously, Conjure is much slower and a lot more overhead than most of the other solutions mentioned in this thread. -Matt Courtney On Sep 9, 2:16 pm, Brenton bashw...@gmail.com wrote: Mike, While evaluating Clojure, just remember, you don't have use it for everything. When you need something simple, as in your examples, then use cgi. When you need to do something more complex then Clojure can help. You cannot deploy a .clj script on a running Tomcat (yet). When you install Tomcat, you have a ROOT context into which you can place .html and .jsp files and they will be dynamically loaded. This gives you about the same functionality as you would get from php and apache. Even though Clojure doesn't already have what you are looking for it would not be difficult to make it work. For example, you could create a generic web app that would have an embedded REPL as well as the ability to dynamically load code from external files. You would then just need to install Tomcat (which is easy) and drop this war into it. Form then on out you would just create simple .clj scripts and drop them into a directory. You could also connect to the REPL and dynamically add and remove code from the application. This hasn't been done yet because I don't think many people would find it useful. Clojure is new so when you see something missing, build it. That is why all of this other stuff is so simple, someone built it. Brenton On Sep 9, 10:40 am, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: On Thu, 9 Sep 2010 09:41:09 -0700 (PDT) Brenton bashw...@gmail.com wrote: Mike, Your point has been made, simple things are simple. When you need to print hello world you don't need to bring Clojure into the picture. You could have given a much simpler example of needing to print hello world on the command line. echo hello world is much simpler than what you would need to do in Clojure. The thing is, I'm evaluating clojure - that's what drags clojure into it. If I wasn't interested in using clojure, I'd never have asked the question. Printing hello world is just a simple, well-understood example application. There are *lots* of applications worth putting on the web that aren't much more complicated than that. I chose it to emphasis how much extra work the environment that clojure seems to be inextricably linked with adds. When faced with any problem to solve, you have to look at the tools you have available and then determine what the simplest solution will be. In your case, all of the software you need is already installed, configured and running. So it's simple. If you gave me a system with Tomcat installed, configured and running then I could do the exact same thing. It has nothing to do with Java, it has to do with what you are given to work with. I thought I *gave* you all those things to work with when I said not counting the web server and whatever else it needs to be ready to run applications. Could you show me (or point me to an web page showing) how I'd go from a simple .clj script to an application running on Tomcat that's been installed and is ready to run applications? If that's as simple as the apache/cgi example, I'll be very happy. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail -www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Simple things should be simple
(use '[clojure.contrib.server-socket :only (create-server)] '[clojure.contrib.duck-streams :only (read-lines)]) (create-server 8080 (fn [in out] (when-not (empty? (read-lines in)) (spit out Hello, World!\n 4/0/0 John On Thu, Sep 9, 2010 at 9:21 PM, Matt macourt...@gmail.com wrote: You cannot deploy a .clj script on a running Tomcat (yet). In the unstable 0.8 version of Conjure, you can create a war file by simply adding leiningen-war to your dev-dependencies and running lein uberwar. You can then simply drop the war file into a Tomcat server. The web.xml file is already created for you with a default configuration which will work with your Conjure app out of the box. Of course, if the web.xml file doesn't do what you need, you can still edit it. The only reason I've not released 0.8 yet, is that I'm trying to make deployment on Google App Engine nearly as easy. Unfortunately, Google App Engine doesn't like all of the reflection stuff in Conjure. Obviously, Conjure is much slower and a lot more overhead than most of the other solutions mentioned in this thread. -Matt Courtney On Sep 9, 2:16 pm, Brenton bashw...@gmail.com wrote: Mike, While evaluating Clojure, just remember, you don't have use it for everything. When you need something simple, as in your examples, then use cgi. When you need to do something more complex then Clojure can help. You cannot deploy a .clj script on a running Tomcat (yet). When you install Tomcat, you have a ROOT context into which you can place .html and .jsp files and they will be dynamically loaded. This gives you about the same functionality as you would get from php and apache. Even though Clojure doesn't already have what you are looking for it would not be difficult to make it work. For example, you could create a generic web app that would have an embedded REPL as well as the ability to dynamically load code from external files. You would then just need to install Tomcat (which is easy) and drop this war into it. Form then on out you would just create simple .clj scripts and drop them into a directory. You could also connect to the REPL and dynamically add and remove code from the application. This hasn't been done yet because I don't think many people would find it useful. Clojure is new so when you see something missing, build it. That is why all of this other stuff is so simple, someone built it. Brenton On Sep 9, 10:40 am, Mike Meyer mwm-keyword-googlegroups. 620...@mired.org wrote: On Thu, 9 Sep 2010 09:41:09 -0700 (PDT) Brenton bashw...@gmail.com wrote: Mike, Your point has been made, simple things are simple. When you need to print hello world you don't need to bring Clojure into the picture. You could have given a much simpler example of needing to print hello world on the command line. echo hello world is much simpler than what you would need to do in Clojure. The thing is, I'm evaluating clojure - that's what drags clojure into it. If I wasn't interested in using clojure, I'd never have asked the question. Printing hello world is just a simple, well-understood example application. There are *lots* of applications worth putting on the web that aren't much more complicated than that. I chose it to emphasis how much extra work the environment that clojure seems to be inextricably linked with adds. When faced with any problem to solve, you have to look at the tools you have available and then determine what the simplest solution will be. In your case, all of the software you need is already installed, configured and running. So it's simple. If you gave me a system with Tomcat installed, configured and running then I could do the exact same thing. It has nothing to do with Java, it has to do with what you are given to work with. I thought I *gave* you all those things to work with when I said not counting the web server and whatever else it needs to be ready to run applications. Could you show me (or point me to an web page showing) how I'd go from a simple .clj script to an application running on Tomcat that's been installed and is ready to run applications? If that's as simple as the apache/cgi example, I'll be very happy. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail -www.asciiribbon.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@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+unsubscr...@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