SShortSingh.
Back to feed

Tell Don't Ask: Why OOP Should Command Objects, Not Query Their Data

0
·3 views

The 'Tell Don't Ask' (TDA) principle revives Alan Kay's original vision of object-oriented programming, where objects exchange messages and make their own decisions rather than exposing internal data for outsiders to manipulate. The core idea is that instead of extracting an object's data to make a decision externally, you should instruct the object to perform the action itself. This approach centralises business logic inside the owning object, meaning a rule change needs to be made in only one place rather than tracked down across multiple scattered conditionals. TDA also naturally encourages compliance with the Law of Demeter, since commanding objects eliminates the need to traverse internal structures like 'a.b.c'. The principle applies primarily to behaviour and business decisions, not to pure data-display scenarios or data-transfer objects that carry no behaviour by design.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Tech Burnout in Focus: How Developers Can Spot Warning Signs and Recover

A discussion on DEV Community highlights the growing risk of burnout among software developers driven by the pressure of constant learning in a fast-evolving industry. Workplace culture and available resources are identified as key environmental factors that can either worsen or ease this pressure. Early warning signs include persistent exhaustion, difficulty concentrating, and a growing sense of disconnection from work. Experts suggest that self-care practices such as exercise, meditation, and hobbies outside of work are effective tools for restoring balance. The piece urges developers to prioritize mental well-being and recognize when enthusiasm for technology crosses into harmful overexertion.

0
ProgrammingDEV Community ·

Satirical Buddhist Sutra Uses Google Gemini AI as Metaphor for Spiritual Discipline

A satirical piece published on DEV Community reimagines a classical Buddhist sutra to comment on the experience of using Google's Gemini AI model. Written in the style of ancient Chinese Buddhist scripture, the text frames Gemini's strengths — such as eloquent writing and multimodal understanding — as divine virtues, while its errors and inconsistencies are cast as trials that cultivate patience and wisdom. The piece argues that struggling with an imperfect but powerful AI is more spiritually and intellectually valuable than relying on mediocre, compliant tools. Central Buddhist concepts such as forbearance, diligence, and non-regression are invoked to discourage users from abandoning Gemini when it fails. The work functions as tech commentary wrapped in religious parody, suggesting that tolerating a flawed but capable AI builds resilience and critical thinking.

0
ProgrammingDEV Community ·

How Machine Learning Is Reshaping Predictive Maintenance in Aviation

Aircraft generate vast amounts of operational data that machine learning systems can analyze to predict component failures before they occur. Predictive maintenance models draw on sources such as engine sensors, flight data recorders, and maintenance logs to identify early signs of degradation. Algorithms like Random Forest, LSTM, and Transformer-based models are commonly used, with model selection depending on the specific task and dataset. Key engineering challenges include poor data quality, class imbalance due to rare failure events, and model drift as operating conditions evolve over time. Despite automation, certified maintenance personnel retain full responsibility for inspections, repairs, and clearing aircraft for service.

0
ProgrammingDEV Community ·

AxonASP Lets Developers Run Server-Side JavaScript Without Node.js

AxonASP is a Classic ASP engine built in Go that executes JavaScript natively on the server side, requiring no Node.js or third-party JavaScript runtime. It supports ECMAScript 5 and 6 features and uses a synchronous execution model, eliminating the need for async/await chains or promise-based patterns. Developers can access standard ASP objects like Request, Response, and Session directly from JavaScript code, and serve full websites using plain .asp or .js files. The engine also includes a templating library called G3TEMPLATE, which uses Go's html/template system to allow designers and developers to collaborate without overwriting each other's work. The project positions itself as a simpler, lower-overhead alternative to modern JavaScript build pipelines for server-rendered web applications.