techhub.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
A hub primarily for passionate technologists, but everyone is welcome

Administered by:

Server stats:

4.6K
active users

#encapsulation

0 posts0 participants0 posts today
Continued thread

quotes from the text:

"The concepts rejected as “not complex enough” might be simple building blocks, like molecules in a living body, that can be combined with other concepts to create a framework that can handle an adequate amount of complexity."

"I.e. that the black box has only the purpose of simplification and not that of knowledge elitism and hidden power structures."

New article:

⚠️Why you should avoid import * in Python 🐍
pybit.es/articles/why-you-shou

Covering:
- Why modules are great and namespacing explained
- Why import * is a problem
- A practical example where a function gets overriden
- The recommended way to do imports
- What PEP8 has to say about this
- Protection workaround, use __all__ to define your module's public interface

PyBites⚠️Why You Should Avoid Import * In Python 🐍 - PyBitesHowever, not all ways of using modules are equally beneficial. In this article, we will discuss why using import * can be more problematic than it's worth,

People newer to Python often get confused by the statement:

if __name__ == "__main__":

That's many underscores ("dunders"), right?

In essence it lets you put code in your module that ONLY should execute when the module is called directly. So not when you import from it.

I explain this further with a practical example in this 3 minute video:
youtube.com/watch?v=ubpFY7_dAW

It's good to see my favourite WPF feature isn't dead:

class StamperBase {
  constructor(o) { return o; }
}

class MyAttachedProperty extends StamperBase {
  #name;
  static getName(o) { return o.#name; }
  static setName(o, v) { return o.#name = v; }
}

const hostInit = Host.prototype.initialize;
Host.prototype.initialize = function() {
  new MyAttachedProperty(this);
  return hostInit.apply(this, arguments);
};

export const attachedNames = {
  get: MyAttachedProperty.get,
  set: MyAttachedProperty.set,
};

#JavaScript #encapsulation #pluginDev #shitpost #mildlyCursedCode

Yes.

"cd.buy()" makes perfect sense.

@jasongorman
explains why you're probably thinking about OOP all wrong.

The takeaway: Encapsulation is the goal. The function is encapsulated upon the object.

Yes, you could try 'customer.Buy()' but then you end up with low-level coupling.

"Objects should encapsulate the details of HOW they work."

#oop #programming #design #encapsulation

youtube.com/watch?v=YG2qztxsmE

I once was hired as consultant to guide a team who wanted move their monolith to #microservices. We got only halfway. And it was good!

The route to microservices goes via #DomainModeling, #decoupling, and #encapsulation. Bounded contexts, decoupling and modules was enough to put the team back on track and moving again. We never built a single microservice.

This week, Ted Neward wrote about this idea in a post that I now no longer have to write:

blogs.newardassociates.com/blo

blogs.newardassociates.comYou Want Modules, Not MicroservicesDissecting why everybody keeps talking about microservices.

@leonid
Oh, that's interesting. Please send your former boss my regards!
I also think that Beta transformation at VW as a whole is not about to happen next year. ;-)
But here is the good news (so to speak) - and it is manifold:
- The company is suffering, and has been suffering for years. It needs substantial change
- Any group like VW consists of many many entities that could do #BetaTransformation, regardless of what the holding does. For this, #encapsulation, is necessary. But it is feasible