I feel your pain, but you kinda shot yourself in the foot from the get go. 
What you did is the same as if you had decided to use a Java List<String> 
to store your Account info.

I'd suggest you read over this: 
https://clojure.org/reference/datatypes#_why_have_both_deftype_and_defrecord

It explains the idiomatic way to deal with application domain information, 
such as Account, Employees, etc. Spoiler, use records, or at least a map.

Now having said that, given a project across many namespaces, you will 
still have some of the problems of not having type declarations. Like if a 
function takes the record, but the argument is not called account, but say 
x instead, you would need to dig back to understand what this operates on. 
Spec could change that though.

On Tuesday, 25 July 2017 18:52:41 UTC-7, Kevin Kleinfelter wrote:
>
> I ran into the 'refactoring an unnamed type' problem.  I'd like to know 
> how experienced Clojurists avoid it.
>
> I've got an account record/structure.  It has things like an account name, 
> account number, etc.  I started off storing it in a vector, because it had 
> just two elements.  Account name was (first v).  Account number was (second 
> v).  And that worked up to a point.  Over time, it has acquired enough 
> pieces and rules that I really need to change its implementation.  I need 
> to refactor it.
>
> When it was only a few hundred lines long, in a couple of files, I could 
> examine each line.  Now that it's a dozen files and several thousand lines, 
> I just don't have the attention span.
>
> In a language with named types, I could search for AccountRecord.  I 
> could thoroughly find all the places I used it and refactor it.  Or I could 
> change the name of the type to tAccountRecord, and the compiler would 
> identify all the places where I used it (with error messages).
>
> In an OO language, I'd be accessing all of its pieces via getters and 
> setters, and I wouldn't have to find all of the places where I used it, 
> because the implementation would be a black box.
>
> But in a language with unnamed types, it's just a vector and I've just got 
> first and second and nth to search for.  That's going to find lots of 
> irrelevant stuff.  It's enough to make me pine for Java and a refactoring 
> IDE.  =:-o
>
> So how do developers who work with un-typed (or un-named type) languages 
> avoid this sort of problem?  Or, failing to avoid it, how do they clean up 
> afterward?
> tnx
>
>

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