Hacker Newsnew | past | comments | ask | show | jobs | submit | more BiteCode_dev's commentslogin

I though I was good at starcraft before going to Battlenet, and I though I learned I wasn't.

But last year I went to play HOMM3 online, and I imagined I could at least teach the kids a trick or two.

I was so wrong.


It's literally a completely different game from "normal" HOMM3 now, really.

It's interesting watching playthroughs, and seeing the tricks used, but it's not quite the game I played 20 years ago.

I did pick up some positioning tricks and tips.


Every time this is mentioned, the person is heavily downvoted.

But if you were here in the 2000, that's exactly what happened.

In fact, this very article starts with "JavaScript, the undisputed king of web development, is being sabotaged — not by a rival language or a revolutionary new technology, but by its own baggage from the past.". That's the first sentence.

Nobody wanted to work with JS, it was used to make snowflakes on your home page on Xmas at best.

Then things like gmail happened (using GWT!), and the web became the most awesome platform in the world. By then it was too late, JS was the de facto language of the coolest tech of human history.

It was such a trap Google spent billions and hired the best minds out there to make chrome, with a VM that could execute it fast enough, so the company could make its vision happen.

At the time, JS was a nuisance and an embarrassment, something we had to deal with. The "good parts" was the bible because it's a language you could only use if you ignore half of it.

Case in point, the most popular JS techs created after that existed precisely to avoid writing ES5. Like coffeescript, babel, webpack, etc.

JS is a decent language now, because the community invested so much into it. Provided you use tooling. A lot of it.

But that's not how it started. We were forced to use it, and had to spend considerable resources to make up for how bad it was.

I've yet to met anybody who knows Python/Ruby/C#/Java/Rujst/Go and JS to chose JS outside of the web. Because there, we have the choice.

Electron, unfortunately, might take a chunk of that choice, because once again, the browser platform is that great.


The most telling part of this comment is that you omitted PHP.

And the parent comment mentioning VBScript is the other half. VBScript was equally terrible.

Imagine a world where every interpreted runtime used Lisp. Or UCSD Pascal.

People would be here saying "this was forced on us!" And wishing that browsers ran MIPS assembler they could target with their new language of choice.


> I've yet to met anybody who knows Python/Ruby/C#/Java/Rujst/Go and JS to chose JS outside of the web. Because there, we have the choice.

Pleased to meet you! Isomorphic code bases are a case to use a single language, which before WASM, is Javascript & Typescript. I may prefer to use something different with WASM, which has even more interoperability than JS, becoming a bigger part of the ecosystem, but so far it would be Assemblyscript to more easily migrate my existing codebase. Assemblyscript has a Garbage Collector, so I may choose Rust or Zig if I don't want the GC. Rust probably has the most momentum, so despite the complexities, verbosity, & loss of productivity working with Rust, that may be a better choice when working with WASM. I would prefer Zig over Rust & Assemblyscript over both in cases of app development...but breadth & depth of the ecosystem matters.

I wouldn't touch PHP, Python, Ruby if I had a between using Typescript...as PHP, Python, & Ruby lack a decent static type system.

> Nobody wanted to work with JS, it was used to make snowflakes on your home page on Xmas at best.

I disagree. Javascript is a prototype based language, which provided opportunities for composition over inheritance. JS supported closures from it's beginning while other popular languages did not (well Ruby had limited support for closures). Inheritance & other OO concepts now considered harmful were prevalent with Java, C#, Ruby, Python, etc.

Sure, we could have used LISP instead, but for some reason LISP did not gain traction. JS was the closest programming to LISP which had popular appeal.

I suggest that JS changed the general programming ecosystem in profoundly positive ways & I, for one, preferred developing in JS over the other popular alternatives when I could.

To further bolster the case for JS, Typescript was built as an extension on top of JS, proving you can have the dynamic prototype based runtime with a powerful static type system.


I'd willing work on it nowadays, Node is really fast. Deno is really fast too, and TypeScript makes it pretty amazing to work with.

I think the ecosystem needs love again, because outside of Fastify I feel like server side JavaScript that isn't targeting a Lambda or Cloudflare worker type environment is a little spare of good options.

That said, Fastify is pretty amazing, and if you use graphql the main GQL servers are usually Apollo (JS based) or GraphQL Yoga (Also JS based), and they're really good.

One area that intensive JavaScript needs work on though is Machine Learning / Scientific computing. `number`, `BigInt` and `Math` aren't enough here. We need more built-ins added to the language around this (particularly around `Math`) IMO


> But if you were here in the 2000, that's exactly what happened.

That was 23 years ago.

It's an entire generation. A baby born after that point could now be working as a fully fledged adult.

> I've yet to met anybody who knows Python/Ruby/C#/Java/Rujst/Go and JS to chose JS outside of the web. Because there, we have the choice.

I would. Typescript is easily the best language for anything from app development to small projects and has been for years now. If you're bringing up Go/Rust, then TS has been incredibly good in that timeframe. Before that there was Pythong+Django and Ruby/RoR back when we did SSR, and Java applets or flash before that.


>> But if you were here in the 2000, that's exactly what happened.

> That was 23 years ago.

> It's an entire generation. A baby born after that point could now be working as a fully fledged adult.

And yet, it's no less true.

Regarding typescript, that's just, like, your opinion man. I mean, I think typescript is pretty good, especially given that its tied to the design choices of javascript, but objectively the best language. That's way too far.


> I've yet to met anybody who knows Python/Ruby/C#/Java/Rujst/Go and JS to chose JS outside of the web. Because there, we have the choice.

You probably haven't met many people. For backend you can choose any language, yet a lot of people (with knowledge of many languages) choose JS/TS. I'm one of those.

I enjoy TS more than python.


You’re not wrong at all.

But the parent lost complaining that JS exists at all is not really productive to a discussion about what effects JS today.

The “JS should have been something else” ship sailed a VERY long time ago.

It’s like people who go into C++ threads and complain it wasn’t rust from the start. That’s nice. But rust wasn’t there at the time.

It’s not useful for discussion.


You mean softwares VLC, Linux, Python all came out of a monopoly position?

Or maybe you mean great greater than life concepts like the press, the Web or vaccines have been invented by big monopolistic entities?

Or do you mean unicorns like Google, Amazon and Facebook were born out of monopoly?


Managing multiple windows, copy/pasting, using shortcuts from muscle memory and things like instant middle mouse click are terrible experiences on any tablet or phone.

Just opening a new tab on a browser is tedious, and if you deal with a lot of intranet tools, this is the very basics of productivity.


> terrible experiences on any tablet or phone

It sometimes feel like an unspoken taboo, but windows tablets are a thing. Or Chromebooks if there is a strong need for mobile app support.


> using shortcuts from muscle memory

This statement is true if you use any machine other than the one you are used to, so this makes little sense. My Windows shortcuts and Linux shortcuts do not match my MacOS shortcuts. I have to use all three OSes at my job.


Well yeah, but consider that Apple has complete control over both systems. I also bought into the ‘iPad for days full of meetings’ idea and found that if I can’t reliably cmd-tab and browse through some files in a non-iCloud folder the whole experience is garbage. The fact that they bolted on some MacOS features afterwards only makes it all the more ludicrous that they didn’t go for parity from the moment they started with those shitty plastic keyboards.


>Just opening a new tab on a browser is tedious

There is a persistent top-level button in Safari's toolbar to open a new tab. I don't know how tedious that is.


I was wondering was was this for Rust.

Then I realized with maturin, that was Python :)


Nice. I should use a similar id with ULID.

Although, if stored in a DB, I would probably split the tag and the id in 2 separate columns, because DBMS often have a dedicated efficient UUID field type.

A little client code wrapper can make that transparent.


That's more of a cultural thing. Because Python is easy to get into, and you can be productive very fast, a lot of people with little experience in programming start to build things that are out of their reach.

They just don't know it, and the people hiring them don't either.

It's not a new phenomenon, we got the same when Java arrived, then PHP, etc.

Every time something makes things easier, you get a wave of beginners set to create things they are not qualified to do. And because you now need software for everything, leaders also get into positions where are not qualify to make some decisions about it. You pair unqualified leaders with unqualified devs, and you get this.

And it's now easier than ever to be in this position, also you are more pressured than ever to get into this position.

I've worked on plenty of big Python systems myself, it's not the tech per se (it has the usual pros and cons game like every language), but Python is the language used "when you don't know programming".

Which is ironic, because when I started to use it in Python 2.4, only passionate devs used it because it was niche, and we had the opposite effect.


> Every time something makes things easier, you get a wave of beginners set to create things they are not qualified to do. And because you now need software for everything, leaders also get into positions where are not qualify to make some decisions about it. You pair unqualified leaders with unqualified devs, and you get this.

How easy it is to call other people not qualified because they have different opinions.

I've seen more projects failed because the only thing the devs cared about was an abstract code correctness, which made even basic PRs getting polished for weeks. I don't think you need to worry too much about types or tests if you are just doing a prototoype to validate ideas or your user base is 0.


It is BASIC all over again.


I get where the author comes from, but my definition of simple doesn't include anything with the word "smart" in it.

I have simple watches. They are casio.


I have an Auriol. (I don't know for certain, but I like to imagine the brand is named after French rally driver Hubert Auriol.) It has a monochrome face, twelve simple hour demarcations, and two hands.

In its own way(s), that is actually quite a smart watch.


It also uses the file as a module, not a script, which means suddenly relative imports works the root dir and the cwd are the same, and it is added to sys.path.

This prevents a ton of import problems, albeit for the price of more verbose typing, especially since you don't have completion on dotted path.

It is my favorite way of running my projects.

Unfortunalty it means you can't use "-m pdb", and that's a big loss.


> which means suddenly relative imports works

Not just relative imports but also (properly formed) absolute imports. For example, if you have a directory my_pkg/ with files mod1.py and mod2.py, then

    # In my_pkg/mod2.py
    import my_pkg.mod1
will work if you run `python -m my_pkg.mod2` but will fail if you run `python my_pkg/mod2.py`

However, the script syntax does work properly with absolute paths if if you set the enviornment variable `PYTHONPATH=.` (I don't know about relative paths - I don't use those). That would presumably allow pdb to work (but, shame on me, I've never tried it).


I also develop and run projects this way. I really, really enjoy it. It's a very pleasant experience, on both the development side and execution side.

I'm relatively new to Python (used it for ~1 year in 2007/2008, again briefly in 2014 -- which is when I believe I picked this module trick up -- and then didn't touch it again until March of this year). It's made an impression on my team and we're all having a good time developing code this way. I do wonder, though, what other shortcomings might exist with this approach.


You can use pdb

Just

python -m pdb -m module


Damn, 15 years of python and I learn you can use -m twice. I've never even tried, didn't occur to me it would be supported.

EDIT: it support other options as well, like -c. That deserves an alias:

    debug_module() {
        if python -c "import ipdb" &>/dev/null; then
            python -m ipdb -c c -m "$@"
        else
            python -m pdb -c c -m  "$@"
        fi
    }


There's no magic, only layers. `python -m pdb <args>` runs pdb with the rest of the arguments. pdb handles the second `-m`.

If you have a fancy IDE feature, open a new python file, type "import pdb", use go to definition on pdb to jump to that file in the standard library, and read its main function - it handles -m explicitly :)


Speaking of pdb.. maybe someone knows why pdb has some issues with scope in its REPL that are resolved in VSCode's debugger and PyCharm?

Multiline statements are not accepted, nor things like if/for

Even list comprehensions and lambda expressions have trouble loading local variables defined via the REPL

Are there workarounds? It would reduce the need for using IDEs. People who have experience with Julia and Matlab are very used to a trial and error programming style in a console and bare python does not address this need


Not supporting multi-line statements is just because pdb doesn't bother to parse the statement to work out if it is an incomplete multi-line statement. That could be easily fixed (I have a prototype patch for that using `code.compile_command`).

The scope problems are more fundamental:

The pdb REPL calls[1] the exec builtin as `exec(code, frame.f_globals, frame.f_locals)`, which https://docs.python.org/3/library/functions.html#exec documents as:

"If exec gets two separate objects as globals and locals, the code will be executed as if it were embedded in a class definition."

And https://docs.python.org/3/reference/executionmodel.html#reso... documents that:

"The scope of names defined in a class block is limited to the class block; it does not extend to the code blocks of methods - this includes comprehensions and generator expressions since they are implemented using a function scope."

This is a fundamental limitation of `exec`. You can workaround it by only passing a single namespace dictionary to exec instead of passing separate globals and locals, which is what pdb's interact command does[2], but then it's ambiguous how to map changes to that dictionary back to the separate globals and locals dictionaries (pdb's interact command just discards any changes you make to the namespace). This too could be solved, but requires either brittle ast parsing or probably a PEP to add new functionality to exec. I'll file a bug against Python soon.

[1]: https://github.com/python/cpython/blob/25a64fd28aaaaf2d21fae...

[2]: https://github.com/python/cpython/blob/25a64fd28aaaaf2d21fae...


Oh, and multi-line statements will be supported from Python 3.13 (https://github.com/python/cpython/issues/103124)


There are not workaround, pdb is a rustic tool.

Since I still enjoy a cmdline debugger more than a graphical one, I use ipdb, which doesn't suffer from the multiline limitation.

However, scoping issues with lambda and comprehension are actually a Python problem, not a pdb problem.


After triggering pdb by having "breakpoint()" in tour python code and dropping in the debugger you can type "interactive" in the console to enter multiline strings.


TIL again. Very good thread!

It's "interact" though, not "ive".

You can exit it to carry on with the regular pdb.


Thanks. I make that mistake every time I use it:)


to be fair, it was only added in 3.7


Like whats the general usage though?

python -m http.server is the most I have done.


-m pdb is post mortem debugging, it drops you in the debugger when it encounters the first unhandled exception. This is much easier than trying to pin point where to put a breakpoint.


I've always been curious how that mechanism works exactly what is it about that invocation technique that satisfies the relative imports? I think it changes the pythonpath somehow right in a way related to the module being ran, something like appending the basedir where the module is saved to the PYTHONPATH?


I've taken to adding a --pdb option to my scripts.


What does it do? Just `import pdb; pdb.set_trace()`?

Or `breakpoint()` after 3.7 (better because the user can override pdb with ipdb or other with `PYTHONBREAKPOINT`)?


Either breakpoint() or setting sys.excepthook to call the postmortem debugger.


You started with the worse ORM in existance.

There are ORM with good pros/cons ratios out there. Python has espacially good ones:

- Django comes with a clunky and poor performing one, but it's very well integrated, super practical, productive and has nice ergonomics.

- Peewee gives you an ORM in a small package, which makes writing those little programs a joy when you don't need anything fancy, but feel lazy.

- SQLAlchemy requires a lot more investment, but is very flexible, generates clean SQL and has extremely correct behavior. It also exposes a lower level query builder for when you don't want the OOP paradigm and wish to express idiomatic SQL behavior, but abstracted away with Python.

This becomes a standard engineering decision, where you analyze the ROI.


I absolutely hated having to deal with SQLAlchemy. It took me days to get through the ugly documentation to a level where I could more or less competently use it, and for what? The code is harder to understand than just writing SQL and the performance is worse. I have yet to learn of a single advantage of ORMs that don't boil down to developers not wanting to deal with SQL.


Currently have to use sqlalchemy on an existing project, and while I am not necessarily disagreeing with you on ORMs or performance, just wanted to add that chatgpt has been able to reduce my time fighting with their documentation by what I estimate of 90+%. To be fair, if I would have written pure sql, I might not have needed chatgpt at all, but i also would have to learn pythons database connector calls for the umpteenth time.


ChatGPT can write SQL too.


Yeah, the productivity and performance with the Django ORM is amazing. I have trouble using any other web framework now...

The thing people are missing is relations. The most important aspect of your application is how data is related to each other. A good ORM makes that easy.


+1 on that. Handling relationships like parent.child.other_children when writing your own SQL is not trivial at all.


Two join clauses in a statement is not trivial? We apparently have different definitions for "trivial".

But if you want hierarchy (in Postgres), to_jsonb(…) is your friend.


It's much, much slower productivity wise than using the orm. Like 10x slower.

Why TF would I use json? There's a reason I picked a relational database. Nonsense.


It's so nice to use, espacially in a shell.

And also such a performance trap.


Yeah, but once it's a performance issue you're making $$$ and you can add some indexes or write a little SQL in the few places that need it :P


Also child.parents[0].user.username :)


Ruby on rails with active record is absoutly amazing. and anyone who hasn't tried it, haven't used a great ORM


Elixir’s Ecto smokes AR all day and every day. I never want to go back.


I love it.


Doctrine sucks too. Glad I'm using Django.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: