loading...
Cover image for Top 5 DEV Comments from the Past Week
The DEV Team

Top 5 DEV Comments from the Past Week

peter profile image Peter Kim Frank ・1 min read

This is a weekly roundup of awesome DEV comments that you may have missed. You are welcome and encouraged to boost posts and comments yourself using the #bestofdev tag.

@kungtotte added some thoughts to the Github Must Be a Free Platform thread. The entire thread and surrounding context is worth reading more about:

The problem isn't that GitHub isn't free, the problem is that for some reason the open source community collectively decided that all development must occur on GitHub: a proprietary platform.

There are several alternatives to GitHub that you are able to self-host that would not be subject to US law (hosted out of countries that don't sanction Iran), and even though it might be too much for a solo developer to do on their own the open source community should band together and fund efforts to spin up GitLab/Gogs/Gitea/Sourcehut instances in places that aren't subject to these sanctions.

This issue will happen with any service hosted out of the US, it's the laws that are broken in this case. Not GitHub.

In a thread destined for some hot-takes and disagreements: What’s the best JavaScript framework?, @dmtrkovalenko provided some hilarious misdirection and levity:

A "Change my Mind" thread can oftentimes go down non-constructive paths, so it was great to see @stereobooster 's comment and subsequent standalone article in response to TypeScript is a waste of time. Change my mind.:

UPD: I turned this thread into article dev.to/stereobooster/type-system-f...

Ok let's start constructive conversation by fixing some terminology: JS is typed language, it is dynamically-type-checked language (or some people short it down to dynamically typed). JS has types: string, number, bool etc. JS has type errors (not much, but still)

null.func // Uncaught TypeError: Cannot read property 'func' of null at <anonymous>:1:6

JS has implicit coercion, which may create impression that there are no types in JS. Read more here.

So the question of use or don't use TS boils down to: do you want to do static type checking or not? (Dynamic type checking always there). And there is a trade of: you need to write a bit more code (type annotations) in order to make static type checker work. It's up to you to decide if it worth it or not.

As well, you may be confused by soundness of type system. Some type systems are sound e.g. they can prove there are no type errors. TS is not sound (any type), but you can bulletproof it with tsconfig, by setting all strict checks to true. And by prohibiting usage of explicit any.

However, because TypeScript compiles down into JavaScript, regardless of how carefully designed your types are, there always is the chance that a different value type sneaks into a JavaScript variable.

You can make a bridge between static type system and dynamic type system. Check that type are valid dynamically on the input (which is unknown and uncontrolled) and rely on the static type checker through the rest of the programm

for example:

const makeSureItIsAString = (x: any) => {
    if (typeof x !== "string") throw new TypeError("Not a string")
    return x;
}
const nickname = makeSureItIsAString(userInput())
// we are sure that nickname is a string in this part of the code

read more about io validation here

Replying to What are your computer’s specs? Which specs are particularly important to you?, @steveblue talked about the choices for their set-up:

2.3 GHz Intel Core i9 w/ Turbo Boost up to 4.8 GHz
32 GB 2400 MHz DDR4 ✅
Radeon Pro 560X 4 GB
Sonnet eGPU w/ 8GB Sapphire PULSE Radeon RX 580 ✅
500GB Apple SSD ✅

I went for the second most powerful Apple MBP this time around. The most powerful configuration is overclocked and didn't want to mess with that.

Someone told me I wouldn't need 32GB RAM but so far it hasn't hurt!

SSD is essential. I was using an older computer w/o SSD for awhile and boy did I feel it while developing.

I can't recommend the eGPU enough. It drives my monitors so my MBP doesn't have to (and I only have to plug in one cable to dock my MBP). On top of that, I've found multiple apps will actually take advantage of it, including web browsers. This is a huge plus when I'm experimenting with WebGL. I can swap out the video card too whenever I want to upgrade.

A majorly awesome run for @desi who shared some incredible wins in the What was your win this week? thread 👏:

  • did a 10k with my partner!
  • celebrated the publishing of Your First Year in Code, which includes a chapter by me!
  • oh and got engaged ☺️☺️☺️💍💍💍

See you next week for more great comments ✌

Posted on Dec 7 '17 by:

peter profile

Peter Kim Frank

@peter

Doing a bit of everything at DEV.

The DEV Team

The team behind this very platform. 😄

Discussion

markdown guide
 
 

ahh thanks for featuring me! it was a wild (and amazing) week!