1,191 karma · joined Oct 14, 2012 (14y ago) · 425 submissions
comment 14y ago · link · parent
The best advice I can give you is to do it step by step and don't let yourself get overwhelmed. It's just work. Just do the work. Here are some steps to take:
1. Start cleaning up and commenting the code. Start using a linter. Don't attempt to refactor aggressively here. Don't refactor at all. Just surface details for now.
2. Start adding unit and functional tests. If you have an API, test against it. As much coverage as possible.
3. Start refactoring, breaking things, then fixing the tests.
4. Repeat #3 until it's a clean codebase. This is the point at which you'd start looking at performance and coupling too.
A little bit at a time and don't get overwhelmed.
I'll send the consultancy invoice tomorrow.
comment 14y ago · link · parent
>even though Node.js is the fastest app server there is.
Nope, not in any metric. Maybe the author is a Rails programmer?
That squid sucks is no surprise.
This is a pretty unsurprising static files based test, but it's flawed enough to make it mostly a waste of time.
The lack of GWAN and Cherokee in this comparison is a huge oversight.
comment 14y ago · link · parent
It shouldn't have to be a library with custom handling of the edge cases like that :|
comment 14y ago · link · parent
comment 14y ago · link · parent
I don't want my HTML templates in my Common Lisp code!
Most of my projects have a separate frontend guy who needs to be able to write the templates himself without touching or knowing the backend code. Django, Rails, Flask, Sinatra et al understand and respect this.
For some reason, most Clojure and Common Lisp libraries fail to grok this. I don't know why.
I want plain HTML files with some simple (mustache or Django/Jinja-style) tokens for injecting data provided by a hash-map/dictionary/assoc-list.
That's. It.
comment 14y ago · link · parent
The community surrounding that isn't exactly vibrant.
An example from an attempt to find a viable/nice Common Lisp templating library for making web apps (a problem for me before, I hate CL-WHO. Vile.)
http://www.cl-user.net/asp/U5Hd/sdataQGW2OvQLz758DQdX8yMX8yB...
Hrm. Yes. Hrm. Seems promising, exceeeept...
https://groups.google.com/group/cl-terrace/web/djula
The Google Group for it has...disappeared?
http://common-lisp.net/project/bpm/darcs/djula/
Yay, code!
That hasn't been touched since 2008!
CL-WHO, which I think is the most popular way to solve this problem hasn't been touched in 2 to 7 months, depending on how you measure it.
See here:
https://github.com/edicl/cl-who
The Ningle web framework for Clack, found here: https://github.com/fukamachi/ningle
Not been touched in 4-8 months.
Caveman (clack framework): https://github.com/fukamachi/caveman/ 4-8 months.
HTML-TEMPLATE hasn't been touched since Tue, 02 Dec 2008.
The most popular web server for CL, Hunchentoot hasn't been touched (based on the darcs repo anyway) since Tue, 24 Aug 2010.
Take a look for yourself: http://common-lisp.net/~loliveira/ediware/
The Common Lisp community is moribund at best.
I would PREFER to use Common Lisp over, say, Clojure or Python however the fact is that there just aren't enough people using it or maintaining web development software for it to overcome the time expenditure trade-offs.
So, can we drop the triumphant tone as it concerns CL? Even Paul Graham tells most people to just use Clojure.
comment 14y ago · link · parent
Jesus dude. I couldn't reproduce that with my single or multi-node ElasticSearch clusters if I wanted to.
How were the EBS backing stores setup for these EC2 nodes?
Edit: Also, when I was talking about "them" falling apart, I meant Postgres or Sphinx, not Solr/ElasticSearch.
Well-configured Solr and ElasticSearch clusters can work very well for most people.
comment 14y ago · link · parent
Another thought from my experiences:
The only way I've seen to scale up the "expressiveness" in a programming language in a way that's generally applicable is to make it more declarative. I have mixed feelings about this.
Two primary ways of doing so are functional idioms for "iteration" and concatenative programming.
Things like juxt, mapcat, et al have their equivalents in languages like J, K, Factor, etc.
The only way to elevate yourself above loops and manually assigning intermediates is to flow the data through high-level descriptions of what you want.
Whether that takes the form of a concatenative or functional langauge depends on the coder.
OOP is more about scaling up procedural idioms so that state management and code reuse aren't a total Vietnam. They aren't really more "expressive" with the exception of some of the idioms Smalltalk tossed about.
All that's left otherwise is "ecosystem leverage" such as Mathematica exhibits here. That's not really about the semantics of the programming language, but it's still worth noting if the leverage is relevant to the problem you're solving.
comment 14y ago · link · parent
The closest thing to composition or reuse in Go are the typeclasses and it's pretty weak. I hope he enjoys specializing his maps and reduces for every type instance.
Rob Pike has in the last few years spent a lot of time complaining about the younguns and the slightly less young younguns, but I've not seen him talk in concrete terms about what he thinks the solution is.
Other than, "use Go", which doesn't actually answer the questions that are raised by his complaints. Like how Go somehow supports composition in a superior way. I've spent some time with Go, built a few projects and services. I wasn't impressed.
I'll just keep using Clojure and Python until Pike starts talking about what he actually means to do to solve these problems.
Hickey is an iconoclast too, but he's sensible enough to stay focused on what can move the profession forward as opposed to complaining profusely on Google+ every other week.
If you really want to learn something interesting, you'd be better off learning about the fundamental relationships between code, data, state, and objects such as Hickey has covered in his past talks.
They're enlightening even if you don't care about Lisp and the talks themselves aren't really in terms of Clojure except to explain how it does things differently.
comment 14y ago · link · parent
Clojure's combination of declarative idioms and highly functional idioms (to a greater extent than CL) lead to it being able to by default express certain things in a more terse fashion.
http://rosettacode.org/wiki/Factors_of_an_integer
Compare Common Lisp and Clojure here.
Common Lisp:
(defun factors (n &aux (lows '()) (highs '()))
(do ((limit (isqrt n)) (factor 1 (1+ factor)))
((= factor limit)
(when (= n (* limit limit))
(push limit highs))
(nreconc lows highs))
(multiple-value-bind (quotient remainder) (floor n factor)
(when (zerop remainder)
(push factor lows)
(push quotient highs)))))
Common Lisp in this case is relying heavily on mutation with push. It's not that much better than a typical loop in an iterative language like Python.Clojure solutions:
; Trivial version
(defn factors [n]
(filter #(zero? (rem n %)) (range 1 (inc n))))
Initial version just does a filter and a lambda across the sequence produced by range. inc so that it includes the final result. Pretty functional. ; Less trivial
(defn factors [n]
(into (sorted-set)
(mapcat (fn [x] [x (/ n x)])
(filter #(zero? (rem n %)) (range 1 (inc (sqrt n)))) )))
Now we're getting a little more clever, relying on mapcat, filter, a lambda, and range. ; Now with a for-comprehension.
(defn factors [n]
(into (sorted-set)
(reduce concat
(for [x (range 1 (inc (sqrt n))) :when (zero? (rem n x))]
[x (/ n x)]))))
http://clojure.github.com/clojure/clojure.core-api.html#cloj...Take a look at the other things that work across the seq'able data structures. Pretty powerful base set of idioms.
Okay, but lets provide a second opinion on these idioms. What about Haskell?
import HFM.Primes(primePowerFactors)
import Data.List
factors = map product.
mapM (uncurry((. enumFromTo 0) . map .(^) )) . primePowerFactors
Using a primes module for finding prime factors. Okay, isn't that kinda cheating Rosetta Code though? I was kinda hoping to find the equivalent of the Clojure code.And Mathematica?
Factorize[n_Integer] := Divisors[n]
FFS.I give up. These are dumb comparisons. Don't listen to this Wolfram post. At least the Common Lisp/Clojure code wasn't pointless.