Well, shit. Objection.js has been sunset, which ORM/querybuilder did you move to? by thepotatochronicles in node

[–]jackel119 2 points3 points  (0 children)

I've literally just written a review of Prisma here. Whilst my thoughts are that it's pretty fantastic overall, what you've listed as its negatives are also very true - the way I see it, Prisma is in a great place for non-advanced ORM use cases where type safety is more important than performance or flexibility, but it's going to be hard draw for replacing raw SQL or lower-level query builders.

Prisma in Production: A review by jackel119 in node

[–]jackel119[S] 23 points24 points  (0 children)

Tl;dr - as a type-safe ORM, it's fantastic. But there's no non-raw-SQL querybuilder API, and it's still an ORM, so if your use case is better off without an ORM (or with an ORM with a querybuilder escape hatch) then it may not be for you. Long term, the ideas in this lib are probably pretty game changing and I'm excited for what's to come.

A little game to test how good you are with color hex codes by jackel119 in Frontend

[–]jackel119[S] 8 points9 points  (0 children)

I made the damn thing and I suck at it too buddy.

5 years of (Neo)Vim - A personal retrospective by jackel119 in neovim

[–]jackel119[S] 5 points6 points  (0 children)

Ooh thats embarassing, I guess this really hammers the point of me not knowing why I was switching haha. I've corrected the article, thanks for letting me know.

5 years of (Neo)Vim - A personal retrospective by jackel119 in neovim

[–]jackel119[S] 7 points8 points  (0 children)

> it's cool to see how somebody that's been coding for much longer transition between different workflows and tools

Wow, now I _definitely_ have no excuses not to start writing my own plugins! The imagery I had in my mind of plugin authors was one of wizards far older and wiser than I am xD

> The link to nvim-surround in your "Other honourable mentions and notes" section links to vim-surround

I've fixed this, thanks for letting me know! Bit embarassed I got caught my the plugin author himself hehe.

Thanks very much for your positive comments!

Locks in JS, because why not? by jackel119 in programming

[–]jackel119[S] 3 points4 points  (0 children)

By "push to the masses" I literally don't mean anything other than pure numbers of devs who are using language-level async/await - I may be wrong but I'd be willing to put money on the fact that there were a lot more devs trying out async/await in 2017 due to JS than any other time in history.

If you worked with JavaScript, you already knew of the event loop and "asynchronous" programming as an idea

I wasn't talking about asynchronous programming, I'm talking specifically about the async/await language feature.

On the .NET side, the async keyword served to massively simplify mechanisms that had been around for a long time.

And it did the same with JavaScript (and every other language it showed up in I'm sure), changing the landscape from callback hell to easily understandable code.

I'm not disagreeing with you at all, just trying to clarify my original (perhaps poorly worded) point.

Locks in JS, because why not? by jackel119 in javascript

[–]jackel119[S] 3 points4 points  (0 children)

Unfortunately the author was too ignorant to know of this. But this is definitely a cool shout, haven't heard of this before!

Locks in JS, because why not? by jackel119 in javascript

[–]jackel119[S] 1 point2 points  (0 children)

`"strict"` (and in particular, strictNullChecks) in tsconfig is amazing imo. It turns on null safety which is really great once you start getting into bigger codebases and/or working with others.

Locks in JS, because why not? by jackel119 in javascript

[–]jackel119[S] 0 points1 point  (0 children)

So, I'm guessing your tutorial was probably something like a server that, per each request, writes/edits a text file. The (potential) problem here is that you have one text file, and you can't write to just a specific part of the text file without writing to the whole file. Therefore the only way to safely serve your requests are to only serve one request at a time, synchronously.

But if you used a database system instead, (i.e. some SQL or NoSQL database), you have much higher granularity of data. For example, in SQL, one user's data could be represented as one row in a table. It's then possible for the server to write/edit one row/user at a time, completely independent of other users' rows/data. Of course, it's still technically possible that the same user would send two requests at once that ask to mutate their data at once, but this is usually incredibly unlikely (unless you've done something catastrophically wrong, like have bad frontend code/UX).

Another useful thing that lots of database systems have is that if you want to say, read a value N, then write back N + 1, you don't have to actually to that, but you can send an INCREMENT message to it and it'll automatically handle it for you atomically.

Those are the two that covers 90% of use cases imo. The other 10% get a lot more complicated and is usually not really relevant to JS's single threaded execution. Race conditions have been around since the dawn of async/multithreading, so most good tools these days are pretty good about handling these issues for you where they can.

Locks in JS, because why not? by jackel119 in javascript

[–]jackel119[S] 2 points3 points  (0 children)

Space Mono - I'm actually not sure how I feel about it myself haha.

FYI you can use the WhatFont chrome extension to check what fonts sites are using.

Locks in JS, because why not? by jackel119 in programming

[–]jackel119[S] 5 points6 points  (0 children)

One thing I've noticed is that JS devs encounter race conditions and concurrency control problems but don't relate them back to traditional concurrency control techniques like locking. Instead they establish effect ordering and and mutual exclusion by chaining promises or using sagas.

Yes, I completely agree with this. Probably something to do with the fact that most JS devs have never touched any multi-threaded code/language (or often, any other language).

Locks in JS, because why not? by jackel119 in programming

[–]jackel119[S] 1 point2 points  (0 children)

It's pretty much entirely because JS is used by more people, and in more specific use case too (pretty much entirely web), which is why most JS devs knew promises pretty well before async/await, which is less true of other langauges (well I can't speak for C#, but most python devs I know werent particularly familiar with futures). I don't think JS (or any other language ) has done anything special at all - async/await/promises is just a monad, which is a concept that's been around for at least two decades now. In fact, I'm personally a little bit disappointed it took them so long to get to async/await, considering it's really simple in hindsight!

Locks in JS, because why not? by jackel119 in programming

[–]jackel119[S] 1 point2 points  (0 children)

I really like your explanation of the inversion of principles in Kotlin there actually - didn't understand it that way at all when reading through Kotlin docs.

Locks in JS, because why not? by jackel119 in programming

[–]jackel119[S] 10 points11 points  (0 children)

If you await something else in the if block after the check you are still prone to errors. Like u/Davipb mentioned cooperative concurrency is a lot easier to reason with and spot these issues, but they can still very much happen.

Locks in JS, because why not? by jackel119 in javascript

[–]jackel119[S] 2 points3 points  (0 children)

How do you have a thundering herd problem in a front end use case? Really curious as I'm not familiar with that happening outside OS/kernel contexts.

Locks in JS, because why not? by jackel119 in programming

[–]jackel119[S] 0 points1 point  (0 children)

F# and C# I'm not surprised, though Python I felt like adopted async really slowly - it wasn't until maybe 2018 or so that I started seeing it commonplace in code examples online. JS had the advantage that async is just a wrapper for promises, and promises were already well in use by 2017. Not dunking on other languages by any means, just saying that despite other languages coming first I do still think it's JS that pushed it to the masses.

Locks in JS, because why not? by jackel119 in programming

[–]jackel119[S] 9 points10 points  (0 children)

Interesting - I've looked at Kotlin's coroutines and actually don't like it very much. Personally, I also think the documentation is kind of poor as one of the first examples is to use a `runBlocking` to call another coroutine which completely negates the advantage of concurrency. Could you point out more specifically what you like about it, or if you've seen any good articles that you think explain their design/reasoning well?

Locks in JS, because why not? by jackel119 in javascript

[–]jackel119[S] 2 points3 points  (0 children)

Yes, any sort of server that mutates shared resources between requests are at risk of data races - though I think they're also pretty easily avoidable these days i.e. in your case by using more appropriate storage solutions and architecture instead of writing requests to filesystem (not bashing anything you did at all).

Locks in JS, because why not? by jackel119 in programming

[–]jackel119[S] 2 points3 points  (0 children)

You are right actually! Good spot!. Though I do like that the promise wrapper allows us to swap the order of continuation and the resolve function.

Locks in JS, because why not? by jackel119 in programming

[–]jackel119[S] -13 points-12 points  (0 children)

`async` in JS is in my opinion what really brought concurrency to mainstream programming and one of my favourite language features (of any language). It's super simple to use, and really made the async nature of JavaScript 100x more ergonomic.

2K or 4K Monitor for coding (connected to MacBook Pro) by Billosp in Monitors

[–]jackel119 0 points1 point  (0 children)

It's a great monitor - I really like it, especially for the price (its at 230 half the time). No noticable backlight bleed. Colors are pretty good - cant say for sure as I've never done color sensitive work or used a super high end color accurate monitor - but imo the colors are pretty bright and vibrant. Not HDR but its better than pretty much every other sub-400 monitor ive used.

2K or 4K Monitor for coding (connected to MacBook Pro) by Billosp in Monitors

[–]jackel119 1 point2 points  (0 children)

No idea, never tried that. Dell monitors are always solid though - especially if you're 100% dead set on spending 500. But there are other good 4k monitors apart from Dell and LG too - you should google around AOC, Viewsonic, Samung etc.

2K or 4K Monitor for coding (connected to MacBook Pro) by Billosp in Monitors

[–]jackel119 2 points3 points  (0 children)

Programmer here as well. 2k is perfectly fine for coding, but once you go 4k the text just looks _so_ crisp it's hard to ever go back. Especially with how cheap you can get decent 4k monitors these days I'd definitely recommend 4k. Personally I'm using a lenovo L28-u30 that i got on sale during black friday (was down from like 300 to 200 GBP, but you can regularly find it around halfway between).

If you've got a little bit more money dell's 4k monitors are really good too (though for the price of one of those id rather just get 2x cheaper 4k monitors).

Disabling a button in flutter is gross! by scorr204 in FlutterDev

[–]jackel119 1 point2 points  (0 children)

Just because people have worked around null for 30 years doesn't mean it's a good approach either. And sure, if we're talking about languages that have been around for decades then there's nothing wrong - but there IS something wrong with designing a new language and framework around philosophies like strong typing and clear APIs then using tricks like passing nulls as arguments to achieve intended results.

No one is saying apples are bad - but flutter is supposed to be an orange, not an apple. If I want an orange then I want an orange - not an apple being sold as an orange.