Podcast
Questions and Answers
What is one of the hints for development mentioned in the text?
What is one of the hints for development mentioned in the text?
- Commit debug code for production use
- Avoid writing code in English
- Use PHP native functions without any modification
- Write short methods (correct)
Why should developers write code in English according to the text?
Why should developers write code in English according to the text?
- To confuse other developers
- To restrict the readability of the code
- To enable developers who don't speak the same language to understand it (correct)
- To make the code more difficult to maintain
What is one of the reasons mentioned in the text for not committing debug code?
What is one of the reasons mentioned in the text for not committing debug code?
- Debug code ensures error-free code
- Debug code helps in production deployment
- Debug code should be added for better readability
- Debug code is unnecessary in a production codebase (correct)
Why is committing commented out code discouraged according to the text?
Why is committing commented out code discouraged according to the text?
What do quality tools help with according to the text?
What do quality tools help with according to the text?
What practice significantly aids in producing clean code according to the text?
What practice significantly aids in producing clean code according to the text?
What is the main purpose of a repository in general?
What is the main purpose of a repository in general?
What should a method name reflect?
What should a method name reflect?
In the context of the InvoiceSimulationService, why is it not considered a 'Helper'?
In the context of the InvoiceSimulationService, why is it not considered a 'Helper'?
What does the text recommend if a method performs multiple tasks?
What does the text recommend if a method performs multiple tasks?
If you have a Team Model, what type of repository are you likely to create?
If you have a Team Model, what type of repository are you likely to create?
When should you put the SQL query in a Data Object Accessor according to the text?
When should you put the SQL query in a Data Object Accessor according to the text?
What is the suggested maximum number of lines for a method body according to Martin?
What is the suggested maximum number of lines for a method body according to Martin?
How can you reduce the length of a method that exceeds 15/20 lines?
How can you reduce the length of a method that exceeds 15/20 lines?
What does SRP stand for in the context of 'Clean code'?
What does SRP stand for in the context of 'Clean code'?
According to Martin, what is the problem with classes like 'LetterManager'?
According to Martin, what is the problem with classes like 'LetterManager'?
What suggestion does Martin give when naming classes for specific responsibilities?
What suggestion does Martin give when naming classes for specific responsibilities?
How can you improve the readability of your code according to Martin?
How can you improve the readability of your code according to Martin?
What is the exception for rearranging code in PHP for Models files?
What is the exception for rearranging code in PHP for Models files?
Why has the scalingo build image limit been increased from 1GB to 3GB?
Why has the scalingo build image limit been increased from 1GB to 3GB?
Where should Browsershot be run according to the provided information?
Where should Browsershot be run according to the provided information?
When should you rearrange your code in PHP according to the provided settings?
When should you rearrange your code in PHP according to the provided settings?
Why should you add a backslash to PHP native functions?
Why should you add a backslash to PHP native functions?
What is the minimum memory requirement to run a worker based on the text?
What is the minimum memory requirement to run a worker based on the text?
In what PHPStorm settings section should you go to auto-format your code?
In what PHPStorm settings section should you go to auto-format your code?
Why is running Telescope on staging or production discouraged?
Why is running Telescope on staging or production discouraged?
Why can integrating the php-cs-fixer rule permanently be a challenge?
Why can integrating the php-cs-fixer rule permanently be a challenge?
What action should you take in PHPStorm to reformat your code after importing a file?
What action should you take in PHPStorm to reformat your code after importing a file?
What is the main reason behind adding a backslash to PHP native functions according to the provided text?
What is the main reason behind adding a backslash to PHP native functions according to the provided text?
Why does the author recommend using infinitive verbs on buttons on the interface?
Why does the author recommend using infinitive verbs on buttons on the interface?
Why does the author mention that 'vous' is used minimally in the interface?
Why does the author mention that 'vous' is used minimally in the interface?
What is the main reason behind using 'vous' sparingly in the interface according to the text?
What is the main reason behind using 'vous' sparingly in the interface according to the text?
How does using infinitive verbs on buttons contribute to achieving the depersonalization goal in the interface?
How does using infinitive verbs on buttons contribute to achieving the depersonalization goal in the interface?
Why does the author emphasize avoiding personal commitment from users on the platform?
Why does the author emphasize avoiding personal commitment from users on the platform?
Why does the text recommend using infinitive verbs on buttons or call to action links?
Why does the text recommend using infinitive verbs on buttons or call to action links?
Why is 'vous' used sparingly in the interface according to the text?
Why is 'vous' used sparingly in the interface according to the text?
What is the primary reason for depersonalizing the interface and minimizing personal commitment from users?
What is the primary reason for depersonalizing the interface and minimizing personal commitment from users?
How does using depersonalized verbs in the infinitive form affect user interaction?
How does using depersonalized verbs in the infinitive form affect user interaction?
What is the rationale behind avoiding personal commitment from users while interacting with the SirEnergies account?
What is the rationale behind avoiding personal commitment from users while interacting with the SirEnergies account?
Study Notes
Browsershot
- Browsershot is used as a wrapper for Chromium.
- The Scalingo build image limit has been increased from 1GB to 3GB due to the installation of Chromium.
- Browsershot should not be run on web dynos, but instead on async workers, which have 192MB of RAM.
- To run Browsershot, a job must specify the queue 'browser' and workers must have a minimum of 512MB of RAM.
PHPStorm Settings
- Use the settings file 'PHPStorm - SirEnergies - 20230209.xml' to auto-format code in PHPStorm.
- Steps to import settings: go to Settings, then Editor > Code Style > PHP, click on the wheel, then Import, and select the file.
Archives
- Use the settings file 'PHPStorm - Project - 20220926.xml' to auto-format code in PHPStorm.
Clean Code
- Method bodies should be no more than 4 lines long, but 15 to 20 lines is a more reachable goal.
- Reduce long methods by grouping lines into private methods with understandable names.
- A method or class should have only one responsibility (SRP - Single Responsibility Principle).
- Classes should be named according to their responsibility, such as 'LetterSender' or 'LetterDownloader'.
Development
- Write code in English.
- Do not commit commented out code or debug code.
- Write short methods.
- A method or class should do one thing (SRP).
- Rearrange code according to the given settings.
- Add backslashes to PHP native functions.
Telescope
- Do not run Telescope on staging or production, as it has memory leaks and can cause dynos to crash.
- Enable Telescope only for debugging, and disable it immediately after.
Development Owner
- Owner: Chloé Briquet
- Tags: Clean code, Write your code in English, Do not commit commented out code, Do not commit debug code, Write short methods, Your method/class should do one thing (SRP)
Repositories
- A repository is responsible for handling data source operations.
- A repository provides a centralized way of managing database-related operations and increases code readability.
- If you have a 'Team' model, you'll likely have a 'TeamRepository'.
- All public methods of a repository should only use Eloquent methods to access data.
Action or Service?
- The repository provides a centralized way of managing database-related operations.
- If you need to write SQL, put the query in a Data Object Accessor.
Wording
- Use 'vous' with users but as little as possible.
- Use the infinitive on buttons or call to action links with only a word or noun group.
- This tone is used to depersonalize the interface and not engage users in actions.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Description
Test your knowledge on clean code development practices and best practices for writing maintainable code. Topics include writing short methods, single responsibility principle (SRP), avoiding commented out or debug code, and choosing between repositories, actions, or services.