4 ms·
I'm not sure you can call one or the other "better". Python is more type safe due to run time type checks (less lolwut). Also, less typing. But, you also get t
by winrid 3y ago
I'm not sure you can call one or the other "better".
Python is more type safe due to run time type checks (less lolwut). Also, less typing. But, you also get the Django ORM which is great for productivity (good for complex but low volume apps).
JS has some great features: async/await, deconstructing objects, nice JIT, same language as in browser. However, it's also very lisp-y, which is a pro and a con :)
- andrewstuart 3y ago>> I'm not sure you can call one or the other "better". I should have said "better for ME". >> you also get the Django ORM I decided the best way (for me) to write back end application is: * typescript * nodejs * postgres * plain old SQL I realised I hate using ORMs and much prefer the raw power and directness of SQL. Postgres is an incredibly powerful database - I find it's a problem to have any sort of abstraction between me and the DB. And honestly typescript is a real pleasure to write. I still use Python extensively for other stuff, but for web servers, typescript/node/postgres is my preference.
- winrid 3y agoI found the best way for me to write backend applications is with an ORM. Because SQL is super slow to write. The exception is sqlx in Rust when I want something super correct.
- andrewstuart 3y ago>> Because SQL is super slow to write. ChatGPT writes SQL incredibly well - presumably because there is so much training material out there. Seriously, ChatGPT is the single best reason to change your architecture away from ORM to plain SQL.
- winrid 3y agoThat's interesting. But no. I can write queries so fast with the Django ORM it's silly. Especially dealing when dealing with relationships... Pycharm will auto complete like 4 levels of joins in two seconds. That's faster than you tabbing to chatGPT let alone writing the prompt.
- Lukas_Skywalker 3y agoWriting the code is only part of the equation though - especially if you are not very fluent in SQL. I imagine it gets annoying quite quickly if you need to ask ChatGPT what different fragments of SQL do 6 months after you have generated them.
- PrimeMcFly 3y agoAh. So you're not writing the SQL, ChatGPT is. Yeah, no thanks. I'll stick with Django.
- andrewstuart 3y agoSounds like you still see ChatGPT as a bad thing in some way. I can almost hear the subtext "AHA GOTCHA! you don't understand the code being written!" ChatGPT is a programming assistant - it is an advantage that assists in your programming. You still have to understand the code, and more often than not you need to debug it and refactor it to make it work or make it work nicely. If you are not using ChatGPT as a programming assistant then you're wasting time and doing yourself a disservice.
- PrimeMcFly 3y ago> Sounds like you still see ChatGPT as a bad thing in some way. Not really, it can be a useful tool, I'm not ready to just delegate all my code writing to it and no professional developer should either. You're talking about using raw SQL because it's "closer to the metal" (it isn't really), but then really you're just using ChatGPT to write your code so in a way, you're much further removed from the metal than framework developers. If I had to choose between an OS written in C++ by skilled humans vs an OS written in ASM (because it's 'closer to the metal') by someone who had ChatGPT write most of the code and "checked" it, I know which I'd choose.
- switch007 3y agoDo you ever find yourself building utility functions etc which start looking like a lightweight ORM?
- andrewstuart 3y agoNope. Always raw SQL. I move the SQL statements into minimal functions that live in their own files to separate them out from the code as much as possible.
- PrimeMcFly 3y agoI'd be curious how your apps stand up to a WAPT.
- golergka 3y ago> Python is more type safe due to run time type checks How could Python's runtime type checks be more safe than Typescript's completive type checks? Nobody sane uses typeless Javascript for serious business logic now anyway.
- winrid 3y agoFastComments main backend is around 200k lines of plain JS. I do extensively use JSDoc however.
- winrid 3y agoAlso, TS type checking is not at run time (with NodeJS). So some library could allow unsanitized data as a wrong type etc. at least with Python it'd fail fast.
- golergka 3y agoLibraries like io-ts make it trivial to write type definitions once and use them both for both static and runtime checking.
- winrid 3y ago> Libraries like But this is already solved by so many other runtimes... Without a library..
- golergka 3y agoThat's why I love js ecosystem. If something is implemented in language itself, runtime or standard library, it will never meaningfully develop.
- winrid 3y agoIt doesn't need to be developed... An int isn't going to store a String in Java because of a bug, that doesn't require further development.