When I first came to Clojure (from C# of all things), I had questions like
this too. But over time I've become convinced that it was something I
worried to much about. The guiding rule for code organization should be
this: does it slow you down from the complexity? Are there so many files,
that you're constantly context switching from one file to another? Are
there so few files that you're having problems introducing new programmers
to the code. I don't think there's any one size fits all solution to this.
I think it's different from one project to another.

I have clojure files with just 4 lines of code, and others with 3000 lines
of code (that's a lot for Clojure). It's also not hard to refactor these
things when needed. Especially if you don't use :refer :all in your
namespace declarations. Use one of these forms:

(ns my-ns
  (:require [foo.bar :as f]
                [foo.baz :refer [qux qox]]))

Both of these allow for rather quick namespace conversion. If a function
moves locations, it's fairly easy to just do a find/replace on the code.
And the Clojure compiler will also help you, complaining about undefined
vars.

I hope this helps, in short, relax, it's not as big of a problem as it
seems.

Timothy

On Sun, Feb 8, 2015 at 2:48 AM, Atamert Ölçgen <mu...@muhuk.com> wrote:

> Hi Dru,
>
> I find it easier to organize things when I follow TDD. It's easier for me
> to spot something is in the wrong place (module or maybe as a
> responsibility of a function) by looking at the tests. (This is true for
> any language I work with.)
>
> http://butunclebob.com/ArticleS.UncleBob.TheThreeRulesOfTdd
>
>
> On Sat, Feb 7, 2015 at 6:23 PM, Dru Sellers <d...@drusellers.com> wrote:
>
>> Greetings,
>>
>> I am trying to convert my mind from OO (C#) to one more functionally
>> friendly. I am increasingly comfortable with simple applications in
>> clojure, but as I start to build more complex applications, I start to fall
>> down about how to structure my application. I don't want to just shove OO
>> ideas into the functional nature of Clojure. I'm looking for any help
>> someone can provide to help shimmy my brain into the right mental patterns.
>>
>> Background: Long time C# developer who leans heavily on IoC / DI /
>> Interfaces / Testing / Object Encapsulation.
>>
>> Specific Questions: Namespace Organization
>>
>> Now I know this is almost entirely personal preference, but I'm playing
>> with a namespace model that looks like this and I'd love some feed back.
>> Tear it about, bust that red pen out and help me to better think of things
>> in clojure way. I only have my C# / OO background to lean on and need some
>> fresh brain juice. :)
>>
>> I currently organize my projects like this. a spin off of 'duct'
>> https://github.com/weavejester/duct but i'm looking for a bit more
>> detail.
>>
>> Context: Project name is going to be "ford", feature is going to be a
>> simple log of text
>>
>>
>> ~/
>>   src/
>>     ford/ - the project
>>       log/ - the feature name
>>         http.clj - contains clojure routes at 'http/routes' - orchestrate
>> the business calls
>>         model.clj - contains my 'defrecords' / yesql / db calls
>>         core.clj - the "business" calls
>>
>>
>> I def have a preference for shorter files rather than longer files
>> I also tend to have a heavy use of 'ceremony' - right now I need a lot of
>> structure because I'm still learning to think in terms of clojure. and I
>> spend a lot of time still reading it rather than thinking about it.
>>
>> Again, thank you.
>>
>> -d
>>
>> --
>> 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 unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Kind Regards,
> Atamert Ölçgen
>
> -+-
> --+
> +++
>
> www.muhuk.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
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to