On Tue, 2012-11-27 at 05:27 +0100, Fabien Bourgeois wrote:
> I think there are million of things wrong in CYASUS. If some of 
> yourselves have a little time to spend, I will be very happy to have 
> feedbacks or every advice about :

Here are some things.


> ; Copyright (c) 2012 Fabien Bourgeois

Despite core.clj's usage, I think Riastradh's recommendations for Scheme
are worth following here; i.e. 3 semicolons.  Those particulars are
spelled out elsewhere
https://www.gnu.org/software/emacs/manual/html_node/elisp/Comment-Tips.html

>   (:require cyasus.lang
>             cyasus.config))

You may want to give these short aliases with the :as arg to :require.

> (def params cyasus.config/params)

I'd replace this with a :use :only in the ns form.  :use and :require of
the same module play nicely.

> (defn url?
>   "Takes a string and checks the validity of this as an URL."
>   [s] {:pre ([string? s])}
>   (try
>     (java.net.URL. s) true

j.n.URL is not *nearly* forgiving enough for the URL text typically
included in sites and copyable from address bars.  Try
https://github.com/wtetzner/exploding-fish instead.

>   ([id url code] {:pre [(every? string? [id url code])]}

With only one arity, the surrounding (...) are always elided.
Additionally, pre- and postconditions go on the line after the lambda
list.

> (ns cyasus-ring.config)

You might like to experiment with https://github.com/drakerlabs/milieu
here.

> :WRONG_URL

This is interesting, but if you want to continue with this approach,
you'll be better off with

(def wrong-url :wrong-url)
;;;...for the rest
(def labels {"EN" {wrong-url ...

And then referencing "wrong-url" instead of the keyword everywhere,
because it's nice static checking and it's not expensive.  Macro it out
if you want.  Same thing with config.

>                   :KEY_DONT_EXISTS "La clé n\"existe pas."

How come the " instead of '?

> (defn abs-url

Exploding Fish should provide this too.

>      (if abs (html/content (abs-url s)) (html/content s)))))

(if ...) is an expression.  This is

(html/content ((if abs abs-url identity) s))

>   :license {:name "MIT License"

Thank you for choosing a license permitting your code to be linked with
and reused in GPL projects.

>   (is (string? (gen-key)) "Must return a string.")

A comment that merely repeats the code may be elided.  Unlike Python's
unittest, c.test can tell you where the error is, the form that produced
it, &c.

-- 
Stephen Compall
"^aCollection allSatisfy: [:each | aCondition]": less is better than


-- 
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

Reply via email to