A few points about monolith arhitecture I red recently:
- "Monolith" is a software system consisting of exactly one deployment unit.
- A monolithic system does not imply poor design or lack of modularity. The fact that a system is monolithic does not say anything about its quality.
- A modular monolith is a way of designing a monolithic system with modularity in mind.
- A "real" module should be independent, self-contained, and have a clearly defined interface.
- "Monolith" is a software system consisting of exactly one deployment unit.
- A monolithic system does not imply poor design or lack of modularity. The fact that a system is monolithic does not say anything about its quality.
- A modular monolith is a way of designing a monolithic system with modularity in mind.
- A "real" module should be independent, self-contained, and have a clearly defined interface.
Let's say we need to record the end of a certain process in a database. Should we use two fields,
Personally, I prefer the second option, as it doesn't require synchronizing two values.
However, there's also an argument for using two fields for semantic clarity: if we only need to check whether the process has ended, then using a boolean value in
is_finished and finished_at or is it enough to use only the timestamp in finished_at and determine if the process has ended based on the presence of a value?Personally, I prefer the second option, as it doesn't require synchronizing two values.
However, there's also an argument for using two fields for semantic clarity: if we only need to check whether the process has ended, then using a boolean value in
is_finished is quite semantic!While I'm getting used to the ortholinear keyboard, my typing speed has dramatically decreased - typing tests show around 50 characters per minute for PHP code, compared to my usual average of around 300 characters per minute on a regular keyboard.
And now I've really come to appreciate the Live Templates feature in PhpStorm! Before, I only used about five templates, because I was too lazy to memorize the others, as I could type out all the standard structures and keywords very quickly "manually". But after dropping down to 50 characters per minute, I felt a huge benefit from using Live Templates for quick substitution, and have even created a few of my own templates.
Tip of the day: if you used to disregard Live Templates thinking "I need to figure it out, memorize it, I'd rather just type it out myself" (like I did), give it another chance! It's like sharpening your saw before cutting down a tree.
And now I've really come to appreciate the Live Templates feature in PhpStorm! Before, I only used about five templates, because I was too lazy to memorize the others, as I could type out all the standard structures and keywords very quickly "manually". But after dropping down to 50 characters per minute, I felt a huge benefit from using Live Templates for quick substitution, and have even created a few of my own templates.
Tip of the day: if you used to disregard Live Templates thinking "I need to figure it out, memorize it, I'd rather just type it out myself" (like I did), give it another chance! It's like sharpening your saw before cutting down a tree.
A small example of how Copilot helps in daily work with small things. In a MySQL table, there is a column with the first name and second name (in one column, not separated). It was required to display them in reverse order: second name and first name.
The solution is straightforward: find the position of the space, take the string before this position, after this position, and concatenate them in reverse order.
I want to do it in one SQL query, but I don't remember the names of the specific functions for the string manipulations I need in MySQL, as I rarely use them.
🧐 Pedantic approach: open the MySQL documentation for string manipulation functions, find the ones I need, and compose them. Additionally, while reading the documentation, refresh my memory on the names of other useful functions.
🔎 Google + StackOverflow approach: write a query in Google, and most likely the first link will be to StackOverflow - for simple tasks like this, the solution is usually visible right away, and it is correct. I just checked it out: the first link indeed provided a solution to my problem, but for SQL Server. Slightly below, there was one for PostgreSQL. It may work, or it may not, so I need to check. Alternatively, I could go back to the Google tab and try the second link from the search results.
🤖 Copilot approach: write the task in the comments directly in the PHP code (sometimes I create a scratch file for this).
Example on the screenshot 👆
I received the ready-made answer much faster than if I had opened a browser and searched the documentation or Google/StackOverflow. Almost a 10x programmer 😝
P.S. It turns out that MySQL has the function SUBSTRING_INDEX, which combines searching for a position and extracting a substring.
The solution is straightforward: find the position of the space, take the string before this position, after this position, and concatenate them in reverse order.
I want to do it in one SQL query, but I don't remember the names of the specific functions for the string manipulations I need in MySQL, as I rarely use them.
🧐 Pedantic approach: open the MySQL documentation for string manipulation functions, find the ones I need, and compose them. Additionally, while reading the documentation, refresh my memory on the names of other useful functions.
🔎 Google + StackOverflow approach: write a query in Google, and most likely the first link will be to StackOverflow - for simple tasks like this, the solution is usually visible right away, and it is correct. I just checked it out: the first link indeed provided a solution to my problem, but for SQL Server. Slightly below, there was one for PostgreSQL. It may work, or it may not, so I need to check. Alternatively, I could go back to the Google tab and try the second link from the search results.
🤖 Copilot approach: write the task in the comments directly in the PHP code (sometimes I create a scratch file for this).
Example on the screenshot 👆
I received the ready-made answer much faster than if I had opened a browser and searched the documentation or Google/StackOverflow. Almost a 10x programmer 😝
P.S. It turns out that MySQL has the function SUBSTRING_INDEX, which combines searching for a position and extracting a substring.
I'm reading about what's new in PHP 8.3 (which is set to release at the end of 2023): "Stack overflow detection" - my first thought was "will the interpreter be able to tell if the code was copied from StackOverflow? 🧐" https://github.com/php/php-src/pull/9104
GitHub
Limit stack size by arnaud-lb · Pull Request #9104 · php/php-src
This is an alternative to #5135 (see #5135 (comment)).
By checking the stack size in the VM, we can throw an exception before the stack overflows.
We can also check the stack size in recursive C c...
By checking the stack size in the VM, we can throw an exception before the stack overflows.
We can also check the stack size in recursive C c...
Fresh initiative by Ryan Chandler (a highly active developer from the Laravel community) - an superset of PHP called PXP: https://pxplang.org
💡The idea is as old as time: take a programming language, add a pinch of sugar, a dash of typing, and create a transpiler/compiler to the original language. The most successful and similar example: TypeScript -> JavaScript.
📄I read the entire documentation on https://pxplang.org in just 10 minutes - the proposed changes are few and far between, meaning there's no paradigm-shifting revolution, just a slightly more enjoyable syntax. I would happily write code in such a language, but it needs to be popular enough and equipped with developer tools to ensure the DX (developer experience) isn't worse than PHP's.
🙅♂️I don't want to use it as a standalone transpiler into PHP because:
I don't want a build step.
This build step will complicate debugging (waiting for source maps, anyone?).
There's no support in PhpStorm. Support might come if the project becomes popular. But for it to become popular, we need live people and projects using this language. Who's going to code in it without PhpStorm support? The classic chicken-and-egg problem strikes again.
🧪One could consider the project as a testing ground for experimenting with different language features before proposing them in an RFC for PHP. However, for it to be a proper testing ground, someone needs to conduct experiments on this playground. We need a critical mass of projects and developers willing to invest their time in PXP.
In short, I'm skeptical. 🧐
💡The idea is as old as time: take a programming language, add a pinch of sugar, a dash of typing, and create a transpiler/compiler to the original language. The most successful and similar example: TypeScript -> JavaScript.
📄I read the entire documentation on https://pxplang.org in just 10 minutes - the proposed changes are few and far between, meaning there's no paradigm-shifting revolution, just a slightly more enjoyable syntax. I would happily write code in such a language, but it needs to be popular enough and equipped with developer tools to ensure the DX (developer experience) isn't worse than PHP's.
🙅♂️I don't want to use it as a standalone transpiler into PHP because:
I don't want a build step.
This build step will complicate debugging (waiting for source maps, anyone?).
There's no support in PhpStorm. Support might come if the project becomes popular. But for it to become popular, we need live people and projects using this language. Who's going to code in it without PhpStorm support? The classic chicken-and-egg problem strikes again.
🧪One could consider the project as a testing ground for experimenting with different language features before proposing them in an RFC for PHP. However, for it to be a proper testing ground, someone needs to conduct experiments on this playground. We need a critical mass of projects and developers willing to invest their time in PXP.
In short, I'm skeptical. 🧐
Sinaga79
Sinaga79: Situs Toto 4D Terbaik dengan Hadiah x3000
Main Toto 4D di Sinaga79 dengan deposit Rp 10.000 saja! Dapatkan hadiah hingga x3000, prediksi gratis, dan withdraw 3 menit. Daftar sekarang!
👍1
Here is my recent experience using ChatGPT (4). There are two document management systems, and I needed to establish bidirectional synchronization for certain documents, while allowing users to make changes in both systems.
🫴I described the initial situation in one paragraph and requested three denoscriptions for the following scenarios:
- With optimistic locking
- With pessimistic locking
- With three-way merge in case of concurrent changes
+ I asked for sequence diagrams in the Mermaid syntax.
💬ChatGPT described everything just like in a textbook: sequentially, clearly, accurately, and specifically using my example (system names, document names – it was important for the denoscription to be concrete, not abstract). It would have taken me at least an hour to prepare such a document manually.
🍰As a bonus, I asked for a two-phase commit diagram (which we actually didn't need for this task), and ChatGPT provided a denoscription of it!
🫴I described the initial situation in one paragraph and requested three denoscriptions for the following scenarios:
- With optimistic locking
- With pessimistic locking
- With three-way merge in case of concurrent changes
+ I asked for sequence diagrams in the Mermaid syntax.
💬ChatGPT described everything just like in a textbook: sequentially, clearly, accurately, and specifically using my example (system names, document names – it was important for the denoscription to be concrete, not abstract). It would have taken me at least an hour to prepare such a document manually.
🍰As a bonus, I asked for a two-phase commit diagram (which we actually didn't need for this task), and ChatGPT provided a denoscription of it!
Came across an article-story from 2016: The Inner JSON Effect.
Perhaps it's an old hat for many, but I read it for the first time. After googling, I found discussions on Reddit and HackerNews.
This article could have been a great April Fools' joke, but the date doesn't match. It might just be an artistic tale in the style of surrealism.
If you thought you had seen it all in your career, including various strange DIY Frankensteins, then read the article, it's just hilarious 🤣 🤡: https://thedailywtf.com/articles/the-inner-json-effect
Perhaps it's an old hat for many, but I read it for the first time. After googling, I found discussions on Reddit and HackerNews.
This article could have been a great April Fools' joke, but the date doesn't match. It might just be an artistic tale in the style of surrealism.
If you thought you had seen it all in your career, including various strange DIY Frankensteins, then read the article, it's just hilarious 🤣 🤡: https://thedailywtf.com/articles/the-inner-json-effect
The Daily WTF
The Inner JSON Effect
Jake eagerly stepped into his new job, grateful for more experience and new challenges, craving to learn new software stacks and see what his new company had to teach him about the world of software.
They told him he’d be working on some websites, dealing…
They told him he’d be working on some websites, dealing…
I tried visualizing a flowchart based on code using ChatGPT. My request was to draw a flowchart in Mermaid syntax for the PHP code described below…
...and then there's the PHP source code, consisting of 40 lines.
The algorithm was not complex - it's a function that returns a boolean value, with several guard expressions and early exits inside. There are also some logging statements in certain places.
✅ The flowchart generated by ChatGPT using Mermaid turned out to be completely accurate, with even the locations where logging occurs being marked.
P.S. If you haven't worked with Mermaid for drawing diagrams before, give it a try: https://mermaid.js.org
...and then there's the PHP source code, consisting of 40 lines.
The algorithm was not complex - it's a function that returns a boolean value, with several guard expressions and early exits inside. There are also some logging statements in certain places.
✅ The flowchart generated by ChatGPT using Mermaid turned out to be completely accurate, with even the locations where logging occurs being marked.
P.S. If you haven't worked with Mermaid for drawing diagrams before, give it a try: https://mermaid.js.org
🔥2
This media is not supported in your browser
VIEW IN TELEGRAM
Hilarious Reaction to Discovering PHP Traits
❤4👍1
5 minutes of PHP
Hilarious Reaction to Discovering PHP Traits
Whole video: https://youtu.be/WsnHWxO7Krw?si=MEdBvdXnhLOk5sbf
YouTube
PHP Doesn't Suck Anymore? | Prime Reacts
Recorded live on twitch, GET IN
https://twitch.tv/ThePrimeagen
Reviewed video: https://www.youtube.com/watch?v=ZRV3pBuPxEQ
Channel: Aaron Francis | https://www.youtube.com/@aarondfrancis
MY MAIN YT CHANNEL: Has well edited engineering videos
https://…
https://twitch.tv/ThePrimeagen
Reviewed video: https://www.youtube.com/watch?v=ZRV3pBuPxEQ
Channel: Aaron Francis | https://www.youtube.com/@aarondfrancis
MY MAIN YT CHANNEL: Has well edited engineering videos
https://…
🔥5👍1
Vim - it's like the James Dean of text editors. It's got that cool, geeky vibe that says, "I'm not just any coder, I'm a Vim coder!"
I've never used it, but I thought I'd give it a whirl. I've heard whispers about this NeoVim thing - maybe I should just dive straight into that? Then, just the other day, I stumbled upon a review of this editor called Helix. It's another one of those "console" types, but it's taken the best bits of Vim and its disciples and rolled them into one. It's fresh off the press, 2021, and the creator calls it a post-modern text editor. It's written in Rust - what more could you want? I'm sold!
I installed it with brew install helix, fired it up with the hx command and, you know what? I couldn't get out of it! So far, so good 😂
I suspect the exit command is the same as Vim, but I've forgotten how, since I've never really used Vim. Talk about a real-life joke!
https://helix-editor.com
I've never used it, but I thought I'd give it a whirl. I've heard whispers about this NeoVim thing - maybe I should just dive straight into that? Then, just the other day, I stumbled upon a review of this editor called Helix. It's another one of those "console" types, but it's taken the best bits of Vim and its disciples and rolled them into one. It's fresh off the press, 2021, and the creator calls it a post-modern text editor. It's written in Rust - what more could you want? I'm sold!
I installed it with brew install helix, fired it up with the hx command and, you know what? I couldn't get out of it! So far, so good 😂
I suspect the exit command is the same as Vim, but I've forgotten how, since I've never really used Vim. Talk about a real-life joke!
https://helix-editor.com
🔥1😁1
They say that most of our time isn't spent writing code, but rather reading it, exploring it, and pondering over problems.
The question in this image asks, "The most time-consuming activities?" and the most popular answer is Writing Code.
But honestly, the phrasing of the answer is a bit confusing. I suspect that many of those who responded to this question might have included the entire process under "Writing Code" - that is, exploring other people's code, thinking it over, refactoring, and debugging.
This was a multiple-choice question. I suspect that many respondents first ticked "Writing Code," mentally including all possible coding activities, and then ticked more specific options like "Understanding Code" and "Debugging."
I'd be interested to see statistics on two metrics: "Typing code in the code editor (actively typing)" vs "Reviewing code, navigating through classes/methods".
Surely, this can be collected in PhpStorm automatically out of the box or with some plugin. This data would answer the question - is fast typing speed necessary or important for effective programming? My subjective opinion is - fast typing speed is necessary and important! But I'd love to see this in numbers.
Do you know how to collect such statistics from PhpStorm?
Image source: https://www.jetbrains.com/lp/devecosystem-2023/
The question in this image asks, "The most time-consuming activities?" and the most popular answer is Writing Code.
But honestly, the phrasing of the answer is a bit confusing. I suspect that many of those who responded to this question might have included the entire process under "Writing Code" - that is, exploring other people's code, thinking it over, refactoring, and debugging.
This was a multiple-choice question. I suspect that many respondents first ticked "Writing Code," mentally including all possible coding activities, and then ticked more specific options like "Understanding Code" and "Debugging."
I'd be interested to see statistics on two metrics: "Typing code in the code editor (actively typing)" vs "Reviewing code, navigating through classes/methods".
Surely, this can be collected in PhpStorm automatically out of the box or with some plugin. This data would answer the question - is fast typing speed necessary or important for effective programming? My subjective opinion is - fast typing speed is necessary and important! But I'd love to see this in numbers.
Do you know how to collect such statistics from PhpStorm?
Image source: https://www.jetbrains.com/lp/devecosystem-2023/
Join to my new Telegram channel "5 minutes of AI" - I write about my personal experience using various AI tools in programming. This isn't just another channel with copy-pasted "hot" news, only real experience and practical notes: https://news.1rj.ru/str/en_5minAI
Telegram
5 minutes of AI
Using AI tools in daily programming (GPTs, Copilot, etc.) - my real world experience and insights!
👌1
Cozy stream about PHP 8.3 release and PHP community https://www.youtube.com/live/VWryF035B6U?si=HHB2L2GYXFiVIFvm
Youtube
- YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
👍4
