DEV Community

Discussion on: Encapsulation Explained using JavaScript

Collapse
 
peerreynders profile image
peerreynders • Edited

If you want to work seamless with OO-code on the web

Square peg in a round hole

Object-oriented development is good at providing a human oriented representation of the problem in the source code but bad at providing a machine representation of the solution. It is bad at providing a framework for creating an optimal solution.

ref

The browser is a machine:

  • (1) that is incredibly efficient at parsing complex semi-structured data in the form of server-rendered HTML (not to be confused with DOM operations) that can be thought of as the initial rendering for a fresh interaction done on a server with access to better and more determistic computational resources than some indeterminate client device.
  • (2) that is incredibly efficient at parsing CSS and applying the resulting styling rules to the currently rendered semi-structured data, in order to shape that information in a that way more easily comprehended by that indeterminate user of the client device.
  • (3) that features a language runtime that can manipulate the browser's resources and the rendered representation of the semi-structured data.

The "Human Interaction Component" in the days of Coad and Yourdon (1991) was largely based on the mental model of MVC—Smalltalk. Not something like a web browser.

[Progressive enhancement is] a philosophy that recognizes the nature of the Web as a medium and asks us to think about how to build products that are robust and capable of reaching as many potential customers as possible. It isn’t concerned with any particular technology, it simply asks that we look at each tool we use with a critical eye and consider both its benefits and drawbacks. And it’s certainly not anti-JavaScript.

Progressive Misconceptions

React's component model is essentially React style OO-thinking in pursuit of the elusive (composability and) reusability benefit.

But even that component model is showing it's cracks especially when everything is dogmatically coerced into being components or hooks for the sake of interoperability with the framework (reminiscent of the early days of Java were everything had to be an object).

Sure, we need boundaries but those boundaries don't necessarily manifest themselves just in the form of objects.

Application Holotypes: A Guide to Architecture Decisions

Collapse
 
efpage profile image
Eckehard

C++ is good at providing a human oriented representation of the problem in the source code but bad at providing a machine representation of the solution. So, should we use Assembler again? I assume, before ChatGPT most web designers have been humans, so what is bad about a human oriented representation of a problem?

React was not designed to deliver an "optimal" solution. It was designed to make things simpler, even at the price of a high workload to do all the DOM diffing. Browsers are so increadible powerful today, why should we need an "optimal" solution? It´s perfectly ok if it´s simple and understandable.

Thread Thread
 
peerreynders profile image
peerreynders • Edited

Browsers are so incredibly powerful today, why should we need an "optimal" solution?

“… static web site. You see in the trace what's going on here is a badly configured Angular application. It's easy to fix but they just don't have a reason to care, this isn't their problem. Right, it's fast on their iPhone!

Alex Russell - The Mobile Web: MIA - YouTube

Responsive Design didn't work, at least not the way we tried to apply it as a community. How do we know? Because nearly a decade after we adopted it as our p...

favicon youtube.com

Clean Code Q & A

Clean Code Q & A Part 2


This is why performance matters