Better HN
topnewbestaskshowjobs
Log inSign up

joncampbelldev

335 karma · joined Jul 28, 2015 (11y ago) · 158 submissions

Submissions

comment 9y ago · link · parent

I'm 28 and I wish I were the most junior on the dev team. Being a "lead" developer is fun, but I wish I had more people who I can actively learn from just by being around.

comment 9y ago · link · parent

I found yesql inadaquete for use with anything other than simple queries. Writing plain SQL is definitely nicer than an ORM, however, I find that manipulating SQL as data (honeysql) is far superior to .sql files with added magic (yesql).

As soon as I had to dynamically build queries (essential when moving beyond the complexity of "select this user record") I ran into issues with yesql's lack of power.

It also fits closer to one of the main principles of clojure, to be data-driven/data-first/just-use-data etc etc

comment 9y ago · link · parent

You may find your comment turning less gray if you articulated the issues you see with this lib.

I definitely would be interested, since I am a current user. Its always good to get a differing perspective on your tools.

comment 9y ago · link · parent

I'm currently using honeysql in clojure projects at work, it's definitely my favourite option for interfacing with mysql (although would of course rather use datomic, but then what patriotic clojure fan wouldn't?).

In case anyone needs it for mysql, the following adds basic support for "on duplicate key update" clauses:

  (defmethod sql-format/format-clause :upsert [[_ updates] _]
    (let [parts (for [[column value] updates]
                  (str (sql-format/to-sql column) "=" (sql-format/to-sql value)))]
      (str "ON DUPLICATE KEY UPDATE " (string/join "," parts))))

  (sql-helpers/defhelper upsert [m [updates]]
    (assoc m :upsert updates))

comment 9y ago · link · parent

well clojure does pass by reference, but the reference is to something that cannot be changed (i.e. a persistent data structure)

comment 9y ago · link · parent

If you can shadow previous bindings then that would also cause no problem for repl re-usage, unless the shadowing syntax is different to the binding syntax.

Either way, unrelated to the point in the article about the advantage of immutable values for repl, not immutable bindings.

I would certainly agree that truly immutable bindings would be at best quite a stumbling block for repls, but so far no one was advocating for them as a good repl feature.

comment 9y ago · link · parent

As a person who has used the standard java debugger in intellij for clojure, could you expand on what features are missing?

I find I don't get much use out of it anyway, due to immutable values and (mostly) pure functions I find I don't usually need the whole program to be running and frozen in time.

However, I'd like to know what I'm missing.

comment 9y ago · link · parent

I think there may be some confusion here, immutability is about the stability of values (e.g. I have a string, list, map etc and I want to pass it to others, view its value, make changes without affecting the original value).

Immutability is not the same as rebinding a name (in clojure at least) e.g. the following is perfectly valid (global and local binding of the same name repeatedly)

  (def a 1)
  (def a 2)
  (def a 3)
  (println a)
  => 3

  (let [a 4
        a 5
        a 6]
     (println a))
  => 6

comment 9y ago · link · parent

Very nice.

Perhaps using (partition 2 1 _) could be a clearer way to view the prev line instead of the reduce on a nil?

comment 9y ago · link · parent

There certainly is a minimum, especially when bringing in another language entirely. The point of the google closure compiler, with advanced opts, tree shaking etc etc is that the size will grow slowly as you add hundreds of your own source files and dozens of 3rd party libraries.

Choosing libraries shouldn't require careful examination of their output file size, especially if you only want half the functionality.

comment 9y ago · link · parent

Did you say "immutable by default"?

fanfare, fireworks, etc

CLOJURESCRIPT!!

sorry I just get really excited when I can mention it ... I'll go now

comment 9y ago · link · parent

A one-off event for a single-page-app which is likely to be used for more than a few minutes, and if performance of old mobile users matters then a native app is necessary, period.

If you're talking about a webpage then yes that would be awful.

comment 9y ago · link · parent

Like the 966k of JS on your homepage? ;)

There are several things to consider with download time:

- is this a website? why on earth do you need react or anything for a website?

- is this a single page web application? then to develop with a medium sized team and an increasing feature set its nice to pick a language and library/framework that enable that.

- do you really care about mobile users performance and bandwidth? then you need a native app

This is all unrelated to the article, which is merely an uninformed rant about someone who doesn't understand the point of immutability and its use within functional programming as opposed to shoe-horning it into imperative code.

comment 9y ago · link · parent

60k is hardly an issue, most hi-res images would be larger than that.

Plus due to the google closure compiler code can be minified with an aggression unknown to the typical js minifiers.

Add to that tree-shaking (removing unused code) and the long term size of your app is looking good.

I find clojurescript and specifically figwheel reduces language annoyanes and tooling problems. No more do i have to jump through hoops to get a project setup, or pick the latest and greatest build tool (grunt->gulp->webpack->jspm)

comment 9y ago · link · parent

Immutability in js is awful hence the complexity, a library like immutable.js can make it better, but the language is just not built for it.

Because imperative code and persistent, immutable data do not play nicely together.

comment 9y ago · link · parent

If the author wishes to continue with js/react/redux then he needs to pick up a library like immutable.js to cut down that immutabiilty helper crap.

However, there is a better way ... lein new figwheel my-app, clojurescript+reframe gives you all the benefits of redux with an order of magnitude less boilerplate (also hot reloading and immutability by default without no extra setup or ceremony)

comment 9y ago · link · parent

Perhaps native speakers enjoy this kind of talk a lot. I can't speak for others but I certainly did.

I don't feel that listening attentively for a couple of hours is that much of an imposition.

comment 9y ago · link · parent

Just to say, from my perspective I love your talks, zero distractions, just a long cogent train of thought to follow. Please don't feel the need to make too many changes.

comment 9y ago · link · parent

This kind of thing is useful for web applications, specifically single page apps i.e. a situation where the user needs to have javascript to use the product / whatever in question. Easily scoped and programmable css is very useful for self-contained, non-leaky react components.

However, for a web page I agree it would be absurd.

comment 9y ago · link · parent

This is why slack has configurable notification levels, depending on message content and the channel its sent to.

comment 9y ago · link · parent

If the standard data structures in your language are mutable this will not save you. Luckily many languages like Java have nice third party persistent collection libraries

comment 9y ago · link · parent

what is the relationship between a concurrency primitive like coroutines and a view library like react?

comment 9y ago · link · parent

I think long term stability is more an indication of your competence as a software engineer than flex builder's stability.

not bashing flash/flex though, my first job was making educational flash games. I wish I could be as productive and have as much fun when working in html and js.

comment 9y ago · link · parent

I'm learning mandarin and have a chinese girlfriend, fully ready for the takeover when it happens ;)

comment 9y ago · link · parent

How easily extendable is that without the original source (e.g. when using as a library)? From what I can see it looks like if you can't edit the case statements you can't extend the functionality (e.g. expression problem stuff).

However, I'm not a haskell pro, so I don't know if I'm just missing the obvious here.

comment 9y ago · link · parent

for people as disappointed as I was that this wasn't a guide to a perfect mini burger, this is my goto guide: http://aht.seriouseats.com/archives/2010/03/the-burger-lab-h...

comment 9y ago · link · parent

Very good, although I thought the dynamic typing one was a bit snarky. I'll happily give up dynamically typed languages like clojure when structural typing can give me the same flexibility.

I say this as a person learning idris and Haskell and loving it btw, before anyone prematurely tries to convert me to static typing.

comment 9y ago · link · parent

That is an accent, not an apostrophe

comment 9y ago · link · parent

Unfortunately there are still some people who don't believe it today :(

comment 9y ago · link · parent

they are excellent observations, but it seems pretty clear the team would be unable to implement them properly this late in the game, or worse unable to understand why they are a good idea.
123456