Why Everything Is CRUD
The article argues that CRUD operations extend beyond databases to various processes, enhancing clarity and performance. It encourages developers to model operations as CRUD for better maintainability and efficiency.
Read original articleThe article discusses the concept of CRUD (Create, Retrieve, Update, Delete) operations and argues that many operations perceived as non-CRUD are, in fact, CRUD operations. It emphasizes that CRUD is not limited to traditional database interactions but can be applied to a wide range of processes, including background tasks, document handling, asynchronous messaging, user sessions, calculations, and error management. The author highlights that understanding operations through a CRUD lens can simplify development, enhance error handling, and improve performance. By modeling operations as CRUD, developers can leverage built-in features of frameworks, such as automatic validation, caching, and user interface generation. The article encourages developers to rethink their approach to operations, suggesting that even seemingly complex tasks can often be represented as CRUD actions, thus benefiting from the advantages of this model. Ultimately, the author asserts that adopting CRUD as a universal framework for operations leads to clearer, more maintainable applications.
- CRUD operations extend beyond traditional database interactions to various application processes.
- Many perceived non-CRUD operations can be effectively modeled as CRUD, enhancing clarity and performance.
- Utilizing CRUD allows developers to leverage built-in framework features like validation and caching.
- Rethinking operations through a CRUD lens can simplify development and reduce custom code.
- Adopting CRUD as a universal model leads to more maintainable and understandable applications.
Related
Beyond Clean Code
The article explores software optimization and "clean code," emphasizing readability versus performance. It critiques the belief that clean code equals bad code, highlighting the balance needed in software development.
Ask HN: Business logic is slowing us down
Developers face challenges balancing internal stakeholder demands and external user needs, often spending time on code maintenance. Recognizing this work is crucial for enabling focus on new feature development.
Why Your Data Stack Won't Last – and How to Build Data Infrastructure That Will
The article highlights challenges in data infrastructure, emphasizing poor design, technical debt, and key person dependency. It advocates for thorough documentation, cross-training, and stakeholder engagement to ensure sustainable systems.
Distributed == Relational
The article explores how distributed systems can utilize relational database principles, advocating for parallel data gathering, triggers for function invocations, and user-friendly alternatives to SQL for efficient software development.
Making Database Systems Usable
Database usability is essential for user satisfaction, often more important than technical performance. Despite advancements, challenges persist, including reliance on experts and complexities in querying, necessitating better interfaces and designs.
It's all fun and games in the greenfield happy path. Do the wrong modification to someone's bank account? Just update the code so you no longer do the wrong modifications. Leave the bad data in-place. Or if you want to fix the bad data, maybe reach out to the customer to ask what his balance should be. Or check the dev-logs, you do make your dev-logs a better source-of-truth than the database, don't you? Once you 'know' what the balance should be, just use your CRUD operation to set things right, aka "create money".
I agree with the article that exposing R and U interfaces on all entities is a completely natural, human way of think about it. It allows for completely intuitive patterns like "check-then-act" and "read-modify-write", (which are also the names of race conditions.)
EDIT: I forgot to comment on the obvious fallback here. If you really screw things up, it might be possible to restore your database to an earlier state, and just disappear all the money which moved through the system after the database snapshot was created.
Therefore, I would suggest to use "CRUD" terminology mostly the more technical parts of the application (e.g. some adapter to communicate with a database) and to use business terms (from the "ubiquituos language", as it is called in domain-driven design) otherwise.
I once had a coworker argueing against DDD ideas with the killer argument that it would be only "CRUD". But it was in no way useful to think about the problem in these terms. Later it turned out that we had quite some business logic and that "CRUD" wouldn't have been very helpful to express that.
Of course everything that works with a database is CRUD because what else can you do with a database apart from create, retrieve, update and delete data?
I think that if you're doing your job right in interface design the structure of your database shouldn't be immediately apparent to the user. The database design process and the interface design process should be completely separate.
All business logic must happen somewhere. In a CRUD framework, much of that is just pushed to the edges of those consuming the CRUD API, in order to keep the CRUD part clean. A trade off I'm not sure I agree with.
That's true. But NOT everything is CRUD.
Validation is not CRUD (you do not want your DB to validate your data in most cases -- and even whet the DB does validation: the V is not in CRUD). Form submissions are not CRUD. Queues (AMQP, SQS, pub-sub) are notoriously not CRUD. Scaling you cluster is not CRUD. Deploying your software is not CRUD.
I could go on...
Related
Beyond Clean Code
The article explores software optimization and "clean code," emphasizing readability versus performance. It critiques the belief that clean code equals bad code, highlighting the balance needed in software development.
Ask HN: Business logic is slowing us down
Developers face challenges balancing internal stakeholder demands and external user needs, often spending time on code maintenance. Recognizing this work is crucial for enabling focus on new feature development.
Why Your Data Stack Won't Last – and How to Build Data Infrastructure That Will
The article highlights challenges in data infrastructure, emphasizing poor design, technical debt, and key person dependency. It advocates for thorough documentation, cross-training, and stakeholder engagement to ensure sustainable systems.
Distributed == Relational
The article explores how distributed systems can utilize relational database principles, advocating for parallel data gathering, triggers for function invocations, and user-friendly alternatives to SQL for efficient software development.
Making Database Systems Usable
Database usability is essential for user satisfaction, often more important than technical performance. Despite advancements, challenges persist, including reliance on experts and complexities in querying, necessitating better interfaces and designs.