Tonsai S. 🍂 retweeted
Hired a junior developer. His code was messy, but it worked.
I refactored it. Now it’s clean, readable, and doesn’t work.
That’s the value of senior engineering.
Tonsai S. 🍂 retweeted
defaults write com.apple.finder AppleShowAllFiles TRUE
Tonsai S. 🍂 retweeted
Hilarious.
The social contract is broken and people are done playing by the rules.
It's funny to think about all the ways our high trust society can be manipulated for personal gain if everyone simultaneously decides to stop playing by the implicit social rules.
Eg: take out a bunch of credit card debt and never pay it back.
What are they going to do?
Sue 15 million people for non-compliance?
It's impossible.
Society works because of the social contracts.
Governments have broken that social contract, and yet expect people to continue playing by the rules?
Doubt that lasts much longer...
Particularly when the currencies start going haywire - why not use the available system to max out your debt with the intention of never paying it back? I expect we will see much more of this in the coming years as people decide 'fuck it, this system is rigged'.
Tonsai S. 🍂 retweeted
ผู้ว่าฯ ชัชชาติ ห่วงแสงป้าย LED รบกวนคนกรุง เสนอร่างข้อบัญญัติคุมแสง สร้างมาตรฐานใหม่ไม่ให้ประชาชนเดือดร้อน
facebook.com/share/p/165mitW…
Tonsai S. 🍂 retweeted
𝗛𝗼𝘄 𝘁𝗼 𝘀𝗲𝗹𝗲𝗰𝘁 𝗗𝗲𝘀𝗶𝗴𝗻 𝗣𝗮𝘁𝘁𝗲𝗿𝗻?
Selecting the correct design pattern in software engineering is crucial for effective problem-solving. This guide streamlines the process, enabling you to make informed decisions between patterns based on your specific needs.
It provides concise descriptions and valuable use cases for each pattern, making it easier to understand and apply them in real-world scenarios.
To select a pattern, we must first go through the problem identification. If the problem is related to:
🔸 Object creation? → Creational patterns
🔸 Object assembly? → Structural patterns
🔸 Object interactions? → Behavioral patterns
So, let's dive in.
𝟭. 𝗖𝗿𝗲𝗮𝘁𝗶𝗼𝗻𝗮𝗹 𝗣𝗮𝘁𝘁𝗲𝗿𝗻𝘀
🔹 Singleton: Use when a single instance of a class is needed. Some examples are logging and database connections.
🔹 Factory Method: Decouple object creation from usage. For example, you create different types of database connections based on configuration.
🔹 Abstract Factory: Create families of related objects. For example, I build parsers for different file formats.
🔹 Builder: Constructing complex objects step by step. For example, if you need to create a complex domain object.
🔹 Prototype: Creating duplicate objects and reusing cached objects to reduce database calls.
𝟮. 𝗦𝘁𝗿𝘂𝗰𝘁𝘂𝗿𝗮𝗹 𝗣𝗮𝘁𝘁𝗲𝗿𝗻𝘀
🔹 Adapter: Make incompatible interfaces compatible. For example, it integrates a new logging library into an existing system that expects a different interface.
🔹 Composite: Represent part-whole hierarchies. For example, graphic objects in a drawing application can be grouped and treated uniformly
🔹 Proxy: Control access to objects. For example, lazy loading of a high-resolution image in a web application.
🔹 Decorator: Dynamically add/remove behavior. For example, we are implementing compression or encryption on top of file streams.
🔹 Bridge: Decouple abstraction from implementation. For example, I am separating platform-specific code from core logic.
𝟯. 𝗕𝗲𝗵𝗮𝘃𝗶𝗼𝗿𝗮𝗹 𝗣𝗮𝘁𝘁𝗲𝗿𝗻𝘀
🔹 Strategy: Define a family of algorithms. These algorithms enable users to select from various sorting or compression algorithms.
🔹 Observer: Maintain a consistent state by being notified of changes and, for example, notifying subscribers of events in a messaging system.
🔹 Command: Encapsulate a request as an object. For example, I implement undo/redo functionality in a text or image editor.
🔹 State: Encapsulate state-specific behavior. For example, we are handling different states of a user interface element (e.g., enabled, disabled, selected).
🔹 Template Method: Define the skeleton of an algorithm in operation, deferring some steps to subclasses and implementing a base class for unit testing with customizable setup and teardown steps.
Ultimately, we devised the pattern we needed for our problem.
#softwareengineering #programming #softwaredesign
Tonsai S. 🍂 retweeted
I worked on FaceID. During development we had to train it which meant we graded our own scans. Let me tell you that seeing yourself in infrared from a bad angle while taking a shit is a jump scare you aren’t ready for.



































