#Encapsulation

After thought (thought I didn’t plan to put into it), I don’t think "NULL coalescing" and "NULL chaining" needs to be built in to the #ProgrammingLanguage, and here’s why:

* If you’re getting just one thing, the getter can take an optional default result value. #Python works like this in `getattr`, `.get`, and things of that nature. Having an operator for this is fine, but it seems obvious you don’t **need** the language to do it for you.
* If you’re walking down a long uncertain chain, I have two arguments:
* Knowing the path that leads down into the object to the specific thing you want kinda sounds like an #Encapsulation violation. Why do you know so much about the internals of this object. If this deep property is important, maybe it’s part of the interface of the top-level thing. Maybe this is just bad design.
* Diving deeply involves lots of possibilities: possible defaults, actual methods of finding the named thing (allow inheritance? Is it an attribute? Is it an element of an array? Etc), did you want to just stop or raise an exception?Does saying what you want really come out to a simple, clean, understandable, one-line, expression?

Maybe I’m biased because I don’t have these operators in my day-to-day language; and also can’t remember hitting this situation. And I can certainly see such operators could be helpful. I’m not a language designer. But from my actual experience, in this case, the juice just isn’t worth the squeeze.

#NullCoalescing #NullChaining #LanguageDesign

2025-10-17

Một bài viết từ /u/EgregorAmeriki thảo luận về đóng gói (encapsulation) trong lập trình không cần dùng từ khóa private, thay vào đó áp dụng thiết kế dựa trên giao diện (interface-based design) để tối ưu tính bảo mật và tính linh hoạt của code.

#Lập_trình #Object_Oriented #Design_Pattern #Công_nghe #Thiet_ke_phan_mem #Programing #OOP #SoftwareDesign #Encapsulation #InterfaceDesign

reddit.com/r/programming/comme

N-gated Hacker Newsngate
2025-09-15

📜 Behold, a relic from the distant past—2013! Back when "Page Object" was the new black in the world of , because clearly, nobody knew that UIs change. 🤯 Marvel at the revolutionary idea of not frying your tests with a side of HTML spaghetti, as if wasn't already a thing. 🍝
martinfowler.com/bliki/PageObj

S5G PhotographyS5G
2025-07-27
2025-07-17

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."

#ComplexSystems #Encapsulation

IB Teguh TMteguhteja
2024-09-21

Dive into the world of in ++! Discover how to protect your data, create flexible code, and master . Learn to use access specifiers, private members, and public methods for better software design.

teguhteja.id/encapsulation-in-

IB Teguh TMteguhteja
2024-09-21

Discover the power of encapsulation in C++! Learn how to protect your data, improve code flexibility, and master object-oriented programming. Dive into practical examples and boost your C++ skills.

teguhteja.id/encapsulation-in-

Pankaj Chouhanpankaj_str
2024-04-12

Discover the power of encapsulation in C++! 🚀 Learn how this cornerstone principle makes software robust and manageable. Dive into practical examples and unravel its essence with us at p4n.in.

p4n.in/2024/04/07/encapsulatio

2023-12-09

#decoupling #encapsulation
#thatmomentwhen you realize your OOP structure was worth it when you have to replace one class with another*, and when you swap in the new code for the old code... EVERYTHING STILL WORKS.

* I mean 3. THREE classes.

#codejoy

2023-11-13

Are You tired of Your IT departments blocking essential services(your self-hosted wireguard) on eduroam WiFi? Try encapsulating it with http/websockets !

sdr.li/post/chisel0/
sdr.li/post/chisel2/

#eduroam #firewall #chisel #sysop #admin #encapsulation #wireguard #bofh

2023-10-08

Private constants & breaking private functions in Clojure

youtu.be/kzAOEqlbapM

#Clojure #Programming #Software #Encapsulation

2023-08-15

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

#python #pythonprogramming #modules #encapsulation #namespacing #zenofpython #bestpractices #pitfalls #imports #dundermethods

2023-08-15

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

#python #pythonprogramming #encapsulation #pythoncoding

2023-05-02

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

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst