HNHacker News
TopNewBestAskShowJobs

dangets

222 karma · joined July 28, 2012

submissionscomments
dangets··on F# is the best coding language today
Yes and no, Jetbrains did an incredible job on Kotlin with seamless interop with Java, trouble-free mixed Java/Kotlin codebases, as well as reducing the learning curve and mental context switching as compared to something like Scala.

At my company there have been several devs trying to introduce Clojure as well as parallel forays to introduce Kotlin. Overall, Kotlin has caught on and spread much more rapidly and with less effort.

This is not a statement of which languages are "better" given all things equal or what problems each are suitable for, but in my first hand experience it is easier for the average Java developer to pick up Kotlin. Of course we as a company are also cognizant of the IntelliJ lock-in as I suspect using any other editor would run into the same random bugs / autocomplete annoyances that the GP experienced.

dangets··on Duke Nukem 3D Mirror Universe
There were a few other places in the first level that had "room above room" hacks that only work if you can't see overlapping areas of both rooms at the same time.

In the movie theatre there is a projector room up high, and the theatre exit below BUT the theatre exit has a wall centered in the middle where the overlap would be. There is also a spiral staircase going up to the projector room which has 2 or 3 levels of overlap, but as it is enclosed you don't view 2 levels at the same time.

Interesting stuff - and like many others have commented, I remember playing around with the Build editor and learning about these random hacks.

EDIT: and just now I'm remembering that submerging in water was another hack - you would actually teleport to another room on the map. In Duke3d the water was opaque, but in the later Shadow Warrior i remember it having some transparency (I assume probably using similar mirror hacks as D3d)

dangets··on Ask HN: Recommend books that give you insight into other professions
I'll plug 'When Breath Becomes Air', also for brain surgeon.
dangets··on Dark’s new backend will be in F#
I agree in the difficulty of finding abundant, good examples for F#. I'll throw out some plugs for ones that I liked.

* https://pragprog.com/titles/swdddf/domain-modeling-made-func... Uses F# as implementation language, though I cannot recommend this book enough for general type-safe design modeling regardless of the language.

* https://fsharpforfunandprofit.com/ Website of the author of the book mentioned above. He also has some good Youtube videos on the topic.

* https://www.demystifyfp.com/FsApplied/ A book that will walk you though developing a webserver, and also introduces you to Paket for dependency management.

I don't develop F# (or .NET) professionally, but I had fun when I played around with it. I found the interop with C# very seamless as well.

dangets··on Kafka in Pieces
Snippet from "Kafka: The Definitive Guide"

  People often ask how Kafka got its name and if it signifies anything specific about the application itself. Jay Kreps offered the following insight:
    I thought that since Kafka was a system optimized for writing, using a writer’s name would make sense. I had taken a lot of lit classes in college and liked Franz Kafka. Plus the name sounded cool for an open source project.
    So basically there is not much of a relationship.
dangets··on HotSpot compiler: Stack allocation prototype for C2
There is a JEP to support Java on windows on AARCH64.

http://openjdk.java.net/jeps/8248496

dangets··on Ready for changes with Hexagonal Architecture
Microsoft also published a good series of articles on DDD / CQRS / Hexagonal architectures [1]. I especially like the diagrams of dependencies between layers on that linked page.

[1] https://docs.microsoft.com/en-us/dotnet/architecture/microse...

dangets··on The general value of typed functional programming lies in leaving no edge cases
Kotlin will do exhaustive checks in a `when` block when it is an expression. You can add a `.let { }` at the end of the when statement if you want to enforce this and not really return anything.

    sealed class Communication
    data class Email(val emailAddress: String) : Communication()
    data class Shouting(val preferredName: String) : Communication()
    object HiveMind : Communication()

    fun exhaustiveWhen(comm: Communication) {
        // not exhaustively checked (will compile)
        when (comm) {
            is Email -> println("sending email to ${comm.emailAddress}")
        }

        // *is* exhaustively checked (error at compile time)
        //  must add HiveMind or 'else' branch
        val result = when (comm) {
            is Email -> println("sending email to ${comm.emailAddress}")
            is Shouting -> println("HELLO, ${comm.preferredName}!")
        }

        // *is* exhaustively checked
        when (comm) {
            is Email -> println("sending email to ${comm.emailAddress}")
            is Shouting -> println("HELLO, ${comm.preferredName}!")
        }.let {  }
    }
dangets··on Ask HN: Which are the best resources to learn software architecture?
I am currently a big fan of the hexagonal architecture which is pretty close to what you describe as far as layering.

https://blog.octo.com/en/hexagonal-architecture-three-princi...

https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-a...

I also advocate for packaging by feature rather than layer (each feature defines its layers)

https://hackernoon.com/package-by-features-not-layers-2d076d...

dangets··on Understanding Serde
This is where I would either a) create 2 separate DTO representations with adapters to the internal domain object or b) have a trait which the 2 specialized structs implement. This conversion point is also a good place to do your validation that the object is in a consistent state. This isn't quite zero-cost - but it does isolate your external serialization code from your internal logic and it is easier to add even more formats in the future.

And at least in Java-land is much cleaner than stacking lots and lots of annotations on the same struct.

dangets··on Fixing a Small Calc.exe Bug
I've also been extremely pleased with their acceptance, communication, and turn around with bugs filed on the mssql-jdbc driver. Code is typically fixed and new versions published fairly regularly. I hope they keep it up.

https://github.com/microsoft/mssql-jdbc

dangets··on The Tragedy of Given-When-Then
This point is brought up in the book Domain Modeling Made Functional [1] where the author contends that F# types (including functions) is readable to BA folk and this will help the communication barrier between them and devs. I highly recommend the book and agree with that statement at the highest level, though I could see actual implementation details going out into the weeds (result & async types etc).

I know other functional languages like Idris take this approach too where the designers could declare the input/output types and as long as the implementation conforms, you have some higher confidence in program correctness (at least API contractually). Interesting stuff.

[1] https://pragprog.com/book/swdddf/domain-modeling-made-functi...

dangets··on Lombok makes Java cool again
I've heard it makes Kotlin integration a pain also if you are ever planning on that. If your Kotlin code depends on Java lombok classes, the compiler fails. Most people probably don't have this concern, but IMHO a mixed Kotlin-Java project is better than any of the current 'data class' libraries available for Java (Lombok, Immutables, Joda-Beans, AutoValue) ... ymmv, and I'm eager to see what comes of the "data classes in java proposal".

https://cr.openjdk.java.net/~briangoetz/amber/datum.html

dangets··on Lombok makes Java cool again
Yep. I love data classes for the simplicity and utility but pretty soon there are more annotations than java code. In Java I prefer Immutables over Lombok but once you add Jackson annotations, customize the Immutables generated code (@Value.Immutable, @Value.Parameter, etc), add some javax.validation (@NotNull, @NotEmpty) it gets very noisy very quickly. And yet it is still better than writing mutable bean classes by hand IMHO.

Switching to / mixing in Kotlin is worth it just for the data classes at this point (and you get some type-level nullability and `val` instead of `final var` to boot).

https://immutables.github.io/

dangets··on Android: The word Google didn't say during the Pixel 3 event
There was a recent blog post following KotlinConf 2018, saying 27% of top 1000 google play apps use Kotlin. https://android-developers.googleblog.com/2018/10/kotlin-mom...
dangets··on How not to structure database-backed web apps: performance bugs in the wild
A coworker introduced me to Caffeine which I think shares authors with Guava's cache. Kind of a 2.0 /lessons learned iteration.

https://github.com/ben-manes/caffeine

dangets··on Tearing apart printf()
F# has statically type checked printf also. I know it's a completely different realm than C++, but still pretty interesting. https://fsharpforfunandprofit.com/posts/printf/
dangets··on Apple open-sources FoundationDB
For better or worse, many times UX is more important than functionality.
dangets··on Humble Bundle Books: Functional Programming
I liked this book - somewhat directed to using Suave (webserver), but provides the general purpose grounding and design while building towards a bigger project.

http://products.tamizhvendan.in/fsharp-applied/

dangets··on Data Classes for Java
True, but the constructor method is checked/validated at compile time vs. run time with the builder pattern. Not quite the same as your example, but Kotlin does have good syntax for copying data classes while only changing a single field - this could be used similar to your currying usage.

https://kotlinlang.org/docs/reference/data-classes.html#copy...

dangets··on AWS X-Ray – Distributed Tracing System
We've been instrumenting Zipkin in our environment over the last couple of months and it has been excellent to work with. While there are a couple of snags here and there, it is _amazing_ at how quickly it can bring bottlenecks and bad network calls to light.
dangets··on LibreStock – do-whatever-you-want stock photos
You might try Jamendo. Most (all?) of the music on that site is under Creative Commons license, but I'm not 100% sure if that captures exactly what you want.
dangets··on C3.js: D3-based reusable chart library
I don't think it should be too difficult (not saying that d3 doesn't have a learning curve). There are some examples on the d3 gallery that would probably be close.

http://bl.ocks.org/mbostock/4060606 http://www.trulia.com/trends/2011/09/house-hunter-by-day-not... http://prcweb.co.uk/circularheatchart/ http://bl.ocks.org/tjdecke/5558084

Heck if you point me to a stock dataset I could probably code up a simple example that you could tweak. (no promises though ;)

dangets··on The Case for Buying Technical Books
Thanks for your book by the way! I loved it. (and it also made me recognize your username, proving your appreciation/reputation argument) http://gameprogrammingpatterns.com/
dangets··on Ask HN: On Rob Pike's Concurrency is not Parallelism?
I believe the concept says to focus more on task-based parallelism rather than data-based parallelism.

In Go, it is easy to create multiple tasks/workers each with a different job. This is implicitly parallelizable - each task can (but doesn't have to) work within their own thread. The only time when the workers can't run in parallel is when they are waiting on communication from another worker or outside process.

This is opposed to data level parallelism where each thread is doing the nearly exactly same instructions on different input, with little to no communication between the threads. An example would be to increase the blue level on each pixel in an image. Each pixel can be operated on individually and be performed in parallel.

So - the push is for more task-based parallelism in programs. It is very flexible in that it can run actually in parallel or sequentially and it won't matter on the outcome of the program.

← PreviousPage 3 of 3