samdark blog
رفتن به کانال در Telegram
Notes taken by Alexander Makarov, lead of Yii framework and a long term IT engineering manager. Official Yii updates: https://www.yiiframework.com/ Consulting: https://asapirl.com/
نمایش بیشترکشور مشخص نشده استفناوری و برنامهها63 619
885
مشترکین
-124 ساعت
+17 روز
+1430 روز
آرشیو پست ها
885
👎 Bad focus on tech
As tech people we are often too much focused on the tech itself. We are going straight into using it to solve the problems and often that results in over-complicated, over-engineered and pricey solutions. Sometimes these solutions aren't needed at all.
❓When dealing with the problem, ask the following questions before thinking details about how to solve it:
🧠 Does it make sense overall to solve it? Is the decision backed by data?
💰 How much does it cost to solve it? How much does it cost not to solve it?
🕔 Does it make sense to solve it now?
👷♂️ Can it be solved by lawyer, leaving that to end user, hiring a person to do the job manually?
📈 Would solving it otherwise cost less than development?
885
🖐 Interviews and forming a team
Over the past few decades, I've conducted hundreds of interviews for various tech roles, mostly for the companies I've worked for. My primary goal was to assess the candidates' levels (junior, middle, senior) and provide feedback. However, when I started managing teams myself, I realized that something was amiss. I inherited a team that had been hired based on standard criteria, without much consideration for the project's requirements. While the developers were not bad, they were not a good fit for the project. So, how should you approach hiring to ensure that you have the right team for the job?
⭐️ Identify the problem you need to solve and determine whether any existing team members have experience in addressing similar issues. This will help you to identify the skills and experience required for the role. These are so-called "gaps" you need to fill.
⭐️ Consider existing tech stack, rituals, and approaches. Do you want to maintain these or adopt new ones?
⭐️ Differentiate between skills that are easy to grasp for a any tech person and those that are more challenging to learn. You should not view the former as requirements, but the latter should be considered essential for the role.
⭐️ While tech experience is important, you should prioritize candidates who can estimate, make promises and fulfill these.
There are way more about the hiring but the above should be always considered. You should always think about the problem hired people are going to solve.
885
phpday 2023
18 and 19 May 2023 there will be a PHP Verona, Italy. I'm speaking there with "Theory of programming: packaging principles". Unfortunately, remotely. Wasn't able to get a visa in time.
In case you're going to visit in person, here's a 10% discount code:
speaker_10OFF885
✈️ Always defer initialization
Modern frameworks utilize dependency inversion, with auto-wiring and DI containers used to populate the dependency tree. However, this can lead to large dependency trees, which is not inherently problematic, as instantiation is typically inexpensive. Nevertheless, if a service has heavy initialization in its constructor, it can significantly impact performance.
For example, the Symfony console initially defined command names and descriptions in non-static methods. As a result, when called without a command name, the console would instantiate every available command, some of which had expensive initializations such as connecting to a database, verifying API credentials, or reading files from disk. Although this issue has been resolved by using static metadata, it highlights the importance of deferring initialization for optimal performance.
To avoid performance issues caused by heavy initialization, it is crucial to defer initialization for as long as possible. By doing so, you can ensure that your application runs smoothly, regardless of the complexity of the dependency tree.
885
Hive
I can't say I'm a board game fan. I enjoy some of the games though and Hive is my personal king of board games. It is for two players. One round takes about 10—15 minutes.
Each player has one Queen Bee piece. Surround your opponents Queen Bee with either yours or your opponents colored pieces. The first person to surround your opponents Queen Bee wins. It's as simple as that, .... but is it?
Takes a few minutes to learn and a lifetime to master, just like chess.
I usually play it with my son. He's 7 and in a few months he became quite good in the game. It really is a challenge now to win.
https://www.gen42.com/games/hive
885
🔗 Awesome load balancing visualization
An interactive post by Sam Rose about load balancing basics. I ❤️ how it is visualized.
885
🔗 Philosophies that Shaped Successful Frameworks
The writing by Qiang Xue, original creator of Yii framework. It is from 2016 but didn't lose its actuality.
https://medium.com/capital-one-tech/philosophies-that-shaped-successful-frameworks-f976781e9bd4
885
🧠 Fighting thought deadlocks
Throughout my engineering career, there were days when I was highly productive, days when I was productive but not exceptional, and days when I just couldn't seem to get anything done. Unfortunately, these unproductive days were the most frustrating. During these times, I found myself staring at the screen, reading the news, or getting yet another cup of coffee - anything to avoid the feeling of being stuck.
Over time, I've developed some tricks that help me jumpstart my thought process:
⭐ Check in with yourself. If you're feeling tired or sleepy, take a break and rest. It's important to be well-rested to function at your best.
⭐ If you're feeling worried or stressed, hit the gym. An hour of exercise can do wonders to clear your mind.
⭐ Write down your thoughts. It doesn't have to be a masterpiece, just get your ideas down on paper. Edit it later if you need to make it more readable.
⭐ Read. I find that science fiction and other fiction books work best for me, but engineering books can also be helpful. The key is to find something that interests and inspires you.
⭐ Have a conversation with friends or family, especially those you haven't talked to in a while. Even if you don't get new ideas, it's a nice way to spend some time and potentially gain new perspectives.
❓What about you? What do you find helpful when you're feeling stuck?
885
These keyboards are actually fun. The feeling of typing is different with different switches so you're motivated to type something cool to try it.
Bad thing about Keychron additional switches. There are 90 in the set while there are more keys in K5SE keyboard :) Some some of my keys are on different switches now.
885
🎉 Yii database 1.0.0
First release of Yii Database and its drivers is done.
It is a framework-agnostic package to work with different types of databases.
Code looks like Yii2 more or less:
php
$rows = (new Query($db))
->select(['id', 'email'])
->from('{{%user}}')
->where(['last_name' => 'Smith'])
->limit(10)
->all();
📰 Official news: https://www.yiiframework.com/news/552/yii-database-1-0-0
I think that should do good for PHP overall because there's not much competition of framework-independent DBALs field.
It will be hard to beat this package though because of years invested into driver edge cases during Yii2 and awesome work done by Wilmer Arambula and Valerii Gorbachev for Yii3.885
💬 Report failure ASAP
It is very human to try to avoid shame of failure but it is also very important to report your failure ASAP. This is because other people rely on you and the sooner they are made aware of any issues, the sooner they can adjust their expectations. By reporting failures promptly, you can minimize the pain of delivering bad news.
This principle applies to all areas of life, whether it's your career or personal relationships.
885
On naming boolen getters // in Java
During Yii3 development an interesting topic was risen. How to name boolean getters for properties like
$allowNull. Possible names were:
- isAllowNull()
- allowsNull()
- isNullable()
- shouldAllowNull()
- hasNullAllowed()
One of the arguments for isAllowNull() i.e. always prefixing property name with is was that it is used in Java for years.
Since I was coding in Java before switching to mainly PHP, I remember why is that:
1. It is part of Java Beans spec. Beans defined like that are able to work with tools using reflection. It can read data from methods prefixed with is and get.
2. It later became part of JSP.
So overall, that is pure technical limitation and has nothing to do with either readability or correct English.885
PER coding style 2.0.0 released
New version of PHP coding style guidelines are released. This version fixes issues as well as updating the guide for recent PHP syntax addition.
https://github.com/php-fig/per-coding-style/releases/tag/2.0.0
885
Repost from samdark blog
Keychron K5 SE Wireless Mechanical Keyboard
Bought it as a birthday present myself to replace good old A4Tech KV-300H.
👍 Good
- Typing is awesome. I am using brown switches. Bought blue and red as well but haven't tried them yet.
- It's full-size.
- RGB light is nice despite most modes being distracting.
- Orange ESC gives accent.
- Fn keys are good.
- Awesome set (keycaps, tools).
- Works flawlessly via USB type C.
- Good support.
👎 Bad
- Bluetooth doesn't work with many cheaper receivers.
- Battery doesn't last long.
- Charging LED is way too bright. Solved it w/ black tape :)
https://www.keychron.com/products/keychron-k5-se-ultra-slim-wireless-mechanical-keyboard?variant=40054333145177
885
😔 Yii3 was leaked
Someone leaked all Yii3 source code, called it "YII3 PIRATE EDITION" and pasted it at https://pastebin.com/FbTjtG1S All we've worked on all these years is exposed :(
We're doomed but still have a chance to do the great final release.
You can support us at https://opencollective.com/yiisoft
Thanks.
885
📑 Elon Musk’s Engineering Principles – The 5 Step Process
Interesting read that was sitting in my bookmarks for too long. While Musk is very controversial person, most of these principles make perfect sense.
https://www.christianscheb.de/archives/893
885
🕦 Timezone difference service that makes sense
There are many such services but this one makes perfect sense and is easy to use.
https://timezoned.vercel.app/
Source code: https://github.com/kapxapot/timezoned
885
🧠 Assumptions
A real case that happened a few days ago. It was X of March. I was busy performance-optimizing a PHP project to handle extra load from TV ads. The load testing went well, the gain in RPS was good. After some time alters triggered showing that X of March the app started to error sending messages thorough SMTP.
First thought: optimizations broke the app since that the time when it stared to error. Right?
No! Wrong. The only thing we can really assume is "It was broken at X of March". That's it. To answer the question whenever the reason was code changes, an extra research is needed. The most productive way to do that is a binary search by using
git bisect: https://git-scm.com/docs/git-bisect
Morale: First assumption is likely wrong. Ask yourself if it's correct before taking action.