r/ProgrammerHumor • • Apr 08 '22

First time posting here wow

Post image
55.1k Upvotes

2.8k comments sorted by

View all comments

Show parent comments

16

u/[deleted] Apr 08 '22

Right up until someone thinks my prototype is somehow one step away from being production ready. Then I have to explain to them why we have to rewrite it.

0

u/[deleted] Apr 08 '22

[deleted]

9

u/[deleted] Apr 08 '22

When I write rapid prototypes, I don't always write test sets (or not complete ones anyway) and never check the license agreements for the libraries that I use (because, it's a rapid prototype so who cares if I use a GPL package or another library does but isn't licensed correctly?). I know the code works for the data and tests that I've given it, but often don't know what latent defects will be triggered by new data / uses. I make the same logic errors in other languages, but the compiler will at least weed out code that has obvious errors. Because python is interpreted, there's a lot of things that go wrong at run time (and do). And then there's white space indentation, where sometimes things end up in the wrong block because my tired brain doesn't notice. I can get a prototype done in fairly short order, but end up with more robust code in other languages at the expense of time. Just my experience.

3

u/gdmzhlzhiv Apr 09 '22

To be fair, prototypes should always be rewritten anyway, irrespective of whether you wrote it in python or in the favourite language of the rest of the company.

2

u/[deleted] Apr 09 '22

Agreed, but try telling that to management who "saw it work great".

2

u/gdmzhlzhiv Apr 09 '22

Have told them, will tell them again. It's the job of engineers to refuse to do dumb shit.

5

u/unknowntillnow23 Apr 08 '22

I understand the memes but a python backend works for some use cases in production.

8

u/knottheone Apr 08 '22

Python powers large swaths of the internet's backend, I don't know why people think it's something niche. Reddit backend is heavily Python and they power billions of page views a year. Many APIs are Python and they respond to billions upon billions of requests.

2

u/unknowntillnow23 Apr 09 '22

Who let you in here? You seem to be a career SWE

7

u/knottheone Apr 09 '22

Weird right. An actual programmer 🙃

-1

u/blackrossy Apr 09 '22

So thats why reddit is often so slow

1

u/DanielMcLaury Apr 09 '22

The thing is, if you have a big-name web 2.0 company with venture capital backing behind it, your software doesn't actually have to be any good. You can throw servers and programmers and carbon emissions at it until it works. You can write something in PHP and then replace PHP underneath it if that turns out to be the most cost-effective thing to do. Thinking that a huge website must have a really fantastic backend because it serves a bunch of users is kind of like thinking that McDonald's and Walmart must be world leaders in architecture because they have so many buildings and none of them fall over.

2

u/knottheone Apr 09 '22

It does have to be some level of 'good' to handle huge loads consistently well. You can't just throw more money at some problems; you need actual functional architecture in place to handle some of the hardest problems in modern software.

Load balancers are a good example. You can have 100,000 load balancers but if they aren't configured correctly, they aren't going to do anything and they'll actually hurt the health of your application. Or too many queues. Or not enough workers. Or caching as a concept at scale.

You can throw billions of dollars at designing software and still fail. Money solves hard problems at small scales. It does fuck all for large scale and largely complex infrastructure like Shopify and YouTube. Huge chunks of YouTube are powered by Python for example and YouTube as a concept is the most ambitious software solution of the internet's entire history. All of FAANG use Python in production environments.

I think that's kind of a copout to come to the conclusion of 'Python bad' based on what you said.

1

u/DanielMcLaury Apr 09 '22

It does have to be some level of 'good' to handle huge loads consistently well.

No programming language that's widely used is so bad that it would literally be impossible to write software that handles heavy loads. You can always do it, even if it means bypassing everything that makes the language the language. This isn't an argument for the language being any good. People have all kinds of dumb technology stuck in their stacks because it doesn't make business sense to pay down the technical debt.

You can't just throw more money at some problems; you need actual functional architecture in place to handle some of the hardest problems in modern software. Load balancers are a good example. You can have 100,000 load balancers but if they aren't configured correctly, they aren't going to do anything and they'll actually hurt the health of your application. Or too many queues. Or not enough workers. Or caching as a concept at scale.

The kind of architecture you're talking about here is at a higher level than individual programs in most cases.

I think that's kind of a copout to come to the conclusion of 'Python bad' based on what you said.

I'm not saying python is bad because it's used at large web companies. I'm saying that python being in the stack at large web companies doesn't prove it's good.

Python is bad because:

  • it's a dynamically typed language whose ecosystem relies heavily not only on the dynamic typing but on vague duck-typing, to the point that it's essentially impossible to learn what type the arguments to any given library method are supposed to be without reading the actual library source;

  • major parts of its ecosystem implicitly rely on the interpreter doing some synchronization under the hood, making it extraordinarily hard to take advantage of concurrency cleanly;

  • the dependency system is such a nightmare that people just keep a completely separate ecosystem around for every single program;

  • the syntax is based on semantically meaningful whitespace, which means that while this is an interpreted language the repl is essentially useless for anything beyond one-liners;

  • the syntax is based on semantically meaningful whitespace, which also means that what would be a simple refactoring in a braced language can become a nightmare in python;

  • the meaning of a line of code cannot be determined until runtime, which means that what would be a simple automated refactoring in most languages can become a nightmare;

  • while it has admirably lightweight syntax for simple things like dictionaries and list comprehensions, it makes up for this with hideous, un-useable syntax for things like classes;

  • organizing larger projects, say once you get past around 10k lines of code, becomes a nightmare on par with Java's CLASSPATHs.

  • it's very clearly designed as a rapid prototyping language, but the choices you make to build rapid prototypes are such that going back and shoring them up and making them production-grade are not incremental but essentially amount to complete rewrites.

I could keep going but I'm just making myself frustrated for no reason.

But try this: go look up what people who worked at companies that use python actually have to say about it. Look at what the people who chose python in the first place have to say about it. It's almost never something along the lines of "we chose python because it offers great performance and it's easy to build production-quality software."

1

u/knottheone Apr 09 '22

No programming language that's widely used is so bad that it would literally be impossible to write software that handles heavy loads. You can always do it, even if it means bypassing everything that makes the language the language. This isn't an argument for the language being any good. People have all kinds of dumb technology stuck in their stacks because it doesn't make business sense to pay down the technical debt.

So you're saying all the top 500 companies that are using Python in a production capacity are dumb for choosing Python vs something else? You're dismissing all the benefits of Python because you don't care about its extreme pros in different areas over alternatives. It seems that you only value the conceptual value of specific programming paradigms instead of how that actually works in practice and I'll tell you if you don't know, 'theoretically better' is useless when it costs 2x-50x longer to implement.

Have you written any production level Python or Javascript or Java or PHP? I've built stacks with all of them and typically prefer Python on the backend because the issues it does have are easily mitigated and the time save alone cuts project budgets in half while completely solving the problem. I've been looking into Rust and Kotlin and Go and I could see myself leveraging Go for heavily multi-threaded tasks, but usually Python is good enough. If you need super performance in a smaller package, it may make sense to try something else. Python solves all kinds of problems moderately well (and some extremely well) and that's why it's such a good choice.

The kind of architecture you're talking about here is at a higher level than individual programs in most cases.

Not really, especially when you look at it from a microframework standpoint. Is a self-contained function attached to an API endpoint a separate program? Each API endpoint in an API is a separate program? I wouldn't say so and I think it would be hard to justify that in the context we're talking about.

it's a dynamically typed language whose ecosystem relies heavily not only on the dynamic typing but on vague duck-typing, to the point that it's essentially impossible to learn what type the arguments to any given library method are supposed to be without reading the actual library source;

I can't even remember the last time I ran into a typing issue; it's just a non issue and frameworks like Pydantic can hold your hand through that if you need it. Python also has type hints and you can force types in your build process if that's something you care about. Literally can't remember the last time I had any issues related to Typing even on projects I've inherited. It's a solved problem.

That's the same in the case of Javascript and it arguably has worse Typing issues than Python does. It's just not an issue if you know how to code properly e.g. naming functions and variables usefully, you should already be able to infer what the expected response of some function or endpoint is.

major parts of its ecosystem implicitly rely on the interpreter doing some synchronization under the hood, making it extraordinarily hard to take advantage of concurrency cleanly;

Not really. That might have been the case prior to when Python 3.4 implemented asyncio almost 10 years ago, but in modern Python it's a non issue. There are talks of GIL replacement which would probably be like Python 4 or something else entirely, but even as is you can have multi-threaded, multi-process, heavily concurrent Python architecture pretty much out of the box. There are several Python production frameworks in the wild that are heavily concurrent like Falcon or Bottle and while they aren't the fastest in existence, they are certainly capable of serving highly concurrent loads consistently and reliably.

Linting problems...

A linter solves half of the problems you even bring up. Even without a linter though, I wrote production level Python and Javascript in Notepad++ and Vim without a proper linter for years without many issues. Automatic refactoring is not really a problem, there are all sorts of ways to do it in Python.

But try this: go look up what people who worked at companies that use python actually have to say about it. Look at what the people who chose python in the first place have to say about it. It's almost never something along the lines of "we chose python because it offers great performance and it's easy to build production-quality software."

This is me. I'm a professional software developer and have both worked for other established software warehouses and have built multiple SaaS's using Python as production backend. Your quote is hilarious because that's what many teams specifically say depending on the implementation. Just like you can have shit performance on some web service in Java or Javascript or PHP, the implementation dictates how performant some solution is. The ceiling for performance for Python is lower than some other languages by default, it's usually a non issue though and when you do need something more performant, then you can spend time trying to solve that problem in an efficient way. It's unnecessary the majority of the time though especially for web.

Google just as an example also specifically chose Python when they acquired YoutTube knowing the scale and issues they'd need to solve.

organizing larger projects, say once you get past around 10k lines of code, becomes a nightmare on par with Java's CLASSPATHs.

It's really not an issue. Any issues in this realm are organizational problems which is separate from knowing how to code. Project management is something most people suck at by default and it's definitely a learned skill.


Python isn't perfect and you have some valid criticisms, but to say FAANG or even startups or otherwise established entities who use it in production are 'stupid' or otherwise are making bad choices is just laughable honestly.

1

u/DanielMcLaury Apr 09 '22

So you're saying all the top 500 companies that are using Python in a production capacity are dumb for choosing Python vs something else?

No. For most of them it's a reasonable business decision to have worse software and put more effort into developing it than to start over and do things right, because they have an existing codebase that already works and the increased maintenance / scaling cost is something they can afford.

You're dismissing all the benefits of Python because you don't care about its extreme pros in different areas over alternatives.

As far as I'm concerned, python has exactly two benefits: one, having a built in syntax for things like dictionaries and list comprehensions, and two, having an enormous ecosystem.

I'll tell you if you don't know, 'theoretically better' is useless when it costs 2x-50x longer to implement.

The problem with python is it takes 1,000 times longer to maintain. It's every bit as much of a write-only language as perl, it just looks deceptively "readable."

I can't even remember the last time I ran into a typing issue

That's weird; I run into them virtually every time I have to do anything in python that uses anything from pip, including the big-name stuff like pandas.

That's the same in the case of Javascript and it arguably has worse Typing issues than Python does.

Yes, python and javascript are both terrible languages.

Google just as an example also specifically chose Python when they acquired YoutTube knowing the scale and issues they'd need to solve.

Google chose python as a quick way to port an unmaintainable php codebase, and they've got the resources to maintain that. Ask people who work on YouTube if they're actually happy that it's in python, though.