Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Oh, is this how it's called?

I usually follow this locality of behaviour in the following situation: imagine you have several features that all of them require an object of type A, another of type B and one of type C. Usually, specially in languages with packages, it is very common to put all A objects inside a typea package, all B inside typeb and all C in typec. I prefer to put app A, B and C objects of a single feature in the same package (or if possible in the same file). This is not always desirable, depends on the context and the number of features, but I prefer it.

A different example, instead of:

    var a = init()
    var b = init()
    var c = init()

    do(a)
    do(b)
    do(c)
I prefer

    var a=init()
    do(a)

    var b=init()
    do(b)

    var c=init()
    do(c)


Well, up until now it hasn't been called anything formal, which is why I'm trying to give developers some language to (however imperfectly) describe this approach. :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: