Fork me on GitHub
#beginners
<
2016-07-04
>
val_waeselynck06:07:48

@montanonic use whatever is more readable my preference usually goes to anonymous literals

agile_geek06:07:49

@seancorfield: I think you are stating the most common 'complaint' I hear from experienced developers trying out Clojure/Clojurescript for the first time. The good thing about the Clojure community is that we are willing to let go of old paradigms if they're not working, the bad thing about the Clojure community is the same. It's hard for people to latch onto an idiomatic approach to the 'macro' paradigms like web dev (we definitely have a strong story in the 'micro' around functional composition etc.). I am following @luke's work on Arachne with great interest to see if this provides the basis for filling this whole in the Clojure story.

seancorfield16:07:33

@agile_geek: Interesting observation. I guess I’m old enough and have been programming long enough that I'm used to there being very little "best practices" codified online or even in books (I’d been a professional programmer for a decade before the "Gang of Four" patterns book came out, for instance — and all this new-fangled "video tutorial" stuff is still alien to me 😄 ).

roberto16:07:09

I prefer “best practices” in the spirit of Effective Java. There is probably a way to differentiate those from larger architectural “decisions” like what Luke is trying out with Arachne.

agile_geek16:07:37

@seancorfield: I am in the same boat. Albeit I have some COBOL books somewhere! And I can remember what a status 30 error code is!

agile_geek16:07:14

@roberto: as stated above I think Clojure has a good story WRT best practices at the micro but has less guidance in the macro. I am following @ztellman's stuff around 'Elements of Clojure' with great interest too.

roberto16:07:28

oh, yeah, I find ztellman’s book very insightful. His unsession at Clojure West was also pretty good. Very thought provoking.

lewix16:07:10

ztellman book?

lewix16:07:28

I wish there was more books geared towards web development - with titles like "microservices with clojure" "Build a webapps with clojure"

roberto16:07:30

it probably isn’t what you are looking for. It isn’t a prescriptive book.

lewix16:07:17

@agile_geek: yes as I mentioned earlier (scroll up - one day ago)

lewix16:07:04

@agile_geek: I bought it but I haven't read it. Maybe I should

agile_geek16:07:37

@lewix: I think it's a good place to start if you're interested in web development

roberto16:07:44

The author also has a talk online where he demoes how to build web apps with clojure. It was given at this year’s Philly’s ETE

agile_geek16:07:45

Once you're past the 'how do I do anything with Clojure' stage I think https://pragprog.com/book/vmclojeco/clojure-applied is a good 'intermediate' level book.

lewix16:07:21

Ok I'll invest more time with those books

lewix16:07:28

I invested about a month learning clojure/clojurescript...I guess it takes more time than I thought to be comfortable with the bigger picture (more complex apps from A to Z)

lewix16:07:57

way more than most technologies I dealt with in the past

lewix16:07:48

@roberto: thanks for the link

roberto16:07:16

it takes a while, it is a paradigm shift, and that is harder to learn than syntax.

roberto16:07:32

I spent about 2 years trying to learn it on and off, until it finally clicked.

roberto16:07:44

Learning SML made clojure (and scala) click for me.

roberto16:07:05

i think learning the paradigms is more important than the syntax. After that things flow naturally.

agile_geek16:07:56

I found Clojure/Clojurescript deceptively simple and frustratingly hard at same time. Coming from years of procedural and imperative OO programming, the syntax is simple but there's a lot to 'unlearn' and 'relearn' to 'get' the FP side of things. Once you 'get it' you kick yourself because it all seems so simple you wonder why it took so long. Persevere 😄

lewix16:07:00

@roberto: I think the paradigm clicks, but the lack of learning resources to stitch everything together lack. I should have at least read the only book available about web development before I pass judgement though

roberto16:07:51

I learned web dev by reading most of the simple examples out there. At the time, the only book available was out dated. The second edition book should be very helpful to get you ramped up tho.

agile_geek16:07:37

Maybe I struggled with that bit less because I started writing Java apps for the web before JSP's or web containers so it was all hand crafted multithreaded bepoke code rendering in an applet!

roberto16:07:54

well, the basics were not that hard for me, it was things like OAuth

agile_geek16:07:54

Anything seems easier than that!

roberto16:07:30

once you get through the basics of routing, and want to incorporate things like OAuth or sockets, things start to get hairy.

roberto16:07:48

for me that was the biggest struggle

lewix16:07:02

there's something I always wondered, how is it decided what goes into the clojure core.

agile_geek16:07:06

The bit of the story that's missing is that there's no all encompasing 'framework' that does everything...a la Django or Rails

lewix16:07:09

in terms of functions

roberto16:07:23

core is very minimal, just what is needed to start the app.

roberto16:07:29

have you ever done gui apps?

roberto16:07:02

I used to write lots of swing apps, so it was very familiar to have a “main” or “core” that starts the app

roberto16:07:42

if you come from rails, that is hidden from you. I think it is more common in python land (in the pyramid framework for example)

lewix16:07:24

agile_geek: In my opinion the problem is less about a framework that does everything and more about learning materials showing the big picture. Instead of lessons about functions x or y, we should have more resources about building Apps. So it's easier to see how everything is connected....

agile_geek16:07:02

That's what Dmitri's book should give you

lewix16:07:03

@roberto: sorry I phrased it wrong. I meant that I wonder how the core team decide which functions to add to the core library

roberto16:07:23

ah, I see. I don’t really think much about that. 🙂

roberto16:07:52

I can’t “change that” if it bothers me, so I don’t give it any thought.

agile_geek16:07:58

@lewix: basically, what Rich say's goes. I quite like the fact that he's very conservative about how much he puts in core

lewix16:07:25

@roberto: I found some function that I thought useful that I didn't see in the core lib (can't remember off the top of my mind), and some in the core libs which makes me wonder..when will I need that?

agile_geek16:07:49

when you have a Lisp with macro's you can pretty much write whatever extension to the language you want.

agile_geek16:07:23

Often something you think should be in core will be in a library someone else has written

lewix16:07:38

agile_geek: fair enough

agile_geek16:07:53

or you can write it yourself 😉

agile_geek17:07:19

Typically stuff going into core now is fundamental paradigm shifting stuff that needs associated changes to the reader and/or compiler to make efficient. For example, transducers.

lewix17:07:54

anyone played with golang ?

roberto17:07:13

i tried some katas, it wasn’t for me.

roberto17:07:31

i like some of the things: like generating a portable executable.

roberto17:07:49

the tooling is execellent

roberto17:07:57

but I didn’t like the language 😞

seancorfield17:07:01

There’s an #C16LEKSLT channel that has some really good discussions around language comparisons if folks want to go deeper.

seancorfield17:07:35

Re: what goes into core — I agree @lewix that I often end up writing a function myself that then seems to be common in almost every "utility" library and you wonder why it’s not in core, and then you see something in core that seems really exotic and you can’t figure out when you’d even need such a thing!

seancorfield17:07:03

Most of core is fairly obvious "building blocks" tho’ otherwise.

montanonic23:07:31

Is there a way to break out of recur loop recursion early?

mfikes23:07:30

@montanonic: Just conditionally don’t call recur

mfikes23:07:51

No magic, really 🙂

montanonic23:07:22

yeah, I wasn't even thinking of that for some reason, even though I already do that to ensure the input isn't null

mfikes23:07:22

Yeah, you can essentially flip your thinking around and instead think of recur as being the special thing that causes it to go back to the loop, where the default is to not.

digorithm23:07:03

Guys, I have a fundamental question, it's probably really silly, maybe my head is still too OOP. Maybe I'm just so confused that I won't be able to express my question correctly, but here it is: how should I design the representation of a certain core domain data? Suppose I'm designing a classroom software, in a classroom there will be students, a student has a name, surname, age and gender, how should I correctly define that first so I can, then, write functions to manipulate this structure? Should I use defstruct?

mfikes23:07:26

@digorithm: To be honest, I would first take a stab using regular maps, trying to be somewhat disciplined about things, but without getting too caught up in it. (Malleability is a good thing early on in the design.) Perhaps then reach for defrecord later after things settle down, if you find you need the structure it provides, or for perf.

digorithm23:07:46

@mfikes thanks for the response. how could I use regular maps in generic/abstract way to describe the structure of a student, for example?

mfikes23:07:26

{:first-name “Jane” :last-name “Smith”}

montanonic23:07:28

do it like you would JSON, that's one way to approach things