J

James Coglan

blog.jcoglan.com · Personal blog · on HN since 2008

James Coglan writes about programming topics such as diff algorithms, monads, promises, Rust, and the Y combinator.

What HN saysCommenters link its JavaScript monads article repeatedly and recommend the Myers diff series.
93HN people shared it
31linked it in comments
74stories submitted
1.8Kstory points
4 months agolast shared
2008people per year2026

Most-shared posts

  1. 1
    Why GitHub is not your CV
    17 people · 140 points · first shared 2013 · 129 comments on HN
  2. 2
    The Myers diff algorithm: part 1
    7 people · 419 points · first shared 2017 · 23 comments on HN
  3. 3
    Introduction to monads in JavaScript
    7 people · 221 points · first shared 2011 · 34 comments on HN
  4. 4
    Callbacks are imperative, promises are functional
    6 people · 358 points · first shared 2013 · 149 comments on HN
  5. 5
    Generic Returns in Rust
    5 people · 13 points · first shared 2019 · discussion on HN
  6. 6
    The patience diff algorithm (2017)
    5 people · 7 points · first shared 2020 · discussion on HN
  7. 7
    Promises are the monad of asynchronous programming
    4 people · 9 points · first shared 2011 · discussion on HN
  8. 8
    Deriving the Y combinator
    4 people · 6 points · first shared 2008 · discussion on HN
  9. 9
    Uses for Nested Promises
    4 people · 4 points · first shared 2026 · discussion on HN
  10. 10
  11. 11
    Writing a language in 15 minutes
    2 people · 28 points · first shared 2009 · 4 comments on HN
  12. 12
    Announcing Vault: safer passwords for the web
    2 people · 11 points · first shared 2012 · 3 comments on HN
  13. 13
    Building JavaScript projects with Make (2014)
    2 people · 6 points · first shared 2014 · discussion on HN
  14. 14
    Merging with diff3: the “three-way merge”
    2 people · 6 points · first shared 2020 · discussion on HN
  15. 15
    Websocket-driver: an I/O-agnostic WebSocket module
    2 people · 5 points · first shared 2013 · discussion on HN

What HN people wrote when they linked it

rottc0dd · 2023-01-12
There are some great visualizations by 3b1b: https://www.3blue1brown.com/ Recently he had done a video about convolution. And his videos about neural networks are pretty good. He has recommendation video for other good channels too. Great blog on Myers diff series: https://blog.jcoglan.com/2017/02/12/the-myers-diff-algorithm-part-1/ Not technical illustrations but, some funny jokes in unix haters handbook is pretty funny. https://web.mit.edu/~simsong/www/ugh.pdf There is also unix magic poster: https://archive.org/details/unix-magic-poster-gary-overcare-1
antoaravinth · 2015-01-06
To be honest, I have tough time reading Haskell code or even laws. I understood the mondas in terms of javascript, as it is written over here: https://blog.jcoglan.com/2011/03/05/translation-from-haskell-to-javasc…
ionfish · 2011-04-10
James Coglan has written a lot [1] about these issues. His series on evented programming [2] is a good place to start. [1] http://blog.jcoglan.com/ [2] http://blog.jcoglan.com/2010/02/21/events-theyre-not-just-for-the-dom-…
samsquire · 2022-12-04
Thank you Eatonphil for writing this. I agree that I would love to see more of this kind and quality this kind of article of technical subjects. https://blog.jcoglan.com/2017/02/12/the-myers-diff-algorithm-part-1/ https://keleshev.com/abstract-syntax-tree-an-example-in-c/ I don't want to add more work to people who are already working more than everyone else. But when you write software or code that is truly good, I want people to write lots of examples and descriptions of their mental model and how to think of the software. I'm still trying to understand what the difference between a poller and an awaiter in Rust async. I use Flask because I find Flask easier to understand than Django. There's even a simple example on the Flask homepage. But Django has a very large tutorial which still doesn't really explain how each component fits together. I don't understand the mental model behind Django but I do with Flask. For example, I'm still trying to understand C++ coroutines. And I have some code that kind of works and some code someone provided on Stackoverflow I cannot get to work with GCC. There's not large amounts of documentation on C++ coroutines. I see people post fascinating awesome GitHub projects and have sparse README.md and no screenshots The code doesnt speak for itself. You can write the perfect code at a company and that code never flourishes because nobody wrote about it. Or you can write the perfect code at home but it doesn't get used. I would rather…
alquemist · 2020-11-06
You are correct, thanks for the clarification. From https://www.gnu.org/software/diffutils/manual/diffutils.html#diff3-Mer… > You can think of this as subtracting older from yours and adding the result to mine, or as merging into mine the changes that would turn older into yours. The point stands: taking history in account is unconvincing, as it assumes intent where none is explicitly given. In the example, if the top branch had a single commit, AB => ABGAB, then there is no way to reliably infer that A 'intended' [+ABG]AB, vs. AB[+GAB]. Even with the given history, maybe the author of the top branch really intended AB => AB[+GAB], but made an error, corrected in the 2nd commit. The problem is fundamentally ambiguous. We can argue which of the diff3 or anu/pijul heuristics are better. In practice I suspect the difference is not that large. For completeness, here's a guess of what diff3 does, assuming merging top into bottom, following https://blog.jcoglan.com/2017/05/08/merging-with-diff3. [bottom] => A [+X] B [top] => AB [+GAB] B O T A A A +X B B B +G +A +B Resulting in A[+X]B[+GAB] without conflicts.
kalleth · 2014-07-06
Oh god. Most of this is hilarious. "A seasoned C developer with 10 years experience can not instantly morph into an advanced front end web application developer" True, but they'll be a damn sight quicker at picking it up than anyone else. And they'll write far better code when they're there. If you're looking for a permanent employee, all development experience is relevant -- there is a huge amount of overlap and retraining just for a different language is no biggie. They'll also have solved (i'd bet) far harder problems than "HOW DO I GET THIS UI WIDGET TO UPDATE WHEN THIS HAPPENS". If you're looking for someone to hit the ground running from day 1, or work as a contractor, it's different. But you generalise too far here. "However, they have failed to mention anything else to back it up. I would expect to see some of the following throughout their CV; Design Patterns (MVC, Factories, Singletons, ActiveRecord), Classes, Objects, UML…" In my CV (highly rated by everyone i've given it to) you won't find a single one of these. Instead, you'll find real descriptions of what i've accomplished, who I worked with (mentoring etc), my methodology (agile, test driven development) and so on. And UML... holy shit, yeah, no. Community work? See Ashe Dryden's "The Ethics of Unpaid Labor and the OSS community", http://www.ashedryden.com/blog/the-ethics-of-unpaid-labor-and-the-oss-… and James Coglan's "Why GitHub is not your CV",…
vcmiraldo · 2021-07-08
ufo · 2020-05-31
Patience diff cares about lines that only appear once in each file. The idea behind that heuristic is that lines that only appear once are more likely to represent the parts of the document that don't belong to the diff. Conversely, if a line appears more than once in the file then it is more likely to be something like a blank line or a " }", where a match in the two documents might be just a coincidence. That particular example is one where the heuristic doesn't work well. The big block of abcs doesn't have any unique lines so patience diff doesn't see much cost in including it as part of the diff. OP's blog has another series of posts about patience diff. They are also an interesting read: https://blog.jcoglan.com/2017/09/19/the-patience-diff-algorithm/
rajathagasthya · 2017-07-03
Another explanation of Myers diff algorithm that I found interesting: https://blog.jcoglan.com/2017/02/12/the-myers-diff-algorithm-part-1/
samsonradu · 2017-05-08
Here you can read about the advantages of using Promises, it s very interesting, though a bit long. https://blog.jcoglan.com/2013/03/30/callbacks-are-imperative-promises-… Promises are easier to compose because you can pass them around as values. Meanwhile callbacks are used only for their side-effects, they do not return anything.
omni · 2014-11-27
Here's one take from a person who disagrees with your position. I've found it to be an interesting read. http://blog.jcoglan.com/2013/11/15/why-github-is-not-your-cv/
owenmarshall · 2014-11-07
> The second link is merely an animated gif of an octopuss. Now that is funny. Either the blogger changed his URL structure in the time I copy/pasted, or I did a dumb: https://blog.jcoglan.com/2013/11/15/ > If she did somehow draw a causal link between those activities and not using github (she doesn't), it would imply that women should also be absent from Facebook, Pinterest and Instagram. They aren't. Wait a minute, are you seriously trying to advance the argument that software development (the purpose of github) is as mentally similar as browsing the web for pictures of cakes (the purpose of Pinterest, as far as I can tell)? Not sure if serious or trolling. E: jcoglan is doing referer: madness, copy/paste the URL or bang refresh.
zerr · 2014-10-24
At least you should try. Maybe start small (and stay small..), there is always some path to escape from cubicle nation.. ;) As for "github is your CV" hype: http://www.ashedryden.com/blog/the-ethics-of-unpaid-labor-and-the-oss-… https://blog.jcoglan.com/2013/11/15/why-github-is-not-your-cv/
hackerboos · 2014-09-23
Find a slow part of your Python/Ruby/Lua application that could use some speeding up and then write an extension for it in C. Some useful reading: http://www.swig.org/ http://dan.iel.fm/posts/python-c-extensions/ https://blog.jcoglan.com/2012/07/29/your-first-ruby-native-extension-c…
lobo_tuerto · 2014-08-18
Yes, just noticed. Sent a message to the author, meanwhile you can read the post here: https://blog.jcoglan.com/page/6/
SchizoDuckie · 2014-05-12
Github is not your resume. http://osrc.dfm.io/ You can generate an open source report card based on your profile, but you should not see github as your CV: https://blog.jcoglan.com/2013/11/15/why-github-is-not-your-cv/
peterjmag · 2014-03-14
Looks like he's just trying to shed some light on how bogus those activity graphs are (and also illustrating how easy it is to game them). The GitHub contributions graph probably shouldn't be used for any sort of meaningful measurement of skill, open source involvement, job candidacy—or anything else really. I found the two related articles linked in the readme really interesting: http://www.ashedryden.com/blog/the-ethics-of-unpaid-labor-and-the-oss-… https://blog.jcoglan.com/2013/11/15/why-github-is-not-your-cv/ (Still reading the first one.)
jaekwon · 2013-12-24
> the biggest problem is that the SHA1 digest of a message is not an authenticator of that message, because an attacker can generate the same digest given only the contents of the message. Curious, if the secret token comes after the message & there is proper delimiters to separate the message from the secret, where is the vulnerability? Take a look at this link: https://blog.jcoglan.com/2012/06/09/why-you-should-never-use-hash-func… Am I correct to think that the example cited is bad? It appears that it would be a strong MAC because of the reasons that I cited.
mholt · 2013-11-15
Other than Javascript testing frameworks, I don't know of any offhand... A few quick Google searches turn up some possibilities: Codeception for PHP shows tests in the browser with Selenium... or with a little hacking, you can show RSpec tests in the browser, http://blog.jcoglan.com/2013/07/01/running-rspec-tests-from-the-browse…
voyou · 2013-08-20
Yes: here's an interesting discussion of promises (in JavaScript) in terms of monads: http://blog.jcoglan.com/2011/03/11/promises-are-the-monad-of-asynchron…
DanielRibeiro · 2013-07-08
James Coglan did a good introduction of promises on his Callbacks are imperative, promises are functional: Node’s biggest missed opportunity[1] (HN discussion here[2]). The author of Promises/A+ also wrote a nice blost post on his You're Missing the Point of Promises [3] Promises are actually a part of a of a very well understood programming mechanism that involves Futures and Deferred as well[4] [1] http://blog.jcoglan.com/2013/03/30/callbacks-are-imperative-promises-a… [2] https://news.ycombinator.com/item?id=5466872 [3] https://gist.github.com/domenic/3889970 [4] http://en.wikipedia.org/wiki/Future_%28programming%29
judofyr · 2009-10-06
I'll have to admit I'm a big fan of James Coglan. Checkout his "Scheme in 15 minutes" screencast: http://blog.jcoglan.com/2009/05/19/talk-writing-a-language-in-15-minut…
yoshuaw · 2020-03-20
Hi, author here. Glad you've enjoyed the post! To answer your questions: As leshow pointed out, Rust uses the Result type to propagate errors. The way we'll integrate this in parallel-stream is by adding `try_for_each`, `try_fold`, and `try_map` methods. These methods will short-circuit when an error is returned, and have counterparts in `std` and `async-std` already. One tricky part is to get cancellation right, but we already have a design for that, it's just a matter of implementing it now. `async-std` comes with support for the `log` crate built-in, which provides information when a new `Task` (lightweight thread) is spawned. `parallel-stream` doesn't perform any logs on top of that, but it probably should! I'll open an issue. Result sets can be generated through the `collect` method which calls the `FromParallelStream` trait. This can be implemented for various types, but common examples include: `Vec<T>`(generic array), `HashMap`, and `Result<Vec<T>>`. If you're interested in how this exactly works this post by jcoglan goes into incredible detail: https://blog.jcoglan.com/2019/04/22/generic-returns-in-rust I hope this answers your questions!
sparkslabs · 2016-06-08
Conflating github projects as being "your experience", is not really sensible really. After all, github is only 8 years old at this point, and many real world projects (ie the day job where your experience lies) can't be in github public repositories. (And for many predate the existance of github) For a selection of good reasons as to why using github like this is a bad metric take a look at: https://blog.jcoglan.com/2013/11/15/why-github-is-not-your-cv/ (There are lots of good counterpoints to the arguments there in the hackernews discussion of that post here - https://news.ycombinator.com/item?id=6738952 - but personally I still think it's incredibly dangerous to start assuming that you can really measure experience from github. After all, do you also include repositories forked, but not worked on? If so, it'd be incredibly easy to game this... As a toy it seems kinda fun/neat, but as a tool... far less so.
graue · 2013-04-01
A day later I looked at this again and I'm a little closer to understanding. var listPromise = new Promise(); creates an object that, being a Promise object, has certain methods and internal state, derived from the prototype of Promise. for (var k in listPromise) promises[k] = listPromise[k]; This confused me because I thought "k" was a stand-in for a numeric index, e.g. that it was doing promises[0] = listPromise[0], promises[1] = listPromise[1], etc. That is not what's going on. Rather, "k" refers to attributes and/or methods that objects of the Promise class have by default. It's copying those onto `promises` — the array `promises` itself, not the individual items `promises[i]`, which keep their existing methods and attributes. Coming from a Python background, I think I would have found this more obvious if the variable "k" were instead called "method" or "attr". If it was `for (var method in listPromise)` it'd be much clearer what's going on, whereas single-letter variables like i, j, and k are, to me, stand-ins for integers. It was also confusing, as you said, that the function uses destructive update rather than treating the input as a value. James did mention this ("augmenting the list with promise methods"), but it's still unexpected, especially when the function is preceded by a Haskell type signature. The reason I only say I'm closer to understanding, and not quite there yet, is I'm not sure what it means to do `new Promise()` or what is being…

Keyboard shortcuts

/Search
j kNext / previous blog
EnterOpen selected blog
vVisit the blog site
fFollow / unfollow
lSwitch grid / list view
dSwitch dark mode
g hHome
g pTop posts
g tTopics
g fFollowing
g lLiked
g yHistory
g qFAQ
EscBack / close