I think what is missing in the docs is something like "package design
guideline".
On Thursday, May 12, 2016 at 10:16:53 PM UTC+2, Scott Jones wrote:
>
> Very good advice - is anything like it already in the Julia docs? If not,
> it should be added, up near the beginning.
>
> On Thursday, May 12, 2016 at 4:10:22 PM UTC-4, Tom Breloff wrote:
>>
>> I find the most valuable thing to do when designing julia code is to
>> focus purely on "verbs", not "nouns". This means focusing on the action...
>> NOT the object that is acting. In julia, you can do fun stuff like:
>>
>> julia> type Car end
>>
>> julia> speed(::Car) = 60
>> speed (generic function with 1 method)
>>
>> julia> type Plane end
>>
>> julia> speed(::Plane) = 500
>> speed (generic function with 2 methods)
>>
>> julia> function move(pointA, pointB, tools...)
>> speeds = map(speed, tools)
>> idx = findmax(speeds)[2]
>> println("""I don't always go fast, but when I do, I prefer a
>> $(lowercase(string(typeof(tools[idx])))).
>> I am... the most interesting coder in the world.""")
>> end
>> move (generic function with 1 method)
>>
>> julia> move(1, 2, Car(), Plane())
>> I don't always go fast, but when I do, I prefer a plane.
>> I am... the most interesting coder in the world.
>>
>> julia> type Teleporter end
>>
>> julia> speed(::Teleporter) = Inf
>> speed (generic function with 3 methods)
>>
>> julia> move(1, 2, Car(), Plane(), Teleporter())
>> I don't always go fast, but when I do, I prefer a teleporter.
>> I am... the most interesting coder in the world.
>>
>> The point with this silly example is that, in OO, you would first start
>> thinking about all the things that your transportation tools can do, and
>> about heirarchies of "well, a plane is kind of like a car, and, well, kind
>> of like a bird. I know, I'll inherit from both!" But really you should
>> think about the important actions and attributes, and the hierarchy and
>> interactions between objects will follow naturally.
>>
>>
>> On Thursday, May 12, 2016 at 3:34:23 PM UTC-4, Ford Ox wrote:
>>>
>>> I did read those and it didn't make it much clearer to me. (Hell I
>>> didn't even know what is coupling until this Thursday morning)
>>> That's why am I asking for example and possibly some page on this topic
>>> in docs, since I have been programming in OO languages all my short
>>> programmers life and Julia comes with completely different approach.
>>> Some things from OO can be achieved by different approach, some things
>>> can't be achieved and shouldn't be even tried to.
>>> I don't want to reinvent the wheel. I don't wanna try make Julia OO. But
>>> I want coupling / nicely distributed code into multiple files (that's why
>>> OO exist in the first place right?).
>>>
>>> And I am sure that many people joining julia (especially with v1.0) will
>>> be asking the same question. Therefore I would expect some official guide
>>> at one visible place (which this thread is no more).
>>>
>>> Dne čtvrtek 12. května 2016 19:40:06 UTC+2 David Anthoff napsal(a):
>>>>
>>>> Do a search for “encapsulation” in this google group and you’ll find
>>>> quite a number of discussions on some of the design philosophies around
>>>> this topic, many from the julia devs.
>>>>
>>>>
>>>>
>>>> *From:* [email protected] [mailto:[email protected]] *On
>>>> Behalf Of *Ford Ox
>>>> *Sent:* Thursday, May 12, 2016 10:20 AM
>>>> *To:* julia-users <[email protected]>
>>>> *Subject:* [julia-users] Re: Julia large project example.
>>>>
>>>>
>>>>
>>>> I am sorry for those words. The idea of that sentence should have been:
>>>>
>>>> "Your approach looks like a big no no.
>>>> Could julia devs share their idea of how should apple encapsulation
>>>> achieved? Since they are the one, who invented this language, they had to
>>>> consider *encapsulation* many times already, so they should be the
>>>> very first person who gives advice on this particular topic (since nobody
>>>> answered this topic well one comes to conclusion that they are also the
>>>> only one who can answer it)."
>>>>
>>>> Thank you for your time and patience devoting to my questions.
>>>>
>>>> Dne čtvrtek 12. května 2016 18:52:22 UTC+2 Kristoffer Carlsson
>>>> napsal(a):
>>>>
>>>> I am pretty sure the Julia developers can speak for themselves. A more
>>>> humble approach would suit you well.
>>>>
>>>>