5 ms·
> I half-jokingly tend to describe it to people as having a "small brain buffer" The good news is that "smallness of bran buffer" doesn't matter very much if y
by branko_d 3y ago
> I half-jokingly tend to describe it to people as having a "small brain buffer"
The good news is that "smallness of bran buffer" doesn't matter very much if you are trying to implement anything non-trivial. Most useful software is so complex that it's impossible to keep all of it in your head in any case. But we can divide and conquer complexity without holding too much in our limited human heads at any single moment in time.
The real art is how you divide and conquer. Having a bigger "buffer" merely delays (slightly) the point at which you have no other choice but to start doing just that.
- dagmx 3y agoI disagree. It really does matter if you have any afflictions that exacerbate it. It maybe doesn’t matter for relative performance versus other developers but it does matter for the individual. Having frequent context switches just to keep on top of your work can be really draining. How much it matters also really depends on the languages you’re working in. Taking a couple languages I use regularly for example: Python (or any dynamic language ), as much as I enjoy it, can be a nightmare because of how dynamic it is. You have to keep way more of any given app in your head at a time. Rust by comparison (or any similarly static language) is much easier for me to just focus on the very local code without caring about the rest.
- formulathree 3y agoModern python is no longer dynamic. Type checking is a big part of python now. Python also has ADTs which match it in power to rust.
- sneed_chucker 3y agoThat's great if you're in a codebase at a workplace which enforces python type annotation checking. Unfortunately, I can tell you from experience that out in the real world, at fortune 500 companies, there are millions of lines of untyped Python doing critical work while being full of subtle type errors which should be compile time errors but will rear their heads as runtime errors when it's least expected.
- formulathree 3y agoIt's changed a lot recently. I would say the majority of companies now use type checking. It's def not as pervasive yet as Typescript.
- dagmx 3y agoDo you work at the majority of companies? I can tell you that I’ve worked with code bases from each of the FAANG companies that don’t use type checking, because it’s optional. Anything that’s optional in a language will not be ubiquitous Your statements are incongruent with the reality of production.
- formulathree 3y agoI've likely worked for more companies then you in the last 5 years or so due to my personality. I don't stay at one place for long. Actually I've probably worked for more in my entire career, but only the last 5 years should be relevant. Even so where I worked is only part of the equation. You can look up which companies use python types in a google search. Let me add more nuance, companies that use python as glue code as in scripting languages don't use types. This makes sense as python is considered not as important as the main language. For companies that are primarily based on python... the majority use types. The ones that don't are actively migrating. This includes faang and subsidiaries. In fact type checkers for python are likely to be built by faang or companies close to that tier.
- dagmx 3y agoI’m unsure how you can so confidently make that assertion. Even at companies that do use type hints, there’ll be tons of legacy code that won’t (and probably tons of new code as well if we’re being realistic). It’s like saying every company uses bash scripts. It’s not really indicative of the prevalence in actual code bases in production use other than saying it may be used somewhere within the company. Between this and your other comments, you’re making very widespread comments that can’t logically apply to everything and nor do they in my experience.
- dagmx 3y agoType hinting , not assertion, is a part of Python. Type checking is analysis post facto and doesn’t account for dynamicism of classes. The very ability to self modify an instance at any time or use __getattr__ makes it incredibly dynamic. It also doesn’t account for every dependency having accurate type hints or any at all.
- formulathree 3y agomodern python development is used in conjunction with an external type checker. That's what I meant. My mistake for not being clear. Obviously the python interpreter itself does not do any type checks. It's sort if like how modern development with javascript is used with an external compiler of another language (typescript) that compiles a typed language into one without types.
- dagmx 3y agoYeah but my rebuttal is that even with type hints and adequate type checking, that Python is too dynamic to trust consistent behaviour. An object can conform to a type in name only, but that’s not enough to tell you what methods or attributes exist on it at any given time.
- formulathree 3y agomonkey patching is rarely done. In practice, your rebuttal almost never occurs. I believe these type checkers can detect monkey patching and trigger a type error or warning.
- dagmx 3y agoIn practice it does occur very often. I’d suggest not ascribing your own experience to my own. I’ve been professionally coding in Python for over a decade in very varied codebases. There are tons of libraries in many companies that use dynamic attribute lookups for efficiency reasons, when adapting to different data sources and the like. Or pass through lookups on nested objects. Or they’re dynamically looked up on bound libraries from other languages and frameworks. And these type checkers cannot detect it. Python’s dictionary access is not guarded by the type checkers and neither is __getattr__. If you’re making such wide sweeping statements you need to be more familiar with the subject matter.
- mattgreenrocks 3y agoThe problem is less the language and more the culture around it. Typing will always be second-class, culturally. Additionally, mypy feels much slower to use versus something like Rust’s ‘cargo check’. Regarding ADTs: do type checkers ensure totality (all cases covered) when pattern matching? (I’m not casting aspersions here. It is what it is, you know?)
- formulathree 3y ago>The problem is less the language and more the culture around it. Typing will always be second-class, culturally. Additionally, mypy feels much slower to use versus something like Rust’s ‘cargo check’. Agree with mypy being slow. As for the culture it's largely moving in the right direction and it's at a point where you're more likely to find a python shop to be using typing than not. Of course for scripting I think people may not be so readily adopting types. >Regarding ADTs: do type checkers ensure totality (all cases covered) when pattern matching? Yes it does. Cast your initial presumption aside. This was a huge surprise to me too. Everybody loves typescript but basic usage of types in typescript is actually less powerful because it doesn't support this. You have to use it in a specific way though. https://tech.preferred.jp/en/blog/python-exhaustive-union-match/ https://tech.preferred.jp/en/blog/python-exhaustive-union-ma...
- still_grokking 3y ago> Modern python is no longer dynamic. Of course it still is. The type hints have no runtime semantics whatsoever. The actual type-checking still happens at runtime in Python, and is not related to any static checks. Out of the perspective of Python's interpreter the type hints don't even exist. They're like comments… Static type checking is not part of Python! > Python also has ADTs which match it in power to rust. All Turing-complete languages match each other in power… Besides that: Python doesn't have a static type system in the first place, so it can't compete with Rust in this regard. That's not even the same game.
- formulathree 3y ago>Of course it still is. >The type hints have no runtime semantics whatsoever. I clarified my meaning in another comment. You're right, I meant to SAY modern development involves type checking with python. But not with the interpreter. My mistake for not being clear. >All Turing-complete languages match each other in power… I obviously mean type checking. Additionally what you're saying isn't even true. Not all turing complete languages match in power or capability. >Python doesn't have a static type system in the first place, so it can't compete with Rust in this regard. That's not even the same game. Modern python development is done in conjunction with a type checker. Sort of like how modern javascript development is done with typescript. That levels up the game to where python is roughly in the same class as rust when it comes to type correctness. Depending on the type checker python matches the power of rust, roughly. There are differences, but for ADTs they are pretty similar in capability.
- still_grokking 3y ago[flagged]
- bippihippi1 3y agoAt least for me, naturally having experienced needing to context switch often (getting disctracted or multithreading or refreshing forgotten context), I have gotten good at it not by remebering more but by storing the context in an easily retrievable place. I keep tabs open, I print out stuff even when breakpoint debugging, and I reduce my cognitive load by default. I remember where to look to find the data, because I don't remeber the data. I keep the structure in my head and remember only where the details live. like abstracting
- ck425 3y agoPeople are shocked when they see how many tabs I have open. I just checked and I've 21 windows each with atleast 10 tabs, but the more frequently used one are 30+. But it really does help. I also group them by topic and when I need to focus I start a new window with the tabs for that particular task.
- still_grokking 3y agoThat's not much tabs… I have alone in this window here 4682 tabs open. How it comes? Well, I just don't close them until I have decided whether I want to bookmark them. After month with a browser sessions quite some tabs pile up. (When it gets out of hands I bookmark whole windows… So there remains at least the theoretical possibility that I sort this out later. Even that happens only rarely.) Before someone asks: From the technical standpoint it's quite easy to have so many open tabs. All you need is Firefox, Tree-Style-Tabs, and tab auto discard ("sleep"). It fits than in under 2.5 GB RAM even (which is less than Chrome with even a few tabs).
- wpietri 3y agoOn the other hand, I'd encourage you to see this awareness of cognitive load as a strength. Good code is approachable, and some of the worst code I've written was when I felt the most brilliant. If I've used all my brainpower to write something, then what do I do later when I need to debug it or integrated it? So now I really try to write such that I lower the cognitive load for future me and other developers.