• 0 Posts
  • 8 Comments
Joined 1 year ago
cake
Cake day: July 3rd, 2023

help-circle

  • If you’re using a manually managed venv, you need to remember to activate it, or to use the appropriate Python.

    That really doesn’t seem like a big ask.

    I’ve been using python professionally for like 10 years and package management hasn’t really been a big problem.

    If you’re doing professional work, you should probably be using docker or something anyway. Working on the host machine is just asking for “it works on my machine what do you mean it doesn’t work in production?” issues.


  • I don’t know how to use vscode. In general in Python you can do breakpoint() and your code will pause there and become interactive. If you’re running in docker you’ll want to attach to the container. When it hits the breakpoint you basically drop into a normal python repl with extra features.

    https://docs.python.org/3/library/pdb.html

    This is really, really, good for debugging and developing. You can interactively examine stuff and try stuff right there. You don’t have to rerun the whole thing to be like “ok what’s the second item in the list? Is this syntax right to sort it?” or whatever you’re trying to do

    I use pdb++ for syntax highlighting and some other qol features, too.






  • It has a lot of gotchas and an unstable ecosystem.

    A lot of basic stuff is confusing of weird. How do you loop over an object? There’s like five ways. How do you declare a function? There are two very different ways that behave differently, and the new one has like five variations in its syntax that can throw you.

    Here’s an example of something that continues to bother me:

    const foo = "hello";
    const bar = { foo: "world"}
    

    What do you think bar looks like? If you thought it had a key of “hello” and a value of “world”, that’s sensible but wrong. It has a key of “foo”. Object keys don’t need to be quoted in JavaScript. If you want the key to be a variable you have to write it like { [foo] : "world" }. Which looks like a list.

    There’s a lot of this kind of stuff in the language. Small things that once you know you can work around, but are still weird, annoying, and prone to causing errors.

    The standard library historically hasn’t been very good. This has lead to many libraries being maintained by the community. But the community is fickle, and the quality of libraries is not guaranteed.

    The standard library was bad at some basic operations, so underscore was created. But then someone made lodash, and most people (but not everyone!) moved to it. But then the standard library caught up some more, so maybe you don’t need either? When you start working on a new-to-you project you don’t know what you’re going to get.

    Dates were a mess so momentjs got big, but now that’s deprecated. Move to datefns, which has a completely different interface.

    Node releases a new major version every six months. Every six months! Python has been on major version 3 for years and has no plans for a version 4, for comparison. The constant version releases is a potential source for headaches.

    In my experience many libraries are kind of fast and loose with major releases, too. It can be a pain to keep up, especially if you have peer deps.

    The debugger is kind of bad. Sometimes it will pause but you typically can’t like treat it like a repl. Python’s, for comparison, blows it out of the water.

    Many things are async in JavaScript. Sometimes you don’t expect a particular call to be async or you forget, and you have a bad time. The async/await keywords were a godsend. The giant stack of “then…then…then…” was not fun. Combine with the weak debugger and you have an extra bad time. I bet there are a lot of console.log(“code is here”) debug calls out in the wild because of this.

    For your actual front end view layer, react is the current hotness. But older projects are still out there with angular, backbone, probably some with just jQuery. React isn’t terrible but how long is it going to be king? What breaking changes are they going to put out in the next version? The ecosystem is unstable.

    Also redux kind of sucks. Not a fan of global variables. I think the community has moved on from redux though? Again, the ecosystem is unstable.

    In my experience there are many developers who only know JavaScript, and they want to use it for everything. It is the dungeons and dragons of languages. Much like how it is frustrating when your friends want to run a cyberpunk murder mystery in Dungeons and Dragons, it can be frustrating when your team wants to write everything, even your backend, in JavaScript.

    We had browser tests at one job. They’re a very synchronous thing. Open the browser, load the page, enter name and password, wait for login. We had all of this written in python working fine, but people wanted to switch to a JavaScript toolset. Sorry, I mean they wanted to switch to JavaScript but there were three different browser testing tools the different teams wanted to use. Because the javascript ecosystem is like that. After a more candid talk with one of the guys I knew personally, he admitted it wasn’t because JavaScript was the best tool but rather he didn’t want to use python.

    I can’t authoritatively say this is typical, but in my experience I’ve had a lot of resistance from JavaScript devs using other languages. Again, I think it’s like DND. DND is a unnecessarily complicated game full of exceptions and gotchas. If that’s what you learn first, you probably think everything is like that, and why would you want to go through that again? But of the popular languages/games, javascript/DND are exceptional for their weirdness.

    In fact, thinking about it for more than a minute, my current team lead is a JavaScript main and he’s great. Super willing to learn other languages and has never been pushy. So it’s definitely not everyone.

    The stack traces tend to be kind of bad. In production shit is probably minified so you might get “error on line 1, column 4737373”. In other contexts you may get a few hundred lines of node_modules to sift through before finding your actual code.

    At least jest and (react) testing library aren’t bad. Mocha + chai were annoying. Enzyme is not great. Again, things change rapidly. You might join a company and find they’re still using mocha and enzyme, and switching never gets prioritized. If JavaScript made things better without breaking changes or swapping to an entirely new toolset it wouldn’t be a serious problem, but the standard mode seems to be “fuck it let’s make an entirely new tool”.

    The lack of type hints isn’t great. You can use typescript but that’s a whole new set of stuff you have to set up. Python also doesn’t have types but they managed to add them as an option without making us switch to like TypeThon. But that’s not the JavaScript way. If you’re not making a breaking change are you really doing JavaScript?

    I could go on, but my cat is getting up to some bullshit and I need to see what he’s screaming about. Probably not JavaScript.

    tldr:

    • standard library kind of bad
    • ecosystem unstable and of variable quality
    • unpleasant personal experiences with JavaScript developers wanting to use it for everything