Categories
Tech

Services vs Local Functions

I have been recently revisiting concepts that I have been working with for a while now as a software engineer, more deeply questioning them to formulate better best practices for them. One such concept is that of a service vs a local function. Let’s list the various features of both:

  • Remote runnability: only services support this. Both services and local functions support local.
  • Concurrency: I used to think only services support this, but local functions do too with threads. (To address a misconception here: concurrency is only tough with shared resources, and services are already written presuming no access to local resources; if the same code were transplanted onto a local function running in a thread, it would basically be the same result, assuming sufficient info about the thread scheduler and other relevant lower-level systems.)
  • Access: for a service, anyone can call, choice of who to respond to is implemented in the service’s logic (e.g., return 403 error.) For a local function, who can call depends on the programming language and what it enforces (e.g. Java public vs protected vs private.) For some languages (e.g. compiled ones), only code compiled with it can call it (no one else can call it once it is an executable), but for other languages if it is say part of a DLL then it could be called by other local programs even if it has already been compiled into an executable. For practical purposes, we can consider “importing as a package” and “linking as a DLL” to be semantically similar actions (a programmer just needs to “include it and get it working”), and in a sufficiently expressive language where the local function is exposed sufficiently (e.g. as part of a package) then whether or not it’s already an executable doesn’t really matter and in that case we can say a local function can be called by any local program. Choice of who to respond to depends on the language’s expressiveness, e.g. reflection features that give information about the caller, or if possible business-logic encoding of “who the caller is”; otherwise, a local function always has to respond.
  • Resource overhead: services have noticeably more overhead than local functions, involving network stacks and the like.

Similar to innovations like Scala’s mix-ins that have evolved to replace inheritance in most cases (not just be another feature with trade-offs), after writing this comparison I think it’s possible to eliminate what I view here as a false trade-off (services have more flexibility but also more overhead) with one primitive. It seems plausible that we could develop a language/framework where any function call could be auto-exposed but also get enough information about its caller that it can choose who to respond to, and the “engine” of the language could allow any function to be called remotely (again with choice of who to respond to) but also have the optimization of eliminating the network stack when the function is called locally. Generally, with “hand-coded” architecture, developers manually made decisions about programming languages, exposure of various local functions, services, etc., presumably introducing many spots of inefficiency (which also led to a lot of boilerplate, e.g. in the case of Java.) However, such a framework could automate this decision making, eliminating the inefficiency and empowering developers to focus on more differentiated and interesting business logic.

Categories
Tech

Customer Support and Data Privacy

One “natural” good intention that can end up undermining data privacy is enabling customer support. For example, say a website was built so that its website owners could not access passwords even if they wanted to (no “master users” or “superusers” of the database.) This would seem to be a great design decision from the perspective of security and privacy. But if a customer forgot their password and wanted to get back into their account, without such “superuser” access this could technically be impossible (depending on the technical architecture of the website.) So companies do end up introducing such “database superusers” since users end up making mistakes in this vein or wanting to undo their actions. To aid customer support personnel further, they often introduce “God Mode” tools that allow them to perform any actions on behalf of any user. But the problem is that such tools then get abused by employees, far beyond the purpose they were created for, for example to stalk users. This is further exacerbated by smaller companies de-prioritizing proper controls on such tools because of pressure to deliver quickly, and even for companies that do have such controls, I believe those may not be enough; for example, some companies do auditing and after-the-fact disciplining, but I would argue that by that time the damage is already done. Scandals connected to this have in fact happened in major companies like Uber.

Also, from a development perspective, developers would like to test and analyze their apps in environments that are as close to the “real world” as possible (how users would actually use them.) It is well-known that even with developers’ best efforts to guess all the scenarios of possible usage patterns, they can fall short of the breadth of what happens in reality when the app is released. This means that developers would like test data to be as close to real user data as possible, even possibly a small randomized sample of actual user data. Also, when troubleshooting real customer issues, the more information developers have to work with, the more effective they can be in helping out. This leads to incentivizing the hoarding of user data, with the reasoning that “it could be used later to make the user experience better and help users more.” But such troves of data that are amassed are then attractive targets for hackers and bad actors, and in companies that store even more data, the potential for subsequent damage from any hack is far greater. And as a company operates for longer and longer, the probability that they could slip up gets higher, especially with the necessity of continual maintenance of their systems.

Companies usually address this with internal data privilege enforcement systems, where only certain employees are specially authorized to deal with user data, and only the data that they specifically need for a legitimate business purpose. Use of “God Mode” tools is tracked, producing detailed audit trails, and the price of any misuse is severe disciplinary action, including termination. However, while this is well-intentioned as a setup, it still doesn’t feel adequate to me: after-the-fact disciplinary action is not enough when the damage is already done, and there does not usually seem to be much external transparency into who internally is granted access to user data internally for what purpose — this is all owned within the company, and for the purpose of a smoother customer experience it is supposed to be invisible to the customer (as if it is something they shouldn’t need to worry about.) A more robust system towards the requirement of providing the transparency that customers deserve would be one that externally exposes and audits these internal data privilege grants better.

I also have a few general points on communication and discussion of this issue. First, I think too much of the discussion is symptoms-focused rather than root cause-focused. It’s easy to criticize a certain company for having data privacy violations, but the more interesting and important question to me is what incentives led to those violations happening, especially if such incentives could apply to anyone and redirect them, even those who started with good intentions. This especially applies to companies that were once hailed as privacy supporters, and then in sudden heel turns (often derived from one or a few news articles) condemned as privacy saboteurs. This point can also be generalized beyond data privacy to many other issues people often criticize the tech industry on today.

That said, I think there is too much pressure rampant throughout the industry to deliver quickly, and while some of that pressure is a good thing, it cannot be to the point that it crosses certain fundamental boundaries, especially for example those concerning security and privacy. I do believe these boundaries can be crossed too often sometimes these days, and while this doesn’t necessarily happen with malicious intentions (“We’ll fix it later”), regardless it is not acceptable, and we should be much stricter in upholding those boundaries, no matter what.

In companies that do have proper controls (what I described with an internal grant system and a thoroughly audited God Mode tool), I wonder if a “God Mode” tool could be built that has customer consent technically baked in. At first glance, this seems to not make much sense — say for example that such a tool was built, where a customer support agent technically could not access it without a customer’s consent. How would the customer provide that consent, and how would their provision of it be technically verified? After all, if the customer is the one who forgot the very thing that allows them to access their account (e.g. their password), then from the perspective of the website, how can it know that they are who they claim they are, and therefore that the consent was valid? And if they are able to prove that, then they could just access the website directly using that proof without any customer support in the loop. In fact, this would essentially just be the same as logging into the app directly, possibly with a “forgot password” flow that still requires some other authentication. With a robust enough “forgot password” flow (which must be secure in requiring enough alternative proof but also covering enough cases of what users could forget — this seems actually to be a tricky problem that we’re glossing over here), this could presumably work for many cases, but for those customers where that flow doesn’t work, they would never be able to get back into their account again, no matter how much a human tried to help. Maybe some partial technical verification of consent could be possible: for example, the system could use voice parsing via AI to check whether the customer agent is speaking to the intended user, and if so then grant consent; but with AI today this could also potentially be faked, and this would also require storing user voice data in order to perform the comparison. In general, any alternative authentication mechanism would require storing user data along the lines of that authentication method in order to perform such a comparison.

I’m not sure what a better solution here could be. But external auditing of internal data privilege grants would be a start, and in general more external transparency around how these systems are built and why the tradeoffs exist would be important to provide customers with the fundamental knowledge that they should have when navigating technology.

Categories
Tech

Is Asymptotic Analysis Still Valuable?

Many software engineers who have been in the industry seem to view asymptotic analysis (“big-O”) as not as effective or relevant to their work. Yet it is still fundamentally emphasized in academic computer science programs, forming a major part of standard algorithms and data structures courses. Is there still some value in asymptotic analysis, or is it better to evolve away from it going forward?

Categories
Tech

Generalizing ACID Transactions to Arbitrary Code

In this project, we see how much we can generalize the core properties of ACID database transactions (atomicity, etc.) to general code and computer operations. The idea is to develop a framework that can provide these generalized capabilities.

Categories
Tech

Real-World Systems Aren’t Mathematical

When I first got into computer science, I came into it from a math background. Back then, I would think of computer science as essentially a way to “run math physically.” While in many respects this is true and a great way to capture the essence of computer science, I’ve learned over time that there are caveats in thinking of real-world systems, like those built by code, as mathematical. I’ll discuss some of these points now.

Categories
Tech

Ideas, Experiences, and Differentiation

Back in 2013 and 2014, I started what I call my “Ideas Doc,” in which I wrote down ideas for new tech products that I would want to create some day. This was geared towards an entrepreneurial purpose, of seeing what ideas I could potentially start a company on. I’ve kept that stored and have been continually updating it since, adding new thoughts and ideas while removing ones that I don’t think are as viable anymore.

Categories
Tech

Source Consolidation in Tech

I’ve been recently thinking about the potential of newer technology to accelerate a phenomenon that I call “source consolidation.” It seems to me that this will only speed up even further as technology progresses, for example as generative AI becomes more powerful and prominent. In this post, I talk about what I mean by source consolidation, how it relates to tech and generative AI, and what its implications can be.

Categories
Tech

On Declarative vs Imperative Programming

People who discuss programming often talk about the distinction between declarative and imperative programming as two different paradigms. However, in this post, I argue that these terms are really only relative and informal, and in fact that we don’t lose much if we de-emphasize the distinction.

Categories
Tech

Symbolic Dependencies and Refactorability

What language features are (minimally) necessary in order to implement full refactorability of symbols? (Think “Rename Symbol” in your favorite IDE.) For example, when I used Python instead of Java, I had discovered that refactoring interfaces was much harder. Is there a deeper explanation for this?

Categories
Tech

Reacting in Programming

There are lots of different concepts in programming related to reacting when special occurrences happen. This post is an attempt at sorting these concepts out and illuminating how they relate to each other. Of course, a lot of this is based on my understanding, and it’s possible that different people will have different definitions of these terms; however, this is meant to accurately reflect the standard meanings.