Сопоставление с образцом (pattern matching) — сильный механизм языков программирования, который, к сожалению, встречается не так часто. Причём, как в коде разработчиков, так и в поддержке со стороны самого языка.
Разработчики на функциональных языках используют этот механизм довольно часто, потому что у них вообще многое определяется статически через правильный подход к системе типов. Разработчики же на императивных языках очень любят огромные многоуровневые ветвления. Есть даже такое понятие «Спагетти-код» — раньше его применяли к коду, перегруженному операторами перехода, но в современном виде это скорее об избытке операторов условия.
Pattern matching позволяет накладывать на объекты некоторый трафарет и смотреть, попадают ли они под него. Это не только выглядит лаконичнее и короче, чем дерево условий, но ещё и понятнее с точки зрения восприятия человеком: вот у нас заказ содержит более 10 элементов и при этом стоит более 1000 долларов, значит делаем на него скидку 10 центов. При этом трафарет работает как сортировщик монеток: самая маленькая проваливается в первый паз, следующая по размеру в следующий итд, применение условий идёт сверху вниз. Есть и неявный плюс: такой подход автоматически провоцирует разработчиков проводить проверку на null. Ведь null не может подходить под трафарет «содержит более 10 товаров».
К счастью, в C# этот механизм в последних версиях активно развивают и совершенствуют. И это одно из многочисленных преимуществ C# над Java.
#dev
XMPPRealtime BlocklistProtects XMPP Groups From Spammers, Implemented In Major ServerSoftware
⚡️@takebackourtech | SOURCE
I'm proud to share a recent development in XMPP, the development and adoption of a real-time blocklist.
Problem: Because XMPP allows anyone to create an acct without personal info, certain bad apples can disturb XMPP groups. When these people get banned, they can simply hop to a different XMPP chatroom - since XMPP is completely decentralized the second server will not know a spammer has joined until its too late.
XMPP server owners knew they had a problem, so they formed a working group and built a solution in the form of a real-time block list.
Solution: The XMPP real-time blocklist can be adopted by any server and can sync with a shared blocklist co-managed by other XMPP server operators. Now when a spammer is caught in one group, they're caught in all groups using the RTBL.
My part in this was simply asking the development team of ejabberd (a popular XMPP server software) to implement the module that would make a real-time blocklist possible for anyone using their software. They accepted the request and it got implemented recently. This functionality was already implemented in most major servers and this was the last one - it's a big deal for public groups everywhere.
Today's a good day to try XMPP.
Have you joined #TBOT's XMPP room yet?
- Register for XMPP here
- Join our chatroom: [email protected]
⚡️Follow |🗣Discuss | 📩Newsletter
Buku, powerful bookmark manager & personal textual mini-web
@takebackourtech | CODE
Ever find something cool on the internet and forget to save it?
In my case I found an alternative repository for Chrome extensions so you wouldn't have to Download it through the Chrome Web Store. Now I'm having a hard time finding it (i have no idea why Google would want to hide it as a result ;)
Thanks to some awesome peeps in the #TBOT XMPP group ([email protected]) I am going to give buku a try, and start saving more information that crosses my screen.
Buku allows you to save links, tag & organize them. You can do cool things like tag a related group of links, and then open all of them at one time.
There's no tracking, hidden history, obsolete records, usage analytics or homing.
Buku gets around the problem of having multiple incompatible bookmark formats across browsers and provides a standard way to sync bookmarks from any computer. You can even integrate it to save a URL in your clipboard with a keyboard shortcut.
I'll let you know my experiences! And hopefully I find that alternative chrome extension repository I was looking for.
Join @takebackourtech to level up ⤴️
#TBOTBYTES 1: REJECT WEB TRACKING WITH uBlock & uMatrix
In our first #TBOTBytes video, we'll make your web browsing experience faster & safer, all within 5 minutes.💨
📓Read the in-depth article tutorial
📺 Watch on Flote | Odysee
If you follow today's guide and use it, you will have a much better understanding of the way the web works and how abusive software services have weaseled their way into every corner of the web.
TBOT Challenge 💪
EASY: Get uBlock origin installed, use it normally!
MEDIUM: Get uMatrix installed after reading the article. Browse your favorite websites and see what breaks. Take a look at the requests and allow the requests that restore functionality. Save these rules for that website or globally.
EXERCISE: Looking at the web requests for your favorite sites, what did you learn? Did anything surprise you? What might you ask of the developers of your favorite sites?
Enjoy a faster & more private web browsing experience!
#TBOT Show 7: The Significance of Dorsey’s Bitchat, Worlds First eSIM Hack, Mexico’s Digital ID, New Show Source Insights
Took a week off and now I’m back. 😎 (with a new addition to the show?!) (also - big sorry for the show being 40 minutes)
WATCH THE SHOW ON SUBSTACK
https://odysee.com/@takebackourtech:f/tbot-show-7:6
Here’s the stories for the week:
Jack #Dorsey’s #Bitchat - The Real Story: The tech mogul Jack Dorsey released a censorship proof messaging app in late June - named Bitchat. It runs a #bluetooth#mesh network, end to end #e2e#encryption, and rolling IDs and is picking up traction. I share my thoughts on the app, and concerns I have - but that’s not even the real story. I think Jack has a bigger message than just the app.
World’s First #eSIM Hack: A security lab out of Poland just demonstrated a hack on one of the largest SIM providers for IoT devices. We’ll get techy in our understanding and ask the question, could this impact our phones?
#DigitalID, Coming Soon To #Mexico: The Mexican government has signed a new #Biometric#ID law, known as the CURP. How is this enforced and what does it mean for Mexican residents? Find out today.
Decentralized #Video Conferencing: Recently I’ve been relying more on video conferences instead of calling people, especially while traveling. Good thing I’ve got the #Jitsi app, I’ll show you my setup!
#videocall
New Show, “Source Insights”: You follow #TBOT to stay informed on tech freedom. Now go deeper with a new weekly show “Source Insights”, where Hakeem shares his tools, lifestyle and productivity tips, entrepreneurial advice, wisdom from guides, and personal experiences.
Go deeper, join me as a Source Seeker. Unlock access with a paid subscription.
UNLOCK ACCESS
🪄 We aim for our show to be well-researched, well-informed and focused on the most impactful stories
⭐️ PLUS - Each story comes with recommendations and there’s one cool tech trick or open-source solution every week.
We’ll be publishing full posts and clips of each of these stories soon.
Share this post with your crew. 🚢
👩💻Get private phones, laptops, and tablets
📲SIM Swap Survival Guide Webinar