Learning Julia for scientists who are beginning programmers

I see that you made the statement “[m]oreover, declaring types sometimes may make your code run faster” in your introductory section on variables. However, I believe it seeds an incorrect heuristic due to the design of the Julia complier. With relatively few exceptions, it will result in longer runtimes. It can also result in unintuitive runtime errors and bugs if ones mental model of the typing system is that of a static type check rather than the dynamic typing embedded in the design philosophy of Julia.

I’m sure that someone starting out doesn’t need the details of the explanation, but they would be better served (in my opinion) to understand up front that “excessive” type assignments in Julia code is recommended against (per the official manual) if one is prioritizing speed of execution (which is often not the priority for a project up front but can become more important over the a project’s development cycle). And while helpful for reasoning about code for correctness, the dynamic typing design has some nuances that may unintuitively diverge from other programming languages (in particular, languages using static type checking compliers).I find this aspect of Julia difficult to explain in a consice and understandable way to someone with little to no prior experience with programming languages.

If you could find a way to express this simply, I think you would be doing your readers a favor since this whole typing business is part of what makes Julia stand out from many popular languages. There are, necessarily, tradeoffs that are embedded in these design decisions. A beginner shouldn’t be expected to understand those tradeoffs but having a good foundation includes being generally aware of significant distinctions in design so they can be explored over time as one gains experience with the language.

2 Likes

+1 for Project Euler. This is how I learn any new programming language.

1 Like

In a similar vein, I can’t recommend Advent of Code enough for getting into a new programming language. Note you can do all the previous at any time - not just during advent :slight_smile:

4 Likes

Hi @ericjmorey,

I don’t consider myself an expert Julia programmer (although I’m not a complete beginner either) so you might be right.

The book is necessarily biased (I wrote it for myself from the past) so I prefer the type declarations to stay in the code. Still, I’m open to improvements. You may, e.g. open an issue in the book’s repo with your suggestions. I’m willing to make some changes, especially if your suggestion would be supported by some other more experienced Julia programmers.

2 Likes