1 hour ago · Tech · hide · 0 comments

Here my previous post about encapsulation, the primary purpose of which is to argue for the importance of the concept. Here are some realistic, important violations of encapsulation: Using a system that requires the properties or attributes of a runtime object to correspond one-to-one with the columns or fields of persisted objects. (E.g., DynamoDBMapper or Django models.) These extra dependencies between subsystems cause all sorts of problems. So, for example, your code-level objects often become hard to reason about, and you can cause performance problems by making innocuous-seeming code changes.) Decoding an API response directly in a React component and feeding something like response.hats to a sub-component. This kind of dependence between the over-the-wire representation and component mechanics can cause a lot of trouble,1 and commonly does.2 Having a function that says (in its name, a docstring, or anywhere else) it returns all objects meeting criterion X, but silently dropping…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.