# What do you think makes code "Julian" in style?

**URL:** https://discourse.julialang.org/t/what-do-you-think-makes-code-julian-in-style/49219
**Category:** General Usage
**Tags:** question
**Created:** [October 29, 2020, 2:56am UTC](https://discourse.julialang.org/t/what-do-you-think-makes-code-julian-in-style/49219 "2020-10-29T02:56:34Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Reckoner](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/reckoner/32/21415_2.png) [@Reckoner](https://discourse.julialang.org/u/Reckoner)
#### Post date: [October 29, 2020, 2:56am UTC](https://discourse.julialang.org/t/what-do-you-think-makes-code-julian-in-style/49219/1 "2020-10-29T02:56:34Z")

</div>

There has definitely been past mention of code being “Julian” or not in analogy to Python’s “Pythonic”, but I’ve recently realized that I don’t actually know what “Julian” means to other people.

**So I’ve come to ask people here: What makes code “Julian” to you?**

For me, I’ve recently been considering trends I’ve observed in what Julia packages pick up steam, and I’ve come to my own conclusion that interfaces are Julian when they leverage multiple dispatch in such a way that their compatibility with arbitrary unknown packages is maximized. In contrast to Pythonic code emphasizing a single “most Pythonic” way to perform a specific intended action, Julian code emphasizes the possible coexistence of an arbitrary quantity of ways to yield a valid result.

That is, I see “Julian”-ness as a property of a function’s interface instead of as a property of coding style.

Off of the top of my head, Tables.jl is a good example of a library that I would consider to be “Julian”.

---

<div class="post-metadata">

### Author: ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)
#### Post date: [October 29, 2020, 3:11am UTC](https://discourse.julialang.org/t/what-do-you-think-makes-code-julian-in-style/49219/2 "2020-10-29T03:11:11Z")

</div>

I think that one of the most critical aspects of Julian code is that it accepts the broadest types with which it will function. Also, type stability (where possible) is really important for code to feel Julian.

---

<div class="post-metadata">

### Author: ![Raf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raf/32/3383_2.png) [@Raf](https://discourse.julialang.org/u/Raf)
#### Post date: [October 29, 2020, 4:42am UTC](https://discourse.julialang.org/t/what-do-you-think-makes-code-julian-in-style/49219/3 "2020-10-29T04:42:41Z")

</div>

Method dispatch instead of `if else` blocks are the most iconic julian thing. Julian code normally has this kind of block of methods everywhere:

```julia
mymethod(arg::Sometype) = ...
mymethod(arg::Anothertype) = ...

```

So you can add methods for other types pretty much anywhere.

---

<div class="post-metadata">

### Author: ![longemen3000](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/longemen3000/32/7298_2.png) [@longemen3000](https://discourse.julialang.org/u/longemen3000)
#### Post date: [October 29, 2020, 5:14am UTC](https://discourse.julialang.org/t/what-do-you-think-makes-code-julian-in-style/49219/4 "2020-10-29T05:14:33Z")

</div>

> [@Raf](#):
>
> Method dispatch instead of `if else` blocks are the most iconic julian thing. Julian code normally has this kind of block of methods everywhere:

hahaahh yes, is there an stablished name for that pattern?

---

<div class="post-metadata">

### Author: ![HaoxuanGuo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/haoxuanguo/32/19052_2.png) [@HaoxuanGuo](https://discourse.julialang.org/u/HaoxuanGuo)
#### Post date: [October 29, 2020, 6:08am UTC](https://discourse.julialang.org/t/what-do-you-think-makes-code-julian-in-style/49219/5 "2020-10-29T06:08:23Z")

</div>

I think Pythonic means use vector style code like

```python
reduce(map(operation, something))

```

instead of

```python
for item in items:
  do_something_with(item)

```

Also, Mathematica style was thinks to be function chain like

```mathematica
Plot[Limit[Integrate[Solve[D[equation, x] == 0], {y, 0 ,10}], z->0], {a,0,5}]

```

* * *

These difference is depends on their language design. In julia, there are some special design which are

1. Use `begin` instead of `1`

```julia
iter_size = size(array)[begin]

```

1. Use multi-dispatch instead of type check
2. Escape underline(`_`) in separation

```julia
somemethod(arg::Type1) = ...
somemethod(arg::Type2) = ...

```

instead of

```julia
some_method(arg) = begin
  if typeof(arg) == Type1
    do_something(arg)
  ...
end

```

1. **[IMPORTANT]** Vector operation will NOT get better performance in julia. Dare to use loop.  
Sorry I can not make up a good sample.
2. Dot broadcast

```julia
@. result = array |> op1 |> op2 |> op3 |> opchain |> (balabala \circ bababa)

```

1. number multiply

```julia
length = 1000mm

```

instead of

```julia
length = 1000 * mm

```
