What I learned Yesterday
Some heuristics to get better at writing clean code that cam approves of:
network calls are slow, and you should parallelize them. I lowkey knew this but still had this as a nit in a pr. NTS: whenever making api requests in my code make sure they are implemented efficiently during pr review.
Minimize parameters whenever you can. Aggressively cut complexity out of your code. If you aren’t adding things back in at least 20% of the time, I think you might not be trying hard enough to cut the complexity.
Probably better to use public APIs for grabbing properties and such instead of calling some private attributes of the object because its much more likely some attribute will change and you have a weird bug that is probably going to cause u pain.
Retry’s are important, but I knew this. What I learned is to be careful of non idempotent actions when implementing retrys. It is very easy to just be like “retry if timeout” but its possible some sub tasks of your action were executed on the server and retrying fucks something up because it takes a different path on the server.
Some stuff i learned about how actions work on the backend:
function sdk client does NOT have access to the action endpoint, but CM sdk client does. Also, action edits are always compiled as a json and then applied to the ontology at the END. There are many down stream effects of this that u can think about. Note: tsv1 is apparently not a global client and some other dark magic, but nonetheless, the token that is like abstracted away from you does not have access to the actions api
The way around above is to create your own token with special perms and the only way to do this in foundry is with a service user. This however makes it so actions are really executed by the client and not the user clicking the button which maybe is bad for security.
I wish they had the ability to define as many transactions as you want in functions. that would solve all my problems :(
How did we go from usury illegal → usury fine (from approximately pre 1200 → 1700) The years are vague but thats the general timeline im looking at. (credit to my buddy jai for talking through this w me and explaining these ideas to me)
The reason it was able to be enforced way back when was because the catholic church held power. Since they had power they were able to enforce the rules, and people largely followed the church so the threat of excommunication and other punishments were enough to deter Christians from doing ts.
However this did not apply to jewish people. They were not christian and for them, usury was not outlawed. So they were mostly the poeple who took on the role of money lenders. (generally where all the stereotypes come from)
Then, the power of the church declined slowly over a few hundred years because kings and such found it useful for there to be a few lenders, and generally as there is more political competition from more empires/kingdoms, it becomes hard fo rhte church to enforce itself as the primary decision maker on something like this and they are unable to enforce their moral laws on all of medival europe.
Then, the final nail in the coffin is probably the protestant revolution which kind of shattered the absolute Christian authority of the catholic church.