Programming

I am only commenting on this from the AWS infra side of me, and not any particular design comments, because you have a better sense of your problem and constraints than I do, and I hope I’m not misunderstanding anything.

I’ll just say right now anything automated that claims it can maintain what you’re describing is lying. If you don’t believe me, for some reason, imagine if you will AWS could do this - why the hell wouldn’t they offer that as a product already? Or anyone else? Because it isn’t possible, yet, and if you ask me, never will be - and while I can take this opportunity to go on an idealistic spiel, that’s because organizational problems eventually become infrastructure problems, and it can go the other way too, and since all organizations are innately different, there’s no general solution. To make matters worse in this space, AWS itself offers 50 billion ways to solve a problem, so you can easily go down a terrible path without knowing or years of painful experience.

The “AWS” architect way, I think, because I refuse to take that stupid cert, would be to recommend you fire events to your AppSync, which I’ve never heard of til now and am just guessing, to some AWS lambdas that are stitched together through AWS eventbridge configs, which you are right, are super horrible to guess through and understand what’s going on, and AWS docs aren’t notorious for being amazingly helpful. Eventbridge, formerly known as “cloud watch events” (liked that name better because it actually integrates with cloud watch a lot better than anything else due to how it evolved), is a formidable and powerful tool but involves complex permissions, as you noted with IAM, that are easy to fuck up and come without a lot of guard rails. That is why I mention the audit thing, I don’t know your domain and don’t want to, but these things are very easy to mess up in a terrible way, at least from a compliance/security standpoint.

Yea I imagine these are all fired from eventbridge. You could alternatively just set up a lambda on its own on a schedule, if you don’t wanna do it the “AWS” way with events, just set up a web hook that fires on a schedule you control from elsewhere. you’re an adult, you can deal with how you communicate with it and authenticate to it (if needed). You can even define your own custom authorizers with lambdas, if you want to get really technical with API stuff. The problem with event-driven solutions when you are building them in AWS is they are extremely hard to test in development. Which is why out-of-the-box solutions probably seem appealing, but are a nightmare to maintain.

External server, if you’re more comfortable setting that up, yes! and skip app sync, why not just have it talk directly to the lambda via a web hook? Not sure I see why the app is involved, but if it has to be, just have the app fire the events to a web hook endpoint (super easy to set up) and skip the complexity of app sync!

that is terrible

one of these parts will break at some point and you won’t know how to set it up. the docs will tell you to check cloud watch logs, but oh wait, your AI advised IAM role didn’t have the permissions for that and you don’t have logs without spending a day how to set that up.

skip eventbridge just make outbound network calls to a web hook. That probably applies to the rest below, other than to also say, if you’re designing your code around infrastructure that’s a sign your infrastructure design is bad.

1 Like

I don’t think you need locks as long as you only have one redis instance. Redis is single threaded and everything is atomic. If you’re still on node and want to do a node<->redis design session/sanity check, feel free to hit me up.

It sounds like Redis locking is for using redis as a distributed lock.

Thanks. Some good info in there. AppSync is just a collection of lambdas and an API Gateway instance that form a static graphql server. We decided to go with it for this project to see if it would work, and for the most part it does.

For the record I don’t think anyone is claiming to automate all these decisions. I was just pointing out that when my boss goes to reinvent and gets all excited about AI code helpers, in the end it may make that 5-10% of my job I spend actually coding 20% more efficient or something. Not exactly a huge game changer. What it may do is eliminate a ton of junior devs, which will suck when there are far fewer new senior devs being created.

yeah I’ll take whatever code review you want to give but uh as usual I’m mostly working on the UI. Here’s a fun one though, right from the start the top level of the repo is /client, /server, /shared, but the client and server have different tsconfigs (trust me, it took me weeks to get this all working). And neither of them like importing from a ts file outside of its rootConfigs.

So I gave up and am now copy pasting every time I change a shared type =/

I avoid typescript unless I’m building a shared library that will be used by other apps. It adds some efficiencies, but also takes a lot of the fun out of developing Javascript. I’ve definitely never had to deal with a shared tsconfig.

In the long run, all the distributed-systems stuff becomes much simpler if every state change runs through Dynamo and every side effect triggers off of a state change in Dynamo. Dynamo gives you consistent updates, and it’s much easier to unit test lots of permutations of current state + event → new state than it is to try to write integration tests for all the weird race conditions and edge cases you’ll have trying to run around cancelling pending schedules.

You can refactor the details, but the basic bones of state-change lambdas that trigger when stuff happens, interact with Dynamo to get and update the current state, then trigger all the side effects, is nearly always the right basic choice. Letting stuff happen without running through Dynamo makes things much more complicated and buggy.

I’m writing a pet project (Polymarket rewards farming bot) and writing in Python for the first time. Really liking it. Concise and intuitive and the type hints and linter replaces most of what you lose by ditching static typing. Getting imports/package handling working was an unbelievable nightmare though, don’t understand how it’s so bad in a mature language.

Also I wrote a slightly complicated (for a Python noob) websockets class that used asyncio and whatnot and wasn’t sure I had it right, so I pasted it to ChatGPT and asked for an explanation in English of what it did and any issues. It gave me an incredibly lucid description of what it was intended to do, correctly pointed out four bugs and then… gave me a rewritten version that introduced a bug. Very on-brand.

1 Like

Yea +1 on the packaging thing. I’m in dependency hell right now, one of my ongoing projects we decided to use python for gluing basic 3rd party oauth + a little business logic together using python because it really is very easy to write (except the c guy in me struggled a little with the semantics of truthiness in the language), but the packaging is a complete mess to me, especially trying to get it hooked into any mature production automation. Python language maturation to me following along these days seems like they’re starting to learn a lot of lessons languages learned 20+ years ago and it explains some or a lot of the kruft. for example, a language that set out to be about readability ends up with crap like

if __name__ == ‘__main__’

is just extremely silly to me. reading comment threads about the recent GIL decision is a fascinating view into the human condition

There is nothing intuitive about using white space as meaningful characters if you’ve learned any other languages first. Python is nice but its popularity grew faster than its capabilities did and it is being used for things I doubt it was ever intended to be used for.

You don’t need to use Python’s magic names, but they make some things easier if you do. I’m sure every language has lower level features that increase functionality at the cost of readability by people who don’t usually use that feature of the language. I’d never seen coalesce in SQL until I started looking at some of the ETL stuff we’re using and it took more SQL books to find out what it did than it should have.

it was just an example of something i find silly but i agree on whitespace, I spend a lot of time designing and inside of obnoxious yaml templates which has even more annoying whitespace semantics, but working in python’s the first thing that ever got me to install a vertical line separator in my vim setup. If it were up to me everything would be written in a mix of bash, c, and php but we live in a society apparently.

1 Like

Trying to google for help about it was the worst. Google “what package manager should I use” and it’s all articles that are like “here are 15 different options!”. Google “how do I get this fucking language to understand what my import statement means” and it’s like “here are 5 ways you might approach doing this!”. DIE.

IDK if it will help you if you’re trying to integrate it into a production environment, but I ended up using UV, which is a pretty new Python package manager, on the theory that if there currently is no dominant package manager in the community, you want to go with the new one that has learnt from the downsides of the others. I thought I was onto a good thing when its Windows installation instructions were just “run this command in PowerShell”. When you run “uv init” in a directory it sets up a virtual environment for you, handles adding everything to .gitignore, etc. Adding packages is just “uv add”, setting everything up again when you git clone into a new location is “uv sync”. Thus far it just works without any sys.path or PYTHONPATH or any of that stupidity.

It has been for me. I hate it when code isn’t well formatted anyway, so using that for syntax suits me. I can’t say I have ever thought my Python experience would be improved by sprinkling curly braces everywhere.

I could see it being annoying in a generic editor. I am currently using PyCharm - started off in VS Code but had issues with the debugger - and since it understands the language syntax it pretty much always knows where I want the cursor to be.

2 Likes

yea it is very annoying, especially on days I have to visually review several hundred to thousands of lines of code, in vim on languages that I work in the most, I can make macros that hop across closing brackets, but whitespace sensitive languages i havent quite figured out yet

I’m all for anything that reduces clutter and lets me see more code at once. So I approve of whitespace brackets.

1 Like

You white space hippies are only happy with it because you never worked on code on two computers with different number of spaces in their tabs.

Always convert tabs to spaces. Never leave tabs in code.

And always use two-space tabs, anything else is ridiculous.

Sure, you probably code in 4 point font too with the other optical mutants!

you guys are triggering me

Big font is exactly why I don’t want 4-space tabs. I don’t want lines running off the screen or wrapping.

Can we all agree that 8-space tab people should be committed to a mental health facility for their own and others’ safety?

I also cannot stand } else { on the same line. But I know I’m in the minority on that.

1 Like

I do like the look of Python code, but I may in a really tiny minority in that I don’t really care about whitespace or not, indent or tab or by how much, braces, brackets, semi-colons or any of this very much at all. And, oh my the man hours wasted at my work on the linters; installing, automating, talking about, “fixing” older code, and frustratingly having different linting/formatting tools disagree with each other for things that, to me anyway, make almost no difference.

2 Likes