<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Everton Schneider</title>
    <description>The latest articles on Forem by Everton Schneider (@evertones).</description>
    <link>https://forem.com/evertones</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F329627%2F5b371120-fef7-416e-9fba-56908b2fa08c.jpeg</url>
      <title>Forem: Everton Schneider</title>
      <link>https://forem.com/evertones</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/evertones"/>
    <language>en</language>
    <item>
      <title>Book: How To Lie with Statistics - Bias</title>
      <dc:creator>Everton Schneider</dc:creator>
      <pubDate>Tue, 02 Apr 2024 02:06:13 +0000</pubDate>
      <link>https://forem.com/evertones/book-how-to-lie-with-statistics-bias-1cf3</link>
      <guid>https://forem.com/evertones/book-how-to-lie-with-statistics-bias-1cf3</guid>
      <description>&lt;p&gt;The book &lt;a href="https://www.amazon.com/How-Lie-Statistics-Darrell-Huff/dp/0393310728"&gt;How To Lie with Statistics&lt;/a&gt;, by Darrel Huff, has great views on how to analyze data. After reading this book, good questions arise from any discussion or affirmation that you may hear from friends, news, articles, and so many other sources.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"A great introduction to the use of statistics, and a great refresher for anyone who's already well versed in it." (Bill Gates)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The book contains 10 chapters and I will write down an article for each one of them. It must avoid suppressing the richness of the content found in the book.&lt;/p&gt;

&lt;p&gt;The book chapters are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The Sample with Built-in Bias&lt;/li&gt;
&lt;li&gt;The Well-Chosen Average&lt;/li&gt;
&lt;li&gt;The Little Figures That Are Not There&lt;/li&gt;
&lt;li&gt;Much Ado about Practically Nothing&lt;/li&gt;
&lt;li&gt;The Gee-Whiz Graph&lt;/li&gt;
&lt;li&gt;One-Dimensional Picture&lt;/li&gt;
&lt;li&gt;The Semiattached Figure&lt;/li&gt;
&lt;li&gt;Post Hoc Rides Again&lt;/li&gt;
&lt;li&gt;How to Statisticulate&lt;/li&gt;
&lt;li&gt;How to Talk Back to a Statistic&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Below is the article for the first chapter.&lt;/p&gt;

&lt;h1&gt;
  
  
  1. The Sample with Built-in Bias
&lt;/h1&gt;

&lt;p&gt;The book begins by saying that in the New York Magazine once there was a comment saying that the AVERAGE of a man who studied at Yale, in the class of '24, "makes $25,111 a year".&lt;/p&gt;

&lt;p&gt;What exactly does it mean?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If you send your boy to Yale, you won't have to work in your old age, and neither will he&lt;/li&gt;
&lt;li&gt;This number is too precise&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This kind of information is usually taken from surveys. Some people may say they get more than they do because they're vain, some people may say they make less, afraid to pay more taxes, and some people may not even know exactly how much they make every year, since they could have investments and other types of income.&lt;/p&gt;

&lt;p&gt;People that has answered the survey are a sample of all students from Yale's class of '24, therefore, there source that can produce $25,111 as the "average income" of some men whose actual average may well be nearer half of that amount.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It is sad truth that conclusions from such samples, biased or too small or both, lie behind much of what we read or think we know.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;How to be so sure it was taken from a sample?&lt;/p&gt;

&lt;p&gt;What's in the magazine about the "class of '24" was published about 25 years later. Many of the addresses (or contacts) from the "class of '24" would not be reached 25 years later. Those whose addresses are known, could not respond.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;So we find that the income figure is based on a sample composed of all class members whose addresses are known and who replied to the questionnaire.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Who are the lost sheep down in Yale rolls as "address unknown"? Are they big-income earners? (usually, the address of the rich are easy to find). It is a good guess that the lost names are those of the men who, 25 years or so after becoming Yale Bachelors of Arts, have not fulfilled any shining promise, part of the low-paid market. &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Psychiatrist
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;A psychiatrist reported once that practically everybody is neurotic.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Who has the psychiatrist been observing? It turns out that he has reached this edifying conclusion from studying his patients, who are a long way from being a sample of the population. If a man were normal, our psychiatrist would never meet him.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Literary Digest's famed fiasco (Elections 1936)
&lt;/h2&gt;

&lt;p&gt;The ten million telephone and Digest's subscribers who assured the editors of the doomed magazine that it would be Landon 370, Roosevelt 161 came from the list that had accurately predicted the 1932 election. If the list has been tested before, how could there be a bias in it?&lt;/p&gt;

&lt;p&gt;There was. People who could afford telephones and magazine subscribers in 1936 were not a cross-section of voters.&lt;/p&gt;

&lt;p&gt;The basic sample is the kind called "random", however, it could select all the answers from the same city or neighbourhood.&lt;/p&gt;

&lt;p&gt;As seen, the tendency of the sample to be biased in this consistent direction can rig it automatically. &lt;/p&gt;

</description>
      <category>books</category>
      <category>career</category>
      <category>datascience</category>
      <category>analytics</category>
    </item>
    <item>
      <title>Book: Eat That Frog: 21 Ways to Stop Procrastinating</title>
      <dc:creator>Everton Schneider</dc:creator>
      <pubDate>Sun, 17 Dec 2023 02:44:38 +0000</pubDate>
      <link>https://forem.com/evertones/book-eat-that-frog-21-ways-to-stop-procrastinating-37np</link>
      <guid>https://forem.com/evertones/book-eat-that-frog-21-ways-to-stop-procrastinating-37np</guid>
      <description>&lt;p&gt;The book &lt;strong&gt;Eat that Frog!&lt;/strong&gt; by &lt;a href="https://en.wikipedia.org/wiki/Brian_Tracy"&gt;Brian Tracy&lt;/a&gt; lists greatly, a pack of "rules" that can help people to stop procrastinating.&lt;br&gt;
Of course, it is never that easy, but some techniques can always help.&lt;/p&gt;

&lt;p&gt;This article has all the 21 rules in a quick overview.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Set the table
&lt;/h3&gt;

&lt;p&gt;Before anything, decide what you need or must do. Your purpose. Write it down, set a deadline, make a plan and do it.&lt;br&gt;
Yes, &lt;strong&gt;write it down&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Plan Every Day in Advance
&lt;/h3&gt;

&lt;p&gt;Planning your day should take 10 to 12 minutes, but it is said to save you up to 2 hours in wasted time in your future day.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Apply the 80/20 Rule to Everything
&lt;/h3&gt;

&lt;p&gt;Focus on the top 20% most important work you have to do. They will represent 80% of what must be delivered.&lt;/p&gt;

&lt;p&gt;If you have a list of ten items to do, two of those items will turn out to be worth much more than the other eight items put together.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Consider the consequences
&lt;/h3&gt;

&lt;p&gt;You will never have enough time to do everything you need to do.&lt;br&gt;
People need to have long-term plans and be aware of what can be left aside that will not become a problem to achieve the long-term goal.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Practice Proactive Procrastination
&lt;/h3&gt;

&lt;p&gt;The fact is that you cannot do everything that you have to do. You have to procrastinate on something.&lt;/p&gt;

&lt;p&gt;So, do the &lt;strong&gt;worst first&lt;/strong&gt;! The biggest and most complicated. Eat the big frost first.&lt;/p&gt;

&lt;p&gt;Decide to outsource, delegate, and eliminate those activities that don't make much of a contribution to your life.&lt;/p&gt;

&lt;p&gt;Learn to say &lt;em&gt;no!&lt;/em&gt;, and say it politely.&lt;/p&gt;

&lt;p&gt;To do something new, you will need to stop doing something old.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Use the ABCDE Method Continually
&lt;/h3&gt;

&lt;p&gt;Make a list of everything you need to do for your next day. Write it down on a paper.&lt;/p&gt;

&lt;p&gt;Beside each item, assign a letter A, B, C, D or E in an order of importance (A: most important; E less important).&lt;/p&gt;

&lt;p&gt;Never, ever do a task marked with B, before a task marked as A.&lt;/p&gt;

&lt;p&gt;Tasks marked as D can probably be delegated. Tasks marked as E can probably be eliminated.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Focus on Key Result Areas
&lt;/h3&gt;

&lt;p&gt;A key result area is something that, if you don't do, does not get done.&lt;/p&gt;

&lt;p&gt;Discuss it with your boss, understand what is your purpose for the company or team, and work on it.&lt;/p&gt;

&lt;p&gt;Give yourself a grade. Search areas where you are doing a good job and areas that you must improve.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You may be only one critical skill away from top performance at your job.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Ask yourself:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What one skill, if I develop and do it in an excellent fashion, would have the greatest positive impact on my career?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Decide on doing these analyses regularly for the rest of your career. Never stop improving. This decision alone can change your life.&lt;/p&gt;

&lt;h3&gt;
  
  
  8. Apply the Law of Three
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;In thirty seconds, write down your three most important goals in life right now.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In 80% or more of the cases, people will have the three first things in common:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;a financial and career goal&lt;/li&gt;
&lt;li&gt;family or relationship goal&lt;/li&gt;
&lt;li&gt;heal or fitness goal&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;Rule: it is the quality of time at work that counts and the quantity of time at home that matters.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Don't waste time. Time that you waste at work often has to be taken away from your family.&lt;/p&gt;

&lt;p&gt;And, the more time you spend face-to-face with the people you love, the happier you will be.&lt;/p&gt;

&lt;h3&gt;
  
  
  9. Prepare Thoroughly Before You Begin
&lt;/h3&gt;

&lt;p&gt;Create a comfortable workspace, be it at home or work.&lt;br&gt;
Don't expect perfection the first time, or even the first few times.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You miss 100% of the shots you don't take&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Feel effective, efficient, and ready to get going each time you sit down to work.&lt;/p&gt;

&lt;h3&gt;
  
  
  10. Take it One Oil Barrel at a Time
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;By the yard it's hard; but inch by inch, anything is a cinch!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You need to get your mind off the big task in front of you and focus on a single action that you can take.&lt;/p&gt;

&lt;p&gt;One of the best ways to eat a big frog is to take it one bite at a time.&lt;/p&gt;

&lt;h3&gt;
  
  
  11. Upgrade Your Key Skills
&lt;/h3&gt;

&lt;p&gt;Upgrading your skills is one of the most important personal productivity principles of all.&lt;/p&gt;

&lt;p&gt;Always remember, however good you are today, your knowledge and skills are becoming obsolete at a rapid rate.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Rule: Continuous learning is the minimum requirement for success in any field.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Three Steps to Mastery
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Read in your field for at least one hour every day.&lt;/li&gt;
&lt;li&gt;Take every course and seminar available on the key skills that can help you. Dedicate yourself to becoming one of the most knowledgeable and competent people in your field.&lt;/li&gt;
&lt;li&gt;Listen to audio programs in your car.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  12. Identify Your Key Constraints
&lt;/h3&gt;

&lt;p&gt;Between where you are and the goal you want to achieve, there are constraints. Your job is to identify what could be holding you back clearly.&lt;/p&gt;

&lt;p&gt;This could be hard to find, but if there are a few constraints, you can apply the 80/20 Rule to work on them.&lt;/p&gt;

&lt;p&gt;There are 80% of the constraints that are internal. They are within you, your qualities, abilities, and habits.&lt;/p&gt;

&lt;p&gt;There are 20% of the limiting factors that are external - competition, markets, governments, or other organizations.&lt;/p&gt;

&lt;p&gt;Try to identify what could be acting as a brake on the achievement of your goals.&lt;/p&gt;

&lt;h3&gt;
  
  
  13. Put the Pressure on Yourself
&lt;/h3&gt;

&lt;p&gt;The problem is: no one is coming to rescue you.&lt;/p&gt;

&lt;p&gt;Only 2% of people can work entirely without supervision. They are called &lt;strong&gt;leaders&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;To reach your full potential, you must form the habit of putting pressure on yourself.&lt;/p&gt;

&lt;p&gt;Raise your bar. Push yourself to be better every day.&lt;/p&gt;

&lt;p&gt;Work as though you had only one day to get your most important jobs done.&lt;/p&gt;

&lt;p&gt;By putting pressure on yourself, you will accomplish more tasks better and faster than ever. You will become a high-performance, high-achieving personality.&lt;/p&gt;

&lt;h3&gt;
  
  
  14. Motivate Yourself into Action
&lt;/h3&gt;

&lt;p&gt;To keep yourself motivated, you must resolve to become an &lt;em&gt;optimist&lt;/em&gt;. You must decide to respond positively to the words, actions and reactions of the people and situations around you. You must refuse to let the unavoidable difficulties and setbacks of daily life affect your mood or emotions.&lt;/p&gt;

&lt;h4&gt;
  
  
  Control Your Inner Dialogue
&lt;/h4&gt;

&lt;p&gt;Say, "I like myself! I like myself!".&lt;br&gt;
Say, "I can do it!, I can do it!".&lt;br&gt;
Say, "I feel terrific!".&lt;/p&gt;

&lt;p&gt;As speaker-humorist Ed Foreman says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You should never share your problems with others because 80% of people don't care about them anyway, and the other 20% are kind of glad that you've got them in the first place.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Develop Mental Positive Attitude
&lt;/h4&gt;

&lt;p&gt;Optimism is the most important quality you can develop for personal and professional success and happiness. Optimistic people seem to be more effective in almost every area of life.&lt;/p&gt;

&lt;p&gt;It turns out that optimists have four special behaviors:&lt;/p&gt;

&lt;p&gt;First: &lt;em&gt;look for the good&lt;/em&gt;.&lt;br&gt;
Second: &lt;em&gt;see the valuable lesson in every setback or difficulty&lt;/em&gt;.&lt;br&gt;
Third: &lt;em&gt;look for the solution to every problem&lt;/em&gt;.&lt;br&gt;
Fourth: &lt;em&gt;think and talk continually about their goals&lt;/em&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  15. Technology Is a Terrible Master
&lt;/h3&gt;

&lt;p&gt;Technology can be your best friend or your worst enemy. It becomes the enemy when we give in to an obsessive need to communicate continually.&lt;/p&gt;

&lt;p&gt;When people are too plugged in, communications technology quickly becomes a destructive addiction.&lt;/p&gt;

&lt;p&gt;Apply the 80/20 Rule to your emails. There are 80% of your message with no value. Of the other 20%, only about 4% require immediate responses. The other 16% could be transferred to an action folder to be worked on later.&lt;/p&gt;

&lt;p&gt;Unsubscribe from all unwanted newsletters.&lt;/p&gt;

&lt;p&gt;If there is something really important that you are afraid to miss by not being connected, it always ends up that if it is really important, someone will tell you.&lt;/p&gt;

&lt;h3&gt;
  
  
  16. Technology Is a Wonderful Servant
&lt;/h3&gt;

&lt;p&gt;You must discipline yourself to treat technology as a servant, not as a master.&lt;/p&gt;

&lt;p&gt;Make sure that only the communication channels you need to complete your task are opened.&lt;/p&gt;

&lt;p&gt;Show your smartphone who is the boss by disabling all notifications - both audio and visual.&lt;/p&gt;

&lt;p&gt;Segment your communication channels so that only frogs can hop into your castle of concentration.&lt;/p&gt;

&lt;p&gt;Take control of your time with a to-do list. It is a powerful tool for taking control of your time. It can be programmed to remind you about the most important tasks.&lt;/p&gt;

&lt;p&gt;And, if you become frustrated, just remember that it happens to everyone; even expert programmers who make hundreds of dollars per hour will sometimes be frustrated with technology.&lt;/p&gt;

&lt;h3&gt;
  
  
  17. Focus Your Attention
&lt;/h3&gt;

&lt;p&gt;Focused attention is the key to high performance.&lt;/p&gt;

&lt;p&gt;Current research proves that continuously responding and reacting to e-mails, telephone calls, texts, and instant messages has a negative effect on your brain, shortening your attention span and making it difficult, if not impossible, for you to complete the tasks.&lt;/p&gt;

&lt;h4&gt;
  
  
  Developing an Addiction
&lt;/h4&gt;

&lt;p&gt;When you check your e-mail, first thing in the morning or when you respond to the bell or other sound that indicates an incoming e-mail or message, your brain releases a tiny shot of &lt;strong&gt;dopamine&lt;/strong&gt;. This shot gives you a pleasant "buzz". &lt;/p&gt;

&lt;p&gt;When you start your day with a few shots of dopamine triggered by your e-mail or IM bell going off, you find it extremely difficult to pay close attention to your important tasks for the rest of the day.&lt;/p&gt;

&lt;h4&gt;
  
  
  The Multitasking Illusion
&lt;/h4&gt;

&lt;p&gt;People can focus only on one thing at a time. When people say that they can do more than one thing at a time, they are doing what is called &lt;em&gt;task shifting&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;After an Internet interruption, it takes about 17 minutes for you to shift your total attention back to your task and continue working.&lt;/p&gt;

&lt;h4&gt;
  
  
  The Proven Solutions
&lt;/h4&gt;

&lt;p&gt;Do NOT check your e-mail in the morning and immediately trigger the all-day dopamine addiction. Leave your devices off.&lt;/p&gt;

&lt;p&gt;Decide to check your e-mails only twice a day, at 11am and 3pm.&lt;/p&gt;

&lt;p&gt;Never insult the person you are meeting with by working on your laptop or answering your phone. Pay 100% attention to the other people. This applies at home as well.&lt;/p&gt;

&lt;h4&gt;
  
  
  Double Your Productivity
&lt;/h4&gt;

&lt;p&gt;Plan each day in advance, select your most important task, and then start on that task first thing, before you do anything else.&lt;/p&gt;

&lt;p&gt;Work for &lt;strong&gt;90 minutes without any break&lt;/strong&gt;, then give yourself a &lt;strong&gt;15 minutes break&lt;/strong&gt;. Keep doing it repeatedly.&lt;/p&gt;

&lt;h3&gt;
  
  
  18. Slice and Dice the Task
&lt;/h3&gt;

&lt;p&gt;To cut a big task down to size is the "salami slice" method.&lt;/p&gt;

&lt;p&gt;When you start and finish a small piece of a task, you feel motivated to start and finish another part, the other one, and so on.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I have several friends who have become bestselling authors by simply resolving to write one page or even one paragraph per day until the book was completed.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  19. Create Large Chunks of Time
&lt;/h3&gt;

&lt;p&gt;Schedule large chinks of time for a designated task. Let's say, use the time between 10am and 11am to call all your clients that you need to get feedback from.&lt;/p&gt;

&lt;p&gt;As a result of the well-defined time for the task, you become more and more productive and eventually produce two times, three times as much as an average person.&lt;/p&gt;

&lt;p&gt;Get up 3 hours earlier and work it without interruptions at home. You can get three times more work done at home without interruptions.&lt;/p&gt;

&lt;p&gt;One of the keys to high levels of performance and productivity is to make every minute count.&lt;/p&gt;

&lt;h3&gt;
  
  
  20. Develop a Sense of Urgency
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Do not wait: the time will never be "just right".&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;High-performing men and women have the quality of "action orientation". They are in a hurry to get their key tasks completed.&lt;/p&gt;

&lt;p&gt;As a result, they seem to power through enormous amounts of work in the same amount of time that the average person spends socializing, wasting time, and working on low-value activities.&lt;/p&gt;

&lt;p&gt;Develop a sense of urgency. A sense of urgency feels very much like running against yourself. You concentrate on the things you can do right now to get the results you want to achieve the goals you desire.&lt;/p&gt;

&lt;p&gt;The faster you move, the more impelled you feel to do even more even faster. You enter "the zone".&lt;/p&gt;

&lt;h4&gt;
  
  
  Build a Sense of Momentum
&lt;/h4&gt;

&lt;p&gt;Although it may be tremendous amounts of energy to overcome inertia and get started initially, it. then takes far less energy to keep going.&lt;/p&gt;

&lt;p&gt;The faster you move, the more competent and capable you become at your work.&lt;/p&gt;

&lt;p&gt;A sense of urgency shifts you automatically onto the fast track in your career.&lt;/p&gt;

&lt;h4&gt;
  
  
  Do It Now!
&lt;/h4&gt;

&lt;p&gt;One of the simplest things to repeat to yourself: "Do it now! Do it now! Do it now!". "Back to work! Back to work! Back to work!".&lt;/p&gt;

&lt;p&gt;Nothing will help you more in your career than for you to get the reputation for being the kind of person who gets important work done quickly and well.&lt;/p&gt;

&lt;h3&gt;
  
  
  21. Single Handle Task
&lt;/h3&gt;

&lt;p&gt;By concentrating single-mindedly on your most important task, you can reduce the time required to complete it by 50% or more.&lt;/p&gt;

&lt;p&gt;When you prepare thoughroughly and then begin, refusing to stop or turn aside until the job is done, you develop energy, enthusism, and motivation.&lt;/p&gt;

&lt;p&gt;Once you have decided on your number one task, anything else that you do other than that is a waste of time.&lt;/p&gt;

&lt;p&gt;Elbert Hubbart defines &lt;em&gt;self-discipline&lt;/em&gt; as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;the ability to make yourself do what you should do, when you should do it, whether you feel like it or not.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Once you start your most important task, discipline yourself to persevere without diversion or distraction until it is 100% complete.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Develope the habit of eating your frog first thing every day when you start work. Repeat it every day.&lt;/p&gt;

&lt;p&gt;Review the 21 rules and principles regularly until they become firmly ingrained in your thinkgin and actions, and your future will be guaranteed.&lt;/p&gt;

&lt;p&gt;Make a decision to practive these principles every day until they become second nature to you.&lt;/p&gt;

&lt;p&gt;Just do it! &lt;em&gt;Eat that frog!&lt;/em&gt;.&lt;/p&gt;

</description>
      <category>books</category>
      <category>career</category>
      <category>productivity</category>
      <category>learning</category>
    </item>
    <item>
      <title>What does an automation tester do?</title>
      <dc:creator>Everton Schneider</dc:creator>
      <pubDate>Wed, 30 Aug 2023 14:29:49 +0000</pubDate>
      <link>https://forem.com/evertones/what-does-an-automation-tester-do-18g6</link>
      <guid>https://forem.com/evertones/what-does-an-automation-tester-do-18g6</guid>
      <description>&lt;p&gt;Recently I’ve watched a great talk from &lt;a href="https://seleniumconf.com/"&gt;Selenium Conf 2023&lt;/a&gt; by &lt;a href="https://github.com/mwinteringham"&gt;Mark Winteringham&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;He could expose something that I believe most professionals cannot realise. &lt;/p&gt;

&lt;p&gt;Automation testers focused too much in their technical skills.&lt;/p&gt;

&lt;p&gt;To help to elaborate that, Mark asks 2 questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;what we try to say we do?&lt;/li&gt;
&lt;li&gt;what we are really doing?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What do we try to say we do?
&lt;/h3&gt;

&lt;p&gt;The first thing that called my attention was his research based on a job website (surprisingly not LinkedIn), collecting information about job roles.&lt;/p&gt;

&lt;p&gt;Most of the automation testers try to expose that they have knowledge about tools (Java, JavaScript, Python, JUnit, Test NG, Selenium, Cucumber, Cypress, Playwright, Rest Assured, Postman, SOAP UI - the list is long).&lt;/p&gt;

&lt;p&gt;We focus on these things, like if they represent the importance of what we do. It seems that it is more important to know how to use a tool or technology than to test something well.&lt;/p&gt;

&lt;p&gt;From Mark's research, he sorted testing job skills in 3 different areas:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hYukXCq6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uupgh3toejs8z6douwf1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hYukXCq6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uupgh3toejs8z6douwf1.png" alt="Image description" width="800" height="559"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;He listed jobs on the Indeed website and classified them. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Testing skills (31%)

&lt;ul&gt;
&lt;li&gt;Risk analyses&lt;/li&gt;
&lt;li&gt;Writing and raising bugs reports&lt;/li&gt;
&lt;li&gt;Ensuring quality &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Automation skills (33%)

&lt;ul&gt;
&lt;li&gt;Maintaining flaky tests&lt;/li&gt;
&lt;li&gt;Set up environments&lt;/li&gt;
&lt;li&gt;Set up pipelines&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Tools skills (36%)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After all, the majority of jobs list more tools than testing or automation skills.&lt;/p&gt;

&lt;p&gt;But, should we focus on the tools, or the principles?&lt;/p&gt;

&lt;h3&gt;
  
  
  What are we really doing?
&lt;/h3&gt;

&lt;p&gt;There isn’t any right answer for this question, however, Mark asks the audience to write down 3 simple things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What do we do on a daily basis?&lt;/li&gt;
&lt;li&gt;What do we do on a weekly basis?&lt;/li&gt;
&lt;li&gt;What do we do on a monthly basis?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After answering these 3 questions, we can start to think more clearly about what we do.&lt;/p&gt;

&lt;p&gt;Automation testers need different skills that are not directly related to any technology or tool:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;plan tests&lt;/li&gt;
&lt;li&gt;set up pipelines&lt;/li&gt;
&lt;li&gt;understand system requirements&lt;/li&gt;
&lt;li&gt;report defects&lt;/li&gt;
&lt;li&gt;prioritise tasks&lt;/li&gt;
&lt;li&gt;write down documentation&lt;/li&gt;
&lt;li&gt;communicate with the team&lt;/li&gt;
&lt;li&gt;investigate issues&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of these are specifically related to tools or technologies, but they are all testing skills required to do the daily basis work.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The image of what an automator is, is not the same as we are actually doing or getting involved in.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;By the end of the talk, Mark listed some things that an automator does:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--onkCjMuF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iembjx52aov2qysd6eat.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--onkCjMuF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iembjx52aov2qysd6eat.png" alt="Image description" width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To me, it was a great talk to reflect over testing skills. We usually focus heavily on learning and specialising in tools, but we usually leave basic principles aside.&lt;/p&gt;

&lt;p&gt;The talk from Mark is available on YouTube:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://youtu.be/pT20Ssc7y6I?si=yYK9ZE3HfdWDj1dO"&gt;What Exactly Do You Do in Test Automation?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>qa</category>
      <category>testing</category>
      <category>automation</category>
      <category>career</category>
    </item>
    <item>
      <title>Tips to avoid unstable tests in Selenium</title>
      <dc:creator>Everton Schneider</dc:creator>
      <pubDate>Mon, 24 Apr 2023 03:30:23 +0000</pubDate>
      <link>https://forem.com/evertones/how-to-seek-stability-in-selenium-tests-1ie6</link>
      <guid>https://forem.com/evertones/how-to-seek-stability-in-selenium-tests-1ie6</guid>
      <description>&lt;p&gt;Selenium tests are hard to maintain. They can get flaky and present intermittent failures as their codebase grows.&lt;/p&gt;

&lt;p&gt;I will list a few things that I've seen as effective to make Selenium tests stable, running a suite of ~10K tests.&lt;/p&gt;

&lt;h4&gt;
  
  
  TL;DR;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Test code must be treated as seriously as development code (do code review, use best practices);&lt;/li&gt;
&lt;li&gt;Track the problems creating bugs for failures;&lt;/li&gt;
&lt;li&gt;Use Page Objects;&lt;/li&gt;
&lt;li&gt;Understand how Selenium wait works (implicit, explicit) and to use &lt;code&gt;WebDriverWait&lt;/code&gt; and &lt;code&gt;ExpectedConditions&lt;/code&gt; classes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. Treat test code in the same way you treat development code
&lt;/h2&gt;

&lt;p&gt;Test code is not different from development code. They act in different areas of the software, but they should be treated with the same respect.&lt;/p&gt;

&lt;p&gt;The more effort is put in having good code for automated tests, fewer problems are found when maintaining the test suites.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do code review
&lt;/h3&gt;

&lt;p&gt;Code for automated tests MUST be reviewed. They have to be treated with respect, and the reviewer has to be as strict as he or she is with the code from the developers.&lt;/p&gt;

&lt;p&gt;E2E code is widely seen as expensive and unstable. Code review helps to organize the code in reusable components, enforce using better selectors (&lt;code&gt;css&lt;/code&gt;, &lt;code&gt;id&lt;/code&gt;, &lt;code&gt;name&lt;/code&gt; or even &lt;code&gt;xpath&lt;/code&gt;), check code semantics, ensure it has good logging, verify that it is well-documented and that errors are handled properly (etc, etc, etc).&lt;/p&gt;

&lt;p&gt;When code review is taking seriously for E2E tests (or any automated test), the consistency of the codebase enforces standards that result in more stability in tests execution, reducing the issues seen when running E2E tests frequently, or after new releases.&lt;/p&gt;

&lt;h3&gt;
  
  
  Request for best practices
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://martinfowler.com/bliki/PageObject.html"&gt;Page Objects&lt;/a&gt; have been around for a long time. They are a solid pattern to be used. However, it is not the only thing to be used.&lt;/p&gt;

&lt;p&gt;Create random data to enter in fields for tests. There are many libraries that can help (e.g. &lt;a href="https://www.baeldung.com/java-faker"&gt;DataFaker&lt;/a&gt;, &lt;a href="https://github.com/Devskiller/jfairy"&gt;jFairy&lt;/a&gt;). &lt;strong&gt;Do not&lt;/strong&gt; use static values.&lt;/p&gt;

&lt;p&gt;Use the &lt;a href="https://www.digitalocean.com/community/tutorials/builder-design-pattern-in-java"&gt;Builder pattern&lt;/a&gt; to create instances of entities.&lt;/p&gt;

&lt;p&gt;Inject sessions to skip repeatedly log-in operations.&lt;/p&gt;

&lt;p&gt;Keep specifications small. Try to set up a threshold for the overall time it takes to run (I use 5 minutes as a reference).&lt;/p&gt;

&lt;p&gt;Use DSL, if convenient.&lt;/p&gt;

&lt;p&gt;Choose a good a testing library to perform assertions (&lt;a href="https://junit.org/junit4/"&gt;JUnit&lt;/a&gt;, &lt;a href="https://testng.org/"&gt;TestNG&lt;/a&gt;, &lt;a href="https://www.scalatest.org/"&gt;ScalaTest&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Run tests over a CI server (&lt;a href="https://www.jenkins.io"&gt;Jenkins&lt;/a&gt;, &lt;a href="https://www.jetbrains.com/teamcity"&gt;TeamCity&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Scale the execution using &lt;a href="https://www.selenium.dev/documentation/grid/"&gt;Selenium Grid&lt;/a&gt; - it is easy with &lt;a href="https://github.com/SeleniumHQ/docker-selenium"&gt;Docker Selenium&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Use Page Objects
&lt;/h4&gt;

&lt;p&gt;As said before, Page Objects are already mature enough to be called a pattern.&lt;/p&gt;

&lt;p&gt;They can be used not only to map pages, but also components.&lt;/p&gt;

&lt;h5&gt;
  
  
  Pages
&lt;/h5&gt;

&lt;p&gt;Page is a UI representation that must be reusable in the codebase. Different test cases can access the same page and its code must be shared (e.g. the system's landing page).&lt;/p&gt;

&lt;p&gt;The page class must contain fields and methods to interact with the web elements that are present on the UI.&lt;/p&gt;

&lt;h5&gt;
  
  
  Components
&lt;/h5&gt;

&lt;p&gt;A page is composed of many different web components. They can be seen as inputs, dropdowns, custom elements and so on.&lt;/p&gt;

&lt;p&gt;A component can be reusable along different pages. They should be wrapped in a specific class that can be instantiated in different pages, similar with how the front-end codebase declare them.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Create bugs for all issues
&lt;/h2&gt;

&lt;p&gt;All tests that fail and need to be fixed need an issue in the issue tracker system. As much as any intermittent failure needs to have one.&lt;/p&gt;

&lt;p&gt;When creating issues for all failures seen, issues in automated tests can be tracked. When issues can be tracked, they can be prioritized and, if they can be prioritized, they can be fixed in an order that helps the suite of tests to become more stable.&lt;/p&gt;

&lt;p&gt;Remember:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;if a test case is failing consistently (it can even be reproduced manually): create a ticket to fix it.&lt;/li&gt;
&lt;li&gt;if a test case is failing intermittently: create a ticket to investigate and fix it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There must be no fear for tickets. They serve to help.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Implement custom waiting
&lt;/h2&gt;

&lt;p&gt;Page load is probably the thing that mostly impacts in Selenium tests performance. They are hard to predict and sometimes lead to intermittent failures.&lt;/p&gt;

&lt;p&gt;If a screenshot is taken by the time that a Selenium test fails, it reveals commonly that there is something still loading on the page (the page itself or one of its components).&lt;/p&gt;

&lt;p&gt;It is extremely important to understand how to implement a mechanism for Selenium to apply some waiting time.&lt;/p&gt;

&lt;h3&gt;
  
  
  Implicit Wait
&lt;/h3&gt;

&lt;p&gt;Implicit wait is defined by values that are set up in the WebDriver instance.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Specifies the amount of time the driver should wait when searching for an element if it is not immediately present.
webDriver.manage.timeouts.implicitlyWait(3) 
// Sets the amount of time to wait for a page load to complete before throwing an error
webDriver.manage.timeouts.pageLoadTimeout(6)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are default values set in the WebDriver that will be used between starting the web browser (&lt;code&gt;webDriver.get(url)&lt;/code&gt;) and closing it (&lt;code&gt;webDriver.quit()&lt;/code&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  Explicit Wait
&lt;/h3&gt;

&lt;p&gt;Implicit wait is not always effective. Pages and their elements can take different time to load.&lt;/p&gt;

&lt;p&gt;An exception like &lt;a href="https://www.selenium.dev/selenium/docs/api/java/org/openqa/selenium/NoSuchElementException.html"&gt;&lt;code&gt;NoSuchElementException&lt;/code&gt;&lt;/a&gt; is commonly thrown when Selenium cannot find the element to interact with on the page.&lt;/p&gt;

&lt;p&gt;If the element is excepted to be on the page, it is possible to use other strategies to wait for it, for longer than the &lt;strong&gt;Implicit Wait&lt;/strong&gt; set into the &lt;code&gt;WebDriver&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This can be achieved combining the &lt;code&gt;WebDriverWait&lt;/code&gt; and the &lt;code&gt;ExpectedConditions&lt;/code&gt; and is called &lt;strong&gt;Explicit Wait&lt;/strong&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;code&gt;WebDriverWait&lt;/code&gt; and &lt;code&gt;ExpectedConditions&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;The API for the &lt;code&gt;ExpectedConditions&lt;/code&gt; is rich and very clear. It is used internally inside an instance of the &lt;code&gt;WebDriverWait&lt;/code&gt; class, passing by parameter also the time that it should wait for the condition.&lt;/p&gt;

&lt;p&gt;Below some self-explanatory examples:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Instantiate the `WebDriverWait` with `15` seconds as the limt time to wait for a condition
WebDriverWait = bew WebDriverWait(driver, 15)

// Find an element on the page
WebElement element = webDriver.findElement(By.id('main'));

// Wait for an element to be stale
seleniumWait.until(ExpectedConditions.stalenessOf(element));

// Wait for an element to be visible
seleniumWait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(".button"));

// Wait for an element to be invisible
seleniumWait.until(ExpectedConditions.invisibilityOfElementLocated(element));

// Combined condition: all 3 elements must be clickable
seleniumWait.until(
    ExpectedConditions.and(             
        ExpectedConditions.elementToBeClickable(By.id("a")),
        ExpectedConditions.elementToBeClickable(By.id("b)),
        ExpectedConditions.elementToBeClickable(By.id("c"))
    )
)

// Wait for 2 elements present on the DOM
seleniumWait.until(ExpectedConditions.numberOfElementsToBeMoreThan(By.cssSelector(".button"), 2))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The API for the &lt;a href="https://www.selenium.dev/selenium/docs/api/java/org/openqa/selenium/support/ui/ExpectedConditions.html"&gt;&lt;code&gt;ExpectedConditions&lt;/code&gt;&lt;/a&gt; class is rich and easy to understand. There are many methods that can help the conditions that could help to add stability to tests that rely on elements that take longer than expected to be ready to interact with.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. It's not all
&lt;/h2&gt;

&lt;p&gt;Surely this is an endless discussion, and many other things could be added to the article above that contribute to having stable tests implemented with Selenium.&lt;/p&gt;

</description>
      <category>selenium</category>
      <category>devops</category>
      <category>testing</category>
      <category>automation</category>
    </item>
    <item>
      <title>System Design: Basic approaches</title>
      <dc:creator>Everton Schneider</dc:creator>
      <pubDate>Mon, 27 Mar 2023 21:13:16 +0000</pubDate>
      <link>https://forem.com/evertones/system-design-basic-approaches-54mi</link>
      <guid>https://forem.com/evertones/system-design-basic-approaches-54mi</guid>
      <description>&lt;p&gt;System design is a very important topic in the technology industry today. It doesn't matter whether working in a decision-making role or as part of a development team, having a basic understanding of system design is essential.&lt;/p&gt;

&lt;h4&gt;
  
  
  TL;DR;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Systems need to adapt to their requirements as they are created or as they grow:

&lt;ul&gt;
&lt;li&gt;respond faster;&lt;/li&gt;
&lt;li&gt;respond to more simultaneous users;&lt;/li&gt;
&lt;li&gt;use more storage;&lt;/li&gt;
&lt;li&gt;be highly available.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;To adapt, systems have to scale. They basically must use vertical or horizontal scalability techniques.&lt;/li&gt;

&lt;li&gt;Scalability must consider the costs to implement each different solution.&lt;/li&gt;

&lt;li&gt;Basic System Designs:

&lt;ul&gt;
&lt;li&gt;1 server (application + database);&lt;/li&gt;
&lt;li&gt;2 servers (1 for application, 1 for database);&lt;/li&gt;
&lt;li&gt;Load Balancer (many application servers).&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Database strategies beyond how to set up hardware can also apply:

&lt;ul&gt;
&lt;li&gt;Database normalization or denormalization.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;One of the major challenges for professionals in IT is system scalability. Planning how to design a system to meet all non-functional requirements is challenging and uncertain.&lt;/p&gt;

&lt;p&gt;The design must be carefully assessed before releasing a system, or it needs to be reviewed after problems arise.&lt;/p&gt;

&lt;p&gt;This article aims to list a few "basic approaches", which can be easily found in many small systems, mostly the ones hosted on-premises. &lt;/p&gt;

&lt;p&gt;Designing a system needs to take many aspects into account:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How many users will concurrently use the application?&lt;/li&gt;
&lt;li&gt;How much space is needed? How will it grow?&lt;/li&gt;
&lt;li&gt;How crucial is the availability of the service?&lt;/li&gt;
&lt;li&gt;How much money can be expended with services and/or hardware?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Below there are some concepts and the presentation of basic system design for applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Types of Scalability
&lt;/h2&gt;

&lt;p&gt;Scalability relies basically on two pillars:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Vertical Scale&lt;/li&gt;
&lt;li&gt;Horizontal Scale&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frm1rtwayx3ugym2tlo5v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frm1rtwayx3ugym2tlo5v.png" alt="Image description" width="800" height="426"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Vertical Scale
&lt;/h3&gt;

&lt;p&gt;In short, it implies that, when the system is not responding as desired, then &lt;strong&gt;more hardware has to be added for it&lt;/strong&gt;. Hardware like memory, CPUs or disk space are usually added.&lt;/p&gt;

&lt;h3&gt;
  
  
  Horizontal Scale
&lt;/h3&gt;

&lt;p&gt;In short, it implies that, when the system is not responding as desired, &lt;strong&gt;more machines have to be added for it&lt;/strong&gt;. System infrastructure is increased with other servers, considering that there are separate concerns, redundancy, etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  In old (or very old) days
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Single Server Design
&lt;/h3&gt;

&lt;p&gt;In the "old days", the common design of a system consisted in having one server with all the services, usually maintained on-premises.&lt;br&gt;
The same machine was responsible for hosting the web server for the application, the database, the filesystem and whatever else was needed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7tje5i0wyhrlwlft1r7x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7tje5i0wyhrlwlft1r7x.png" alt="Image description" width="400" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This approach is very fragile, as many things can interfere in the availability or usability of the system:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;if the CPU has to process a complicated query - it will make the whole application very slow;&lt;/li&gt;
&lt;li&gt;if the disk is out of space, it will make the application unavailable;&lt;/li&gt;
&lt;li&gt;if the web server has too many requests, it will return an HTTP server error response (500 errors).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Apart from the things mentioned above, it has a "single point of failure". It means that, if the server goes down, the whole application goes down too.&lt;/p&gt;

&lt;p&gt;In this type of design, to scale a system, it is usually used a technique called "Vertical Scale", where the server gets more RAM, hard disk or processors (CPUs).&lt;/p&gt;

&lt;p&gt;Even though it is an approach that has been in place for years, the Single Server Design still has space for small systems, usually sitting in a computer inside the office, which serves daily tasks for a limited number of users (e.g. 10 users or so). It can be set up on-premises or even in a cloud provider.&lt;/p&gt;

&lt;h3&gt;
  
  
  Application Server + Database Server Design
&lt;/h3&gt;

&lt;p&gt;A better approach is to separate the database from the application server. It usually brings more resilience for the architecture, although it still has a single point of failure.&lt;/p&gt;

&lt;p&gt;In case the CPU is overloaded in the application server, at least the database is isolated and can still operate. Even the risk of corruption is reduced since the database uses a separate machine with a dedicated hard disk and processors.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx27mohpvwz6i9gmxah88.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx27mohpvwz6i9gmxah88.png" alt="Image description" width="400" height="554"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding a Load Balancer
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Modern approach for scaling "expects" Horizontal Scale.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Another option of a system design is to set up the application behind a Load Balancer. It distributes the loading of the application between different servers.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A load balancer is a device that acts as a reverse proxy and distributes network or application traffic across a number of servers. Load balancers are used to increase capacity (concurrent users) and reliability of applications. (&lt;a href="https://www.f5.com/glossary/load-balancer" rel="noopener noreferrer"&gt;What is a Load Balancer?&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb47hy8v5diz6kgl8uksw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb47hy8v5diz6kgl8uksw.png" alt="Image description" width="400" height="562"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This approach works well if servers are "stateless", where they don't store anything that makes a request depend on what a previous request has stored.&lt;/p&gt;

&lt;p&gt;However, it still depends on a single point of failure. If the database crashes (for any reason), the application cannot rely on any other data source.&lt;/p&gt;

&lt;h2&gt;
  
  
  Database Normalization
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Normalization is the process of organizing data in a database. This includes creating tables and establishing relationships between those tables according to rules designed both to protect the data and to make the database more flexible by eliminating redundancy and inconsistent dependency. (&lt;a href="https://learn.microsoft.com/en-us/office/troubleshoot/access/database-normalization-description" rel="noopener noreferrer"&gt;Description of the database normalization basics&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Normalizing data is something very basic, and we usually tend to do it to avoid redundancy by creating more tables and relationships.&lt;br&gt;
Yet, it may not be the best solution for a given problem.&lt;/p&gt;

&lt;p&gt;The better we organize the database and avoid redundancy, the less space we use. And that is usually great. On the other hand, we usually spend more time to return query results due to joins between different tables or multiple queries to return a set of data.&lt;/p&gt;

&lt;p&gt;It is important to define what's the trade-off. If performance a high priority and there isn't a concern about how much it can cost to store all data, denormalizing the database may be an option.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;

&lt;p&gt;The example below shows a very simple invoice stored in a normalized database. The data is stored in two different tables:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;INVOICE&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;CLIENT&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Normalized database
&lt;/h4&gt;

&lt;p&gt;A normalized database uses less storage, but it requires more lookups.&lt;/p&gt;

&lt;h5&gt;
  
  
  Table &lt;code&gt;INVOICE&lt;/code&gt;
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foex6j1jyvloxpmxybcju.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foex6j1jyvloxpmxybcju.png" alt="Image description" width="758" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The table has a foreign key (CLIENT_ID) that enforces the relationship with the table &lt;code&gt;CLIENT&lt;/code&gt;.&lt;/p&gt;

&lt;h5&gt;
  
  
  Table &lt;code&gt;CLIENT&lt;/code&gt;
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzc4il9i35dyi8tefuxwq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzc4il9i35dyi8tefuxwq.png" alt="Image description" width="600" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The table &lt;code&gt;CLIENT&lt;/code&gt; stores the client's information and avoids duplication.&lt;/p&gt;

&lt;h4&gt;
  
  
  Denormalized database
&lt;/h4&gt;

&lt;p&gt;A denormalized database uses more storage, but it requires just one lookup.&lt;/p&gt;

&lt;h5&gt;
  
  
  Table &lt;code&gt;Invoice&lt;/code&gt;
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcuopvrksjdr7wwj78qro.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcuopvrksjdr7wwj78qro.png" alt="Image description" width="800" height="243"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The question is: do you need to respond quickly without multiple joins and queries? Or, do you need to minimize disk usage?&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This article presents very basic System Design for applications. They can be widely used for applications that do not require large scalability.&lt;/p&gt;

&lt;p&gt;The database denormalization technique can help to minimize bottom necks of performance in high-availability applications, however it has its downside, which is more use of disk-space.&lt;/p&gt;

&lt;p&gt;It is important to consider that the simplest architecture that meets the project traffic requirements should be used, &lt;u&gt;but not the smallest&lt;/u&gt;.&lt;/p&gt;

&lt;p&gt;More to come in next posts about System Design.&lt;/p&gt;

</description>
      <category>announcement</category>
      <category>devto</category>
      <category>writing</category>
    </item>
    <item>
      <title>How to run Playwright tests with Selenium Grid versions after `4.5`</title>
      <dc:creator>Everton Schneider</dc:creator>
      <pubDate>Sat, 18 Feb 2023 16:35:04 +0000</pubDate>
      <link>https://forem.com/evertones/how-to-run-playwright-tests-with-selenium-grid-versions-after-45-488h</link>
      <guid>https://forem.com/evertones/how-to-run-playwright-tests-with-selenium-grid-versions-after-45-488h</guid>
      <description>&lt;p&gt;Compared to other automation testing libraries, &lt;a href="https://playwright.dev" rel="noopener noreferrer"&gt;Playwright&lt;/a&gt; is relatively new, but it supports writing tests in different languages.&lt;/p&gt;

&lt;p&gt;If you're using Java, Playwright can take advantage of the Selenium Grid to scale test execution, helping you save time and increase efficiency.&lt;/p&gt;

&lt;h4&gt;
  
  
  TL;DR;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Playwright has a limitation that restricts running tests in Selenium Grid to only the version prior to &lt;a href="https://github.com/SeleniumHQ/docker-selenium/releases/tag/4.5.2-20221021" rel="noopener noreferrer"&gt;&lt;code&gt;4.5.2-20221021&lt;/code&gt;&lt;/a&gt; (at the time of this writing - February/2023).&lt;/li&gt;
&lt;li&gt;Selenium 4 has passed through a redesign of its architecture. After a long period of stabilization, a long-standing intermittent issue was fixed in version &lt;code&gt;4.5.2-20221021&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If Playwright tests only work with versions prior to &lt;code&gt;4.5.2-20221021&lt;/code&gt;, it won't be able to benefit from the latest improvements made by the Selenium team to the grid or any browser version upgrades.
A workaround for the issue is to use a specific property -&lt;code&gt;Djdk.httpclient.websocket.intermediateBufferSize&lt;/code&gt;, passed as an argument to the &lt;code&gt;selenium-server.jar&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Problem
&lt;/h2&gt;

&lt;p&gt;Although Playwright is still relatively new compared to Selenium, it generally offers faster test execution times. In a "real-work" test that I used to compare the two tools, the results were as follows:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Spec&lt;/th&gt;
&lt;th&gt;Library&lt;/th&gt;
&lt;th&gt;Number of tests&lt;/th&gt;
&lt;th&gt;Duration&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;selenium.specs.LoginSpec&lt;/td&gt;
&lt;td&gt;Selenium&lt;/td&gt;
&lt;td&gt;32&lt;/td&gt;
&lt;td&gt;1:31 minutes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;playwright.specs.LoginSpec&lt;/td&gt;
&lt;td&gt;Playwright&lt;/td&gt;
&lt;td&gt;32&lt;/td&gt;
&lt;td&gt;43 seconds&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The example above is a simple test run from a local machine, without using Selenium Grid.&lt;/p&gt;

&lt;p&gt;According to the Playwright website, tests written with Playwright can run against Selenium Grid, as documented &lt;a href="https://playwright.dev/docs/selenium-grid" rel="noopener noreferrer"&gt;here&lt;/a&gt;. However, as of February 2023, there is currently an issue with Selenium Grid versions &lt;code&gt;4.5.2-20221021&lt;/code&gt; or later, which can cause errors when attempting to use Playwright with Selenium Grid.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/microsoft/playwright/issues/18892" rel="noopener noreferrer"&gt;Cannot run playwright tests on Selenium Grid&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If Playwright tests can run only with Selenium Grid version prior to this, then it means it is running only with older versions of Google Chrome or Microsoft Edge:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Spec&lt;/th&gt;
&lt;th&gt;Supported versions in &lt;code&gt;4.5.0&lt;/code&gt;
&lt;/th&gt;
&lt;th&gt;Supported versions in latest (&lt;code&gt;4.8.0&lt;/code&gt;)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Chrome&lt;/td&gt;
&lt;td&gt;106.0.5249.119&lt;/td&gt;
&lt;td&gt;110.0.5481.77&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ChromeDriver&lt;/td&gt;
&lt;td&gt;106.0.5249.61&lt;/td&gt;
&lt;td&gt;110.0.5481.77&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Edge&lt;/td&gt;
&lt;td&gt;106.0.1370.47&lt;/td&gt;
&lt;td&gt;110.0.1587.41&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EdgeDriver&lt;/td&gt;
&lt;td&gt;106.0.1370.47&lt;/td&gt;
&lt;td&gt;110.0.1587.41&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  History
&lt;/h2&gt;

&lt;p&gt;When &lt;strong&gt;Selenium 4&lt;/strong&gt; was release, it changed completely how Selenium Grid is structured. It has totally changed its design, based on distributed components to handle messages between the &lt;code&gt;hub&lt;/code&gt; and the &lt;code&gt;nodes&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm0l98empv2owkjhcgy6x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm0l98empv2owkjhcgy6x.png" alt=" " width="800" height="460"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After its release, a critical intermittent issue received significant attention, as it was difficult to reproduce and persisted for almost two years before being resolved.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="//java.util.concurrent.TimeoutException%20thrown%20at%20random%20netty%20read%20timeouts%20with%20RemoteWebDriver"&gt;https://github.com/SeleniumHQ/selenium/issues/9528#issuecomment-947994758&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This fix was officially released on &lt;code&gt;docker-selenium&lt;/code&gt; project on version &lt;code&gt;4.5.2-20221021&lt;/code&gt;. The exact same version that started to present issues with the execution of tests written with Playwright.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix (Workaround)
&lt;/h2&gt;

&lt;p&gt;The fix was reported by &lt;a href="https://github.com/EndPositive" rel="noopener noreferrer"&gt;EndPositive&lt;/a&gt; in an &lt;a href="https://github.com/SeleniumHQ/selenium/issues/11408#issuecomment-1345401948" rel="noopener noreferrer"&gt;issue&lt;/a&gt; opened for the Selenium team.&lt;/p&gt;

&lt;p&gt;The issue seems to be related to WebSocket communication, with messages larger than the default configuration of Selenium Grid causing problems.&lt;/p&gt;

&lt;p&gt;The suggestion is to increase the WebSocket buffer size passing the parameter &lt;code&gt;Djdk.httpclient.websocket.intermediateBufferSize&lt;/code&gt; to the &lt;code&gt;selenium-server.jar&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Using &lt;a href="https://github.com/SeleniumHQ/docker-selenium" rel="noopener noreferrer"&gt;docker-selenium&lt;/a&gt; images, it is possible to do as shown in the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;version: "3"

services:
  selenium-hub:
    image: selenium/hub:4.8.0-20230210
    container_name: selenium-hub
    ports:
      - "4442:4442"
      - "4443:4443"
      - "4444:4444"
    environment:
      - JAVA_OPTS=-Djdk.httpclient.websocket.intermediateBufferSize=3000000
      - SE_EVENT_BUS_HOST=selenium-hub

  chrome:
    image: selenium/node-chrome:4.8.0-20230210
    shm_size: 2gb
    depends_on:
      - selenium-hub
    environment:
      - JAVA_OPTS=-Djdk.httpclient.websocket.intermediateBufferSize=3000000
      - SE_EVENT_BUS_HOST=selenium-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
      - HUB_HOST=selenium-hub
      - HUB_PORT=4444
      - SE_NODE_GRID_URL=http://localhost:4444
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To run Playwright tests against Selenium Grid, the environment variable &lt;code&gt;SELENIUM_REMOTE_URL&lt;/code&gt; must be declared:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export SELENIUM_REMOTE_URL=http://localhost:4444
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that, tests can be run in different ways:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./gradlew test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./mvnw test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or with other build tools of preference.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final consideration
&lt;/h2&gt;

&lt;p&gt;It seems that Playwright uses Selenium Grid, but Selenium Grid does NOT officially support Playwright. The problem to run Playwright tests with the newest version of Selenium Grid were raised in Selenium GitHub project, however it hasn't been investigated so far to be fixed once it cannot be reproduced with tests implemented using Selenium (and Selenium &lt;code&gt;WebDriver&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Furju6k70lzfl6dvdect3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Furju6k70lzfl6dvdect3.png" alt=" " width="716" height="102"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>watercooler</category>
    </item>
    <item>
      <title>Optimising parallel tests in Selenium Grid</title>
      <dc:creator>Everton Schneider</dc:creator>
      <pubDate>Sat, 07 Jan 2023 22:48:29 +0000</pubDate>
      <link>https://forem.com/evertones/optimising-parallel-tests-in-selenium-grid-kom</link>
      <guid>https://forem.com/evertones/optimising-parallel-tests-in-selenium-grid-kom</guid>
      <description>&lt;p&gt;There are many articles trying to explain how to improve &lt;a href="https://www.selenium.dev/"&gt;Selenium&lt;/a&gt; tests within the code. They show best practices and are very relevant.&lt;br&gt;
On the other hand, it is hard to find pages with tips to improve the execution against Selenium Grid. &lt;br&gt;
This document aims to cover some simple practices that can result in faster execution of Selenium tests using Selenium Grid.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TL;DR;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Define a maximum time to run each spec in your test suite and implement them with that constraint in mind&lt;/li&gt;
&lt;li&gt;Sort the specs inside your suite of tests

&lt;ul&gt;
&lt;li&gt;Measure the overall time that each spec takes to be executed&lt;/li&gt;
&lt;li&gt;Run the longest specs first&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Cancel subsequent tests of a spec when a test case inside the spec fails&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Implement automated tests with a time constraint
&lt;/h3&gt;

&lt;p&gt;Specs should be small - period.&lt;br&gt;
Small specs take advantage of better usage of Selenium Grid, since they are better distributed between the available nodes.&lt;/p&gt;

&lt;p&gt;Every case must be evaluated, but in my case I try to have 5 minutes as a time limit. In the suite of tests that I work with, if a spec takes more than 5 minutes to run, I usually put some effort to split it into 2 (or more) smaller specs.&lt;/p&gt;
&lt;h3&gt;
  
  
  Sort the execution of the tests suite
&lt;/h3&gt;

&lt;p&gt;Selenium tests are commonly run against a CI Server (Jenkins, TeamCity, etc), but even when run locally they provide a report with the list of specs executed and the duration of each spec.&lt;br&gt;
Usually, the order how tests are run is arbitrary and managed by the test library (JUnit, TestNG, etc) used with Selenium.&lt;/p&gt;

&lt;p&gt;Saving this data can be useful to sort tests.&lt;/p&gt;
&lt;h4&gt;
  
  
  Measure and set the overall time in each spec
&lt;/h4&gt;

&lt;p&gt;Every time a spec is run, it takes a different time to execute. Page load and some other factors influence in how the duration takes a bit more or less each time that a spec is run.&lt;/p&gt;

&lt;p&gt;However, by looking at the history of tests executed, it's possible to find an average time. It is interesting to use this average time to sort the specs before they are run.&lt;/p&gt;

&lt;p&gt;The average time could be set in a property, internally in the spec, or be searched from a database, if that's saved.&lt;/p&gt;

&lt;p&gt;A possible approach to sort the specs is to define a category based on the average time the spec runs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Very Short (executed in less than 30 seconds)&lt;/li&gt;
&lt;li&gt;Short (executed between 30 seconds and 1:30 minutes)&lt;/li&gt;
&lt;li&gt;Medium (executed between 1:30 minutes and 3:00 minutes)&lt;/li&gt;
&lt;li&gt;Long (executed between 3:00 minutes and 5 minutes)&lt;/li&gt;
&lt;li&gt;Very Long (executed in more than 5:00 minutes)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If every spec has a constant containing the information above, it is easy to order the list of specs from a test suite using that criteria.&lt;/p&gt;

&lt;p&gt;The drawback is that it needs to be updated if a spec is changed (e.g. split), but other approaches can be considered (e.g. saving every test result in the database and calculating each spec average time before every test run).&lt;/p&gt;
&lt;h4&gt;
  
  
  Run the longest specs first
&lt;/h4&gt;

&lt;p&gt;This is my favourite trick. It must be combined with the previous steps, and it makes the test distribution between the Selenium nodes better, reducing the overall time that tests take to run and also reducing idleness of Selenium nodes.&lt;/p&gt;

&lt;p&gt;As an example, let's say we have just 2 Selenium nodes available to run 3 different specs with the following execution time average.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Spec1: runs in 5 minutes&lt;/li&gt;
&lt;li&gt;Spec2: runs in 2:30 minutes&lt;/li&gt;
&lt;li&gt;Spec3: runs in 2:30 minutes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hiZt3rT3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e8eo42fnph0h9yscd4pd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hiZt3rT3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e8eo42fnph0h9yscd4pd.png" alt="Image description" width="800" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As seen in the image above, if we don't run the longest spec first, the overall execution time may take longer due to the distribution that is not optimised. Apart from the longer time to run tests, it shows that the &lt;strong&gt;Node 2&lt;/strong&gt; will be idle for some time. In a scenario with hundreds of specs, it can result in a big difference in the overall execution time and when tuned it can represent a better use of the resources available for the Selenium Grid.&lt;/p&gt;
&lt;h3&gt;
  
  
  Cancel subsequent tests of a spec after a failure
&lt;/h3&gt;

&lt;p&gt;Selenium tests are different from Unit Test. In many cases, they depend on previous tests to run.&lt;br&gt;
As an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. log in to the application
  1.1. ensure the page title is as expected
  1.2. ensure the values are loaded correctly
2. click on the button "New"
  2.1. ensure the page title is as expected
3. complete the form
4. click on the button "Save"
  4.1. ensure the success message is displayed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For the example above, if the test &lt;code&gt;2.1&lt;/code&gt; fails, what's the benefit of trying the next ones, which depend on it? They may just add a lot of invalid failures, which are not related to the root cause of the problem, adding unnecessary error LOGs to the results.&lt;/p&gt;

&lt;p&gt;Just as an example, in &lt;a href="https://www.scalatest.org"&gt;ScalaTest&lt;/a&gt; it can be easily done mixing-in the trait &lt;a href="https://www.scalatest.org/scaladoc/3.0.5/org/scalatest/CancelAfterFailure.html"&gt;CancelAfterFailure&lt;/a&gt; to the specs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Final words
&lt;/h3&gt;

&lt;p&gt;The simple changes listed above can save some time and optimise the execution of Selenium tests.&lt;/p&gt;

&lt;p&gt;For some of the topics pointed above, it is needed to have a custom implementation, like ordering the specs to consider the longest ones to run first. However, there shouldn't be any complicated implementation. &lt;/p&gt;

&lt;p&gt;Hopefully it's somehow useful for somebody else.&lt;/p&gt;

</description>
      <category>selenium</category>
      <category>grid</category>
      <category>testing</category>
      <category>automation</category>
    </item>
    <item>
      <title>What to study for the LambdaTest Selenium Java 101 Certification</title>
      <dc:creator>Everton Schneider</dc:creator>
      <pubDate>Tue, 18 Oct 2022 12:53:26 +0000</pubDate>
      <link>https://forem.com/evertones/how-to-pass-the-lambdatest-selenium-java-101-certification-45oc</link>
      <guid>https://forem.com/evertones/how-to-pass-the-lambdatest-selenium-java-101-certification-45oc</guid>
      <description>&lt;p&gt;&lt;a href="https://www.lambdatest.com/certifications/selenium-101" rel="noopener noreferrer"&gt;LamdaTest&lt;/a&gt; has a certification to test your Selenium skills. The exam is free, and it can be done all online.&lt;br&gt;
Below, I will share my experience taking the tests to get the certification.&lt;/p&gt;

&lt;h4&gt;
  
  
  TL;DR;
&lt;/h4&gt;

&lt;p&gt;If you want to take the Selenium Java 101 certification:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For the multiple-choice questions section

&lt;ul&gt;
&lt;li&gt;there will be questions about Java&lt;/li&gt;
&lt;li&gt;there will be questions about JUnit and TestNG&lt;/li&gt;
&lt;li&gt;there won't be questions about Selenium&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;For the code assignment

&lt;ul&gt;
&lt;li&gt;the implementation needs to use JUnit or TestNG&lt;/li&gt;
&lt;li&gt;the implementation needs to run tests in parallel and in different browsers (some LambdaTest knowledge will be required)&lt;/li&gt;
&lt;li&gt;the implementation of tests will require to use the LambdaTest playground and will need to use different selectors (&lt;code&gt;id&lt;/code&gt;, &lt;code&gt;xpath&lt;/code&gt;, &lt;code&gt;cssSelector&lt;/code&gt;, etc)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  How it is structured
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv37fsq95yvwfj315nwlg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv37fsq95yvwfj315nwlg.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The certification page explains clearly how the test is structured. It is composed of 2 rounds:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Round 1:  40 multiple choice questions to be completed in 45 minutes&lt;/li&gt;
&lt;li&gt;Round 2: code assignment to be completed in 36 hours&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What to expect from the MCQs
&lt;/h2&gt;

&lt;p&gt;When I started the MCQs session, I was very surprised. Since I did not study much for the content of the certification, I did not realize something obvious:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You do not use Selenium for testing &lt;strong&gt;without&lt;/strong&gt; a testing library.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The certification page has a section called Learning Material that mentions ONLY Selenium.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3x1e1kqumgg6b192f4ap.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3x1e1kqumgg6b192f4ap.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I was expecting to see questions about selectors, how to deal with iframes, cookies, instantiate local x remote WebDriver, but...&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The MMQs &lt;strong&gt;have ZERO questions about Selenium&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I work daily with Selenium and use &lt;a href="https://www.scalatest.org/" rel="noopener noreferrer"&gt;ScalaTest&lt;/a&gt; as the testing library, but for the Selenium Java 101 certification, you need to know &lt;a href="https://junit.org/junit5/" rel="noopener noreferrer"&gt;JUnit&lt;/a&gt; and &lt;a href="https://testng.org/doc/" rel="noopener noreferrer"&gt;TestNG&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The MMQs, in my case, were &lt;strong&gt;all about&lt;/strong&gt; Java, JUnit and TestNG.&lt;/p&gt;

&lt;h4&gt;
  
  
  Java
&lt;/h4&gt;

&lt;p&gt;I remember very few questions about Java, and they were not trivial. I recall questions about Threads and some expected outputs from a piece of code.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://junit.org/junit5/docs/current/user-guide/#writing-tests-annotations" rel="noopener noreferrer"&gt;JUnit annotations&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;It is important to know them, how to use them and the internal parameters they receive.&lt;/p&gt;

&lt;p&gt;The ones I remember to see questions about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;@Test&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;@Before&lt;/code&gt;, &lt;code&gt;@After&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;@Parameterized&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;@Timeout&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://testng.org/doc/documentation-main.html#annotations" rel="noopener noreferrer"&gt;TestNG annotations&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;Like in JUnit, it is important to know the annotations and their parameters.&lt;/p&gt;

&lt;p&gt;The ones I remember to see questions about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;@Test&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;@BeforeTest&lt;/code&gt;, &lt;code&gt;@AfterTest&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;@DataProvider&lt;/code&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What to expect from the code assignment
&lt;/h2&gt;

&lt;p&gt;The code assignment is sent to you after you complete the MMQ session. You only receive the code assignment if your score is at least 50% in the MCQ.&lt;/p&gt;

&lt;p&gt;My assignment was composed of 3 tasks. All of them were to implement Selenium Tests for different scenarios using the &lt;a href="https://www.lambdatest.com/selenium-playground" rel="noopener noreferrer"&gt;LamdaTest playground&lt;/a&gt; website.&lt;/p&gt;

&lt;p&gt;The tests to be implemented were not complicated, but in the end, they all must be executed inside LambdaTest platform.&lt;/p&gt;

&lt;p&gt;Some assignment requirements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;implement tests using different locators (&lt;code&gt;xpath&lt;/code&gt;, &lt;code&gt;css&lt;/code&gt;, &lt;code&gt;id&lt;/code&gt;, etc).&lt;/li&gt;
&lt;li&gt;run tests in parallel&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I was not familiar with LambdaTest platform, so it is good to consider some time to learn a little bit about how it works.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;There are a few questions and answers on the LambdaTest &lt;a href="https://www.lambdatest.com/certifications/" rel="noopener noreferrer"&gt;certifications page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The ones that I think are important to know in advance:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the results "should" be sent to you in 48 hours (my results came after a week)&lt;/li&gt;
&lt;li&gt;there is a 45 days retake policy ("Can I reappear the certification?")&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Result
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5cwoophrp8w2x03vjtip.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5cwoophrp8w2x03vjtip.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>selenium</category>
      <category>certification</category>
      <category>testing</category>
      <category>lambdatest</category>
    </item>
    <item>
      <title>Book: Pragmatic Thinking and Learning</title>
      <dc:creator>Everton Schneider</dc:creator>
      <pubDate>Mon, 01 Mar 2021 14:37:32 +0000</pubDate>
      <link>https://forem.com/evertones/pragmatic-thinking-and-learning-45bf</link>
      <guid>https://forem.com/evertones/pragmatic-thinking-and-learning-45bf</guid>
      <description>&lt;p&gt;Andy Hunt, one of the authors of the famous book &lt;a href="https://pragprog.com/titles/tpp20/the-pragmatic-programmer-20th-anniversary-edition/" rel="noopener noreferrer"&gt;The Pragmatic Programmer&lt;/a&gt; has also written the book &lt;a href="https://pragprog.com/titles/ahptl/pragmatic-thinking-and-learning/" rel="noopener noreferrer"&gt;Pragmatic Thinking and Learning&lt;/a&gt;.&lt;br&gt;
Pragmatic Thinking and Learning lists some interesting models and techniques that can help in the process of learning.&lt;br&gt;
A few of them I will mention in this article.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Dreyfus Model
&lt;/h3&gt;

&lt;p&gt;The Dreyfus Model is a model of how learners acquire skills through formal instruction and practising (see &lt;a href="https://en.wikipedia.org/wiki/Dreyfus_model_of_skill_acquisition" rel="noopener noreferrer"&gt;Wiki&lt;/a&gt;). It is divided into 5 levels:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Novice&lt;/li&gt;
&lt;li&gt;Advanced Beginner&lt;/li&gt;
&lt;li&gt;Competent&lt;/li&gt;
&lt;li&gt;Proficient&lt;/li&gt;
&lt;li&gt;Expert&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Dreyfus is applicable per ability (skill)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h5&gt;
  
  
  Novice
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;They have little or no prior experience in the ability area.&lt;/li&gt;
&lt;li&gt;They are not concerned about learning the details. They want to achieve the goal asap.&lt;/li&gt;
&lt;li&gt;They don't know how to respond to errors, therefore they're very vulnerable to confusion when something goes wrong.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Novices need recipes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h5&gt;
  
  
  Advanced Beginner
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;They can run away from a set of fixed rules. &lt;/li&gt;
&lt;li&gt;They can try to do some things on their own, but still have difficulties to solve problems.&lt;/li&gt;
&lt;li&gt;They want information quickly.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Advanced Beginners don't want to have an overview.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h5&gt;
  
  
  Competent
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;They can develop conceptual models of the problem domain.&lt;/li&gt;
&lt;li&gt;They can work with the conceptual model effectively.&lt;/li&gt;
&lt;li&gt;They can solve problems.&lt;/li&gt;
&lt;li&gt;They plan acts based on previous experiences.&lt;/li&gt;
&lt;li&gt;They still have difficulties to find details when solving problems.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Competent professionals can solve problems.&lt;/p&gt;

&lt;p&gt;Competent professionals are good to have in a team. They can solve problems, help beginners and do not disturb much the experts.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h5&gt;
  
  
  Proficient
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;They need an overview.&lt;/li&gt;
&lt;li&gt;They will try to understand the concepts around the skills.&lt;/li&gt;
&lt;li&gt;They get frustrated with simplified information.&lt;/li&gt;
&lt;li&gt;They can review how they have done things in the past to have a better performance in the future.&lt;/li&gt;
&lt;li&gt;They can take advantage of feedback. This is a big difference compared with the previous stages.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Proficient professionals can self-correct.&lt;/p&gt;

&lt;p&gt;Proficient is more of a "junior expert" than an "advanced competent".&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h5&gt;
  
  
  Expert
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;They have a great set of experiences to be explored and applied in the proper context.&lt;/li&gt;
&lt;li&gt;They write books, articles, make speeches in seminars. They're wizards or gurus in the modern world.&lt;/li&gt;
&lt;li&gt;They work based on intuition, not reasoning.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Statistically, there aren't many experts - probably something about 1 to 5% of the population.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Dreyfus at Work
&lt;/h4&gt;

&lt;blockquote&gt;
&lt;p&gt;Use rules for novices, intuition for experts.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq1dvtql9pdyjzz4l5qef.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq1dvtql9pdyjzz4l5qef.png" alt="Dreyfus Model - Aquisition of Skills"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The distribution of abilities.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faiadtad0ikx07rroomws.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faiadtad0ikx07rroomws.png" alt="Dreyfus Model - Distribuition of Skills"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You have to know what you don't know.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h5&gt;
  
  
  How To Become An Expert
&lt;/h5&gt;

&lt;p&gt;You should have to work on a plan for about 10 years to become an Expert, regardless of the area or subject.&lt;br&gt;
Just to work on the area or subject for 10 years may not be sufficient. You need to practice. The cognitive scientist K. Anderson Ericsson says that the practice requests 4 conditions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need a well-defined task;&lt;/li&gt;
&lt;li&gt;The task needs to be hard, challenging, but doable;&lt;/li&gt;
&lt;li&gt;You need to be able to get feedback to improve;&lt;/li&gt;
&lt;li&gt;You need to have the possibility to act to repeat and fix errors.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At work...&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A group is as good as its weakest member. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  How Our Brain Works
&lt;/h3&gt;

&lt;p&gt;The brain can be divided into 2 parts - Right and Left.&lt;br&gt;
The book treats them in 2 different modes - Rich and Linear.&lt;/p&gt;

&lt;h5&gt;
  
  
  Characteristics of the mode L
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Rational&lt;/li&gt;
&lt;li&gt;Time based&lt;/li&gt;
&lt;li&gt;Logic&lt;/li&gt;
&lt;li&gt;Linear&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  Characteristics of the mode R
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Not verbal&lt;/li&gt;
&lt;li&gt;Not rational&lt;/li&gt;
&lt;li&gt;Analogic&lt;/li&gt;
&lt;li&gt;Holistic&lt;/li&gt;
&lt;li&gt;Intuitive&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The book claims it's important to improve the mode R to achieve intuition, one of the skills found in experts in the Dreyfus Model.&lt;/p&gt;

&lt;p&gt;It lists a few things that can be done to help to develop the mode R:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Take notes of all ideas you have&lt;/li&gt;
&lt;li&gt;Create metaphors&lt;/li&gt;
&lt;li&gt;Write freely without thinking every day&lt;/li&gt;
&lt;li&gt;Go out for a walk to clear your mind&lt;/li&gt;
&lt;li&gt;Practice yoga, meditation, do breathing exercises&lt;/li&gt;
&lt;li&gt;Practice martial arts&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  Changes are good
&lt;/h5&gt;

&lt;p&gt;We have habits, but ingrained habits are not the best thing for our brain. We do NOT make new connections repeating habits and we become blind to new alternatives.&lt;/p&gt;

&lt;p&gt;A few things that are easy to change to try to help the mode R:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ask for a different dish at the restaurant&lt;/li&gt;
&lt;li&gt;Cook something new&lt;/li&gt;
&lt;li&gt;Visit a place you have never visited before&lt;/li&gt;
&lt;li&gt;Read a book or watch a movie from a different genre (e.g. if you like comedy, try fiction)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  A Few Things About Our Mind
&lt;/h3&gt;

&lt;p&gt;The human mind is not open-sourced. We cannot access its code and try to fix the bugs when they happen, but we can try to understand it better to know how to manage the failing processes in our thinking.&lt;/p&gt;

&lt;p&gt;Let's check 4 categories of problems&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cognitive Bias: How our behaviour can deviate.&lt;/li&gt;
&lt;li&gt;Generational Affinity: How our colleagues have influence over us.&lt;/li&gt;
&lt;li&gt;Personality Tendencies: How our personality influences our thoughts.&lt;/li&gt;
&lt;li&gt;Hardware Bugs: How older parts of your brain can overlap parts more intelligent.&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  Cognitive Bias
&lt;/h5&gt;

&lt;p&gt;There are many cognitive biases. &lt;a href="https://en.wikipedia.org/wiki/List_of_cognitive_biases" rel="noopener noreferrer"&gt;Wikipedia lists about 90 common cognitive biases&lt;/a&gt;.&lt;br&gt;
Below there is a very short list of examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Attribution Bias: The tendency for people to want to believe that the world is fundamentally just, causing them to rationalize an otherwise inexplicable injustice as deserved by the victim(s).&lt;/li&gt;
&lt;li&gt;Confirmation Bias: The tendency to test hypotheses exclusively through direct testing, instead of testing possible alternative hypotheses.&lt;/li&gt;
&lt;li&gt;Egocentric Bias: The tendency of people to see their projects and themselves as more singular than they actually are.&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  Generational Affinity
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;Have you ever thought about why you value the things that you value?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Below a list of different attitudes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Take risk &lt;em&gt;vs&lt;/em&gt; Do not take risk&lt;/li&gt;
&lt;li&gt;Individualist &lt;em&gt;vs&lt;/em&gt; Team player&lt;/li&gt;
&lt;li&gt;Likes stability &lt;em&gt;vs&lt;/em&gt; Likes freedom&lt;/li&gt;
&lt;li&gt;Value family &lt;em&gt;vs&lt;/em&gt; Value work&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Different generations have different values and different attitudes.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The above are wide generalizations.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The generations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GI, 1901-1924&lt;/li&gt;
&lt;li&gt;Silent, 1925-1942&lt;/li&gt;
&lt;li&gt;Boom, 1943-1960&lt;/li&gt;
&lt;li&gt;X, 1961 to 1981&lt;/li&gt;
&lt;li&gt;Millenium (or Y), 1982-2005&lt;/li&gt;
&lt;li&gt;Z, 2005-???&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdnylqxi12bywlr3hrook.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdnylqxi12bywlr3hrook.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  All Together Now
&lt;/h5&gt;

&lt;p&gt;Nowadays, around 2010, the workplace has all these generations present at the same time, interacting with each other and coexisting (sometimes not).&lt;/p&gt;

&lt;h5&gt;
  
  
  How Does It Affect You
&lt;/h5&gt;

&lt;p&gt;Not everybody shares the same values you do and it doesn't mean that you are right or wrong.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You need to fit in the context you are in.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Personality Tendencies
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Hell is other people - Jean Paul Sartre&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Your personality affects your values and perceptions in addition to generational affinity. This is how you were born and the baggage you carry with you - your own context of personal attitude, your temper.&lt;/p&gt;

&lt;h5&gt;
  
  
  MBTI (Myers Briggs Type Indicator)
&lt;/h5&gt;

&lt;p&gt;There is an introspective self-report questionnaire indicating differing psychological preferences in how people perceive the world and make decisions. The test attempts to assign four categories: introversion or extraversion, sensing or intuition, thinking or feeling, judging or perceiving.&lt;/p&gt;

&lt;p&gt;You can try it on the internet. There are many free surveys that you can answer to see your type.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.16personalities.com/free-personality-test" rel="noopener noreferrer"&gt;16personalities free test&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbtm6ic1x6traskcudd8y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbtm6ic1x6traskcudd8y.png" alt="MBTI - Personality Types"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You cannot change people.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There are different ways to develop a solution and commitment. The only thing that certainly does not work is to try to change the temper of another person to be the same as yours.&lt;/p&gt;

&lt;h5&gt;
  
  
  Monkey Sees, Monkey Does
&lt;/h5&gt;

&lt;p&gt;We are natural imitators.&lt;br&gt;
If you are close to happy and optimistic people, this tends to improve your humour. If you are going out with depressed and pessimistic people that feel like they are losers, you start to feel a depressed loser as well.&lt;br&gt;
Attitudes beliefs, behaviours, emotions - they are all contagious.&lt;/p&gt;

&lt;h5&gt;
  
  
  Test Yourself
&lt;/h5&gt;

&lt;p&gt;When you are completely convinced of something, as yourself &lt;strong&gt;why&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;How do you know?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Make good questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How do you know that?&lt;/li&gt;
&lt;li&gt;Who said that?&lt;/li&gt;
&lt;li&gt;How exactly it works?&lt;/li&gt;
&lt;li&gt;Compared to what?&lt;/li&gt;
&lt;li&gt;Does it always happen? Is there any exception?&lt;/li&gt;
&lt;li&gt;What could happen if...?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Techniques To Learn
&lt;/h3&gt;

&lt;p&gt;You need continuous goals. You need to get feedback to understand your progress and approach everything in a more specific way than taking a course once a year in an uncomfortable class room.&lt;/p&gt;

&lt;h5&gt;
  
  
  SMART
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;You need to be careful if you don't know where you are going, because you may never get there.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe4vjcrv2yrucm8hn6gnt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe4vjcrv2yrucm8hn6gnt.png" alt="SMART Goals"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It is important to create a SMART to achieve your goals.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h5&gt;
  
  
  PIP - Pragmatic Investment Plan
&lt;/h5&gt;

&lt;p&gt;In the book Pragmatic Programmer, the author has suggested that the reader should consider his or her skills and talents like a knowledge portfolio. And like any portfolio, it should be managed over time.&lt;/p&gt;

&lt;p&gt;Model your knowledge portfolio with the same care that you would manage an investment portfolio.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The time cannot be created or destroyed, just allocated.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There are many important aspects involved when maintaining your knowledge portfolio:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need a concrete plan.&lt;/li&gt;
&lt;li&gt;You need to diversify.&lt;/li&gt;
&lt;li&gt;You need to make an active investment, not a passive one.&lt;/li&gt;
&lt;li&gt;You need to do it on regular bases.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You need to commit to investing a minimal quantity of time regularly. Create a ritual, if necessary. Go to a place you can concentrate on. Not all sessions will be equally productive, but by scheduling regularly, you will see the benefits in the long term.&lt;/p&gt;

&lt;h5&gt;
  
  
  Work Together, Study Together
&lt;/h5&gt;

&lt;p&gt;Studies have shown that study groups are a good thing.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Reading groups are not toxic.&lt;/p&gt;

&lt;p&gt;Form study groups to learn and teach.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h5&gt;
  
  
  Use Enhanced Learning Techniques
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Summarise material.&lt;/li&gt;
&lt;li&gt;Use mind maps.&lt;/li&gt;
&lt;li&gt;Teach.&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  Read with SQ3R
&lt;/h5&gt;

&lt;p&gt;SQ3R is a reading comprehension method named for its five steps: survey, question, read, recite, and review. &lt;/p&gt;

&lt;p&gt;The method offers a more efficient and active approach to reading textbook material.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp3mouy0kstwguhazppvf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp3mouy0kstwguhazppvf.png" alt="SQ3R"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Mind Maps
&lt;/h5&gt;

&lt;p&gt;A mind map is a type of diagram that presents topics and how they are connected. Its creation is a technique widely used to improve creativity and productivity.&lt;/p&gt;

&lt;p&gt;The main idea can be written in the middle of the page and the links will be written around, connected by arrows or just lines.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1zwldvimhrazkgl45lxh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1zwldvimhrazkgl45lxh.png" alt="Mind Map - Example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  The Power Of Documentation
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;Write: To document is more important than the documentation.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Writing helps you to have a better understanding of the topic you are writing about.&lt;/p&gt;

&lt;h5&gt;
  
  
  Learn By Teaching
&lt;/h5&gt;

&lt;p&gt;Another way to have a better understanding of a topic is to teach it to another person. Explaining to another person makes you organise the ideas more clearly in your head.&lt;/p&gt;

&lt;h3&gt;
  
  
  Gain Experience
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Build to learn, not learn to build.&lt;/li&gt;
&lt;li&gt;Fail effectively with better feedback.&lt;/li&gt;
&lt;li&gt;Establish your neural paths for success.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Give yourself permission to fail, this is the key to success.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  How To Improve Your Focus
&lt;/h3&gt;

&lt;p&gt;Three ways to better manage your mind:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need increasing focus and attention.&lt;/li&gt;
&lt;li&gt;You need to manage your knowledge.&lt;/li&gt;
&lt;li&gt;You need to improve your current context.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The book cited a study that has shown that practising meditation can improve the capability of a person the pay attention throughout the day.&lt;/p&gt;

&lt;h5&gt;
  
  
  Defocus to Focus
&lt;/h5&gt;

&lt;p&gt;Creativity does not work like a time clock and usually doesn't present good results when under pressure. You need to abandon a problem with the problem in your mind, letting it aside for a while.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Take a walk to clear your mind to help to solve a problem.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h5&gt;
  
  
  Optimise Your Current Context
&lt;/h5&gt;

&lt;p&gt;Multi-tasking affects heavily productivity. A study has found that on average, multi-tasking can cost from 20% to 40% of your productivity (see the &lt;a href="http://www.umich.edu/~bcalab/multitasking.html" rel="noopener noreferrer"&gt;article&lt;/a&gt;).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It takes 20 minutes to reload a context.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It means that if you're working on a task and gets interrupted, you can take an average of 20 minutes to get back to the normal pace. Now, think about how many interruptions you can have in a day - a great portion of our day will be wasted. You can explain why programmers, in general, hate to be interrupted.&lt;/p&gt;

&lt;p&gt;Another study has observed that, if you constantly interrupt your task to check or answer text messages, your IQ drops by 10 points.&lt;/p&gt;

&lt;p&gt;You can try to organise your tasks in an order that the context between them has minimal changes. This can enhance productivity.&lt;/p&gt;

&lt;h5&gt;
  
  
  Keep A Big Enough Context
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;Use many monitors to avoid changing contexts.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Put some effort to avoid your focus to leak to other spaces:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;E-Mail&lt;/li&gt;
&lt;li&gt;Tasks list&lt;/li&gt;
&lt;li&gt;Chat app&lt;/li&gt;
&lt;li&gt;Calendar&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Beyond Expertise
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Start with a plan: get some time and fight for it.&lt;/li&gt;
&lt;li&gt;Inaction is an enemy, not the failure: Failing is not the enemy, not doing anything is.&lt;/li&gt;
&lt;li&gt;New habits take time: It takes at least 3 weeks doing a new activity before it becomes a habit. Maybe even more. Give it a chance.&lt;/li&gt;
&lt;li&gt;Take small, next steps: Start with something easy. Define a plan and a goal. &lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  What To Do Tomorrow Morning
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;Just start.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Create a P.I.P. (Pragmatic Investment Plan) and define goals using SMART.&lt;/li&gt;
&lt;li&gt;Find out where you are in the Dreyfus modal (novice - expert) in your profession.&lt;/li&gt;
&lt;li&gt;Keep a notebook with you. Take notes, keep your thoughts floating.&lt;/li&gt;
&lt;li&gt;Start a blog.&lt;/li&gt;
&lt;li&gt;Take a walk to think over things once during the day.&lt;/li&gt;
&lt;li&gt;Get a second monitor.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Take the wheel, you cannot drive in the automatic mode.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;On the last page of the book, surprisingly the author asks the reader to send him a Mind Map with his learnings of the book.&lt;br&gt;
Below, I am sharing mine.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9l5ll14as3rlmndl80hn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9l5ll14as3rlmndl80hn.png" alt="My Mind Map - Pragmatic Thinking and Learning"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>books</category>
      <category>career</category>
      <category>learning</category>
      <category>dreyfus</category>
    </item>
    <item>
      <title>Book: Clean Code</title>
      <dc:creator>Everton Schneider</dc:creator>
      <pubDate>Sat, 28 Nov 2020 20:37:26 +0000</pubDate>
      <link>https://forem.com/evertones/book-clean-code-1j50</link>
      <guid>https://forem.com/evertones/book-clean-code-1j50</guid>
      <description>&lt;p&gt;The book Clean Code is a classic. Every programmer should have it on their shelf. Every programmer should read it. Every programmer should know it.&lt;/p&gt;

&lt;p&gt;After years of experience, I finally got the time to take some time to read this book. I felt like I should have read it years ago.&lt;br&gt;
The reading progresses smoothly with some nice code examples in an enjoyable journey with tips to learn, to have some reflection and questions about how you can code better.&lt;/p&gt;

&lt;p&gt;The chapters of the book are very well divided into categories and the more you proceed with its contents, more you want to continue.&lt;/p&gt;

&lt;p&gt;Below I will leave a few of my favourite topics and some distinct phrases that I liked from it, which I turn to sometimes to remember some good practices we all should follow.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Uhfu1ZJ4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3vtspl2qjn27yxjfo1vl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Uhfu1ZJ4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3vtspl2qjn27yxjfo1vl.png" alt="Image description" width="800" height="336"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Chapter 1: Clean Code
&lt;/h3&gt;
&lt;h5&gt;
  
  
  The Boy Scout Rule
&lt;/h5&gt;

&lt;p&gt;It's not enough to write code well. The code has to be &lt;em&gt;kept clean&lt;/em&gt; over time.&lt;br&gt;
If we all check in our code a little cleaner than when we checked it out, the code simply could not rot.&lt;/p&gt;
&lt;h3&gt;
  
  
  Chapter 2: Meaningful Names
&lt;/h3&gt;
&lt;h5&gt;
  
  
  Don't Pun
&lt;/h5&gt;

&lt;p&gt;Avoid using the same word for two purposes. Using the same term for two different ideas is essentially a pun.&lt;br&gt;
Follow the "one word per concept" rule.&lt;/p&gt;
&lt;h5&gt;
  
  
  Use Solution Domain Names
&lt;/h5&gt;

&lt;p&gt;Remember that the people who read your code will be programmers. So go ahead and use computer science (CS) terms, algorithm names, pattern names, math terms, and so forth.&lt;/p&gt;
&lt;h5&gt;
  
  
  Don't Add Gratuitous Context
&lt;/h5&gt;

&lt;p&gt;Don't prefix your classes or methods with some type of "project initials". If you have a project called "Corner Shop Cash Flow" it is a bad idea do prefix every class with CSCF. When you type C in your IDE, it will give you a long list of all class, not filtering anything you need. Let your IDE work for you.&lt;/p&gt;
&lt;h3&gt;
  
  
  Chapter 3: Functions
&lt;/h3&gt;
&lt;h5&gt;
  
  
  Small!!!
&lt;/h5&gt;

&lt;p&gt;The first rule of functions is that they should be small. The second is that they should be smaller than that.&lt;/p&gt;
&lt;h5&gt;
  
  
  Blocks and Indenting
&lt;/h5&gt;

&lt;p&gt;This means that the blocks within &lt;code&gt;if&lt;/code&gt; statements, &lt;code&gt;else&lt;/code&gt; statements, &lt;code&gt;while&lt;/code&gt; statements, and so on should be one line long. Probably that line should be a function call.&lt;/p&gt;
&lt;h5&gt;
  
  
  Do One Thing
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;Functions should do one thing. They should do it well. They should do it only.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If the function does only those steps that are one level below the stated name of the function, then the function is doing one thing. After all, the reason we write functions is to decompose a larger concept into a set of steps at the next level of abstraction.&lt;/p&gt;
&lt;h5&gt;
  
  
  Switch Statements
&lt;/h5&gt;

&lt;p&gt;We cannot always avoid using &lt;code&gt;switch&lt;/code&gt; statements, but we can make sure that each &lt;code&gt;switch&lt;/code&gt; statement is buried in a low-level class and is never repeated. We do this with polymorphism.&lt;br&gt;
The &lt;code&gt;switch&lt;/code&gt; statements can be tolerated if they only appear once in the code.&lt;/p&gt;
&lt;h5&gt;
  
  
  Use Descriptive Names
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;You know you're working on clean code when each routine turns out to be pretty much what you expected.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Don't be afraid to make a name long. A long descriptive name is better than a short enigmatic name. A long descriptive name is better than a long descriptive comment.&lt;/p&gt;
&lt;h5&gt;
  
  
  Function Arguments
&lt;/h5&gt;

&lt;p&gt;The ideal number of arguments for a function is zero. Next comes one, followed by two. Three arguments should be avoided where possible. More than three required very special justification - and then shouldn't be used anyway.&lt;/p&gt;

&lt;p&gt;Arguments are even harder from a testing point of view. It's hard to write test cases for all combinations that different values passed by parameters can execute. If there are no arguments, it's clear. If there's one argument, is not too hard. If there are two arguments the problem is already a bit challenging. More than that it starts to be complex.&lt;/p&gt;
&lt;h5&gt;
  
  
  Flag Arguments
&lt;/h5&gt;

&lt;p&gt;Flag arguments are ugly. Passing a boolean into a function is a truly terrible practice. It complicates the signature of the method and it declares that the function does more than one thing. It does one thing if the flag is &lt;code&gt;true&lt;/code&gt; and it does another thing if the flag is &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;
&lt;h5&gt;
  
  
  Argument Objects
&lt;/h5&gt;

&lt;p&gt;When a function needs more than three or four arguments, it is likely that one or more arguments are wrapped into an object.&lt;/p&gt;

&lt;p&gt;It looks like cheating, but it's not. The object is part of a clear context that is passed to the function, not just a list of different single values.&lt;/p&gt;
&lt;h5&gt;
  
  
  Have no side-effects
&lt;/h5&gt;

&lt;p&gt;Functions must promise to do one thing only. They cannot do &lt;em&gt;hidden&lt;/em&gt; things that may lead to unexpected behaviours.&lt;/p&gt;
&lt;h5&gt;
  
  
  Command Query Separation
&lt;/h5&gt;

&lt;p&gt;Functions should either do something or answer something, but not both.&lt;/p&gt;

&lt;p&gt;This gets easier to understand with an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// THIS IS BAD
public boolean set(String value, int size)  // it should not set a value and return a boolean.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Imagine the readability of this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// THIS IS CONFUSING
if (set("height", 10)) {...}  // is it a question about what was set? or is it a question about what is set now?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Extract Try/Catch Blocks
&lt;/h5&gt;

&lt;p&gt;Just like mentioned before about &lt;em&gt;Blocks and Indenting&lt;/em&gt;, the &lt;code&gt;try&lt;/code&gt;/&lt;code&gt;catch&lt;/code&gt; blocks are ugly because they mix error handling with business code. It's better to extract the bodies of the &lt;code&gt;try&lt;/code&gt; and &lt;code&gt;catch&lt;/code&gt; into functions of their own.&lt;/p&gt;

&lt;h5&gt;
  
  
  Don't Repeat Yourself
&lt;/h5&gt;

&lt;p&gt;Duplication may be the root of all evil in software. Use OO wisely as a strategy for eliminating duplication.&lt;/p&gt;

&lt;h5&gt;
  
  
  Conclusion
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;Master programmers think of systems as stories to be told rather than programs to be written.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Chapter 4: Comments
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Don't comment bad code - rewrite it!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Nothing can be more damaging as an old comment that propagates lies and misinformation.&lt;br&gt;
The older the comment is, the farther away it is from the code it describes, the more likely it is to be plain wrong. &lt;/p&gt;
&lt;h5&gt;
  
  
  Comments Do Not Make Up for Bad Code
&lt;/h5&gt;

&lt;p&gt;A good reason to write comments is bad code. It's used when the code is a mess. Someone thinks "Ah, I'd better comment that!". What should be done? Better clean it!&lt;/p&gt;
&lt;h5&gt;
  
  
  Explain Yourself in Code
&lt;/h5&gt;

&lt;p&gt;This deserves just an example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Check if an employee is eligible for full benefits
if ((emplioyee.flags &amp;amp;&amp;amp; HOURLY_FLAG) &amp;amp;&amp;amp; (employee.age &amp;gt; 65)) {...}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above comment is not necessary. Just change the condition to be a meaningful named function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (employee.isEligibleForFullBenefits) {...}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Bad Comments
&lt;/h5&gt;

&lt;p&gt;Most comments fall into this category. Usually, they are excuses for poor code or justification for insufficient decisions, amounting to little more than the programmer talking to himself.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Any comment that required you to look into another module to check the meaning of that comment has failed to communicate to you and is not worth the bits it consumes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h5&gt;
  
  
  Don't Use a Comment When You Can Use a Function or a Variable
&lt;/h5&gt;

&lt;p&gt;This title speaks for itself. As seen above, replace comments with a meaningful named function or variable! #profit&lt;/p&gt;

&lt;h3&gt;
  
  
  Chapter 5: Formatting
&lt;/h3&gt;

&lt;h5&gt;
  
  
  The Purpose of Formatting
&lt;/h5&gt;

&lt;p&gt;Code formatting is too important to be ignored. It is about communication, and communication is the professional developer's first order of business.&lt;/p&gt;

&lt;h5&gt;
  
  
  Vertical Formatting
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;How big should a source file be?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There are many source analyzers that can try to help when managing the size of classes and methods. The book Clean Code brings a graph with the average file length in different projects. It is interesting to have an idea of the files with the smaller and biggest length, even when it is for a personal project.&lt;/p&gt;

&lt;h5&gt;
  
  
  Vertical Openness Between Concepts
&lt;/h5&gt;

&lt;p&gt;Nearly all code is read left to right and top to bottom. Each line represents an expression or clause, and each group of lines represents a complete thought. Those thoughts should be separated from each other with blank lines.&lt;/p&gt;

&lt;h5&gt;
  
  
  Vertical Distance
&lt;/h5&gt;

&lt;p&gt;Concepts that are closely related should be kept vertically closed to each other.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Dependent Functions&lt;/em&gt;. If one function calls another, they should be vertically close and the caller should be above the callee, if at all possible.&lt;/p&gt;

&lt;h5&gt;
  
  
  Vertical Ordering
&lt;/h5&gt;

&lt;p&gt;In general, we want function call dependencies to point in the downward direction. That is, a function that is called should be below a function that does the calling. This creates a once flow down the source code module from high level to low level.&lt;/p&gt;

&lt;p&gt;As in newspaper articles, we expect the most important concepts to come first, and we expect then to be expressed with the least amount of polluting detail. We expect the low-level details to come last. This allows us to skim the source files, getting the gist from the first few functions, without having to immerse ourselves in the details.&lt;/p&gt;

&lt;h3&gt;
  
  
  Chapter 6: Objects and Structures
&lt;/h3&gt;

&lt;p&gt;Hiding implementation is not a matter of putting a layer of functions between the variables. Hiding the implementation is about abstractions! A class does not simply push its variables out through getters and setters. Rather it exposes abstract interfaces that allow its users to manipulate the &lt;em&gt;essence&lt;/em&gt; of data, without having to know its implementation.&lt;/p&gt;

&lt;h5&gt;
  
  
  Data/Object Anti-Symmentry
&lt;/h5&gt;

&lt;p&gt;Object hide their data behind abstractions and expose functions that operate on that data. Data structure expose their data and have no meaningful functions.&lt;/p&gt;

&lt;p&gt;Below the &lt;em&gt;dichotomy&lt;/em&gt; between objects and data structures:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Procedural code (code using data structures) makes it easy to add new functions without changing the existing data structures. OO code, on the other hand, makes it easy to add new classes without changing existing functions.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And...&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Procedural code makes it hard to add new data structures because all the functions must change. OO code makes it hard to add new functions because all the classes must change.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Mature programmers know that the idea that everything is an object is a &lt;em&gt;myth&lt;/em&gt;. Sometimes you really &lt;em&gt;do&lt;/em&gt; want simple data structures with procedures operating on them.&lt;/p&gt;

&lt;h5&gt;
  
  
  The Law of Demeter
&lt;/h5&gt;

&lt;p&gt;The method should &lt;em&gt;not&lt;/em&gt; invoke methods on objects that are returned by any of the allowed functions. In other words, talk to friends, not to strangers.&lt;br&gt;
The following code appears to violate the Law of Demeter (among other things) because it calls the &lt;code&gt;getScratchDir()&lt;/code&gt; function on the return of &lt;code&gt;getOptions()&lt;/code&gt; and then calls &lt;code&gt;getAbsolutePath()&lt;/code&gt; on the return of value of &lt;code&gt;getScratchDir()&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;final String outputDir = ctxt.getOptions().getScratchDir().getAbsolutePath();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  The Wrecks
&lt;/h5&gt;

&lt;p&gt;This kind of code is often called a &lt;em&gt;train wreck&lt;/em&gt; because it looks like a bunch of coupled train cars. Chains of calls like this are generally considered to be sloppy style and should be avoided. It's usually best to split them up as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Options opts = ctxt.getOptions();
File scratchDir = opts.getScratchDir();
final String outputDir = scratchDir.getAbsolutePath();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Whether it is a violation of Demeter depends on whether or not &lt;code&gt;ctxt&lt;/code&gt;, &lt;code&gt;Options&lt;/code&gt;, and &lt;code&gt;ScratchDir&lt;/code&gt; are objects or data structures. If they are objects, then their internal structure should be hidden rather than exposed, and so knowledge of their innards is a clear violation of the Law of Demeter. On the other hand, if &lt;code&gt;ctxt&lt;/code&gt;, &lt;code&gt;Options&lt;/code&gt;, and &lt;code&gt;ScratchDir&lt;/code&gt; are just data structures with no behaviour, then they naturally expose their internal structure, and so Demeter does NOT apply.&lt;br&gt;
The use of accessor functions confuses the issue. If the code had been written as follows, then we probably wouldn't be asking about Demeter violations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;final String outputDir = ctxt.options.scratchDir.absolutePath;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The issue would be a lot less confusing if data structures simply had public variables and no functions, whereas objects had private variables and public functions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Chapter 7: Error Handling
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Error handling is important, but if it obscures logic, it's wrong.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h5&gt;
  
  
  Use Unchecked Exception
&lt;/h5&gt;

&lt;p&gt;When checked exceptions were introduced in Java, they seemed like a great idea. The signature of every method would list all possible exceptions it could throw to its caller. The code would not compile if the signature of the method didn't match what your code could do.&lt;br&gt;
They were thought to be a great idea, but now it's known as not. Other languages like C#, C++, Python or Ruby don't have checked exception and they work well without it.&lt;/p&gt;

&lt;p&gt;So, what's the price to use checked exceptions?&lt;br&gt;
It violates the &lt;em&gt;Open/Closed Principle&lt;/em&gt;, where software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification. &lt;br&gt;
If you throw a checked exception from a method in your code and the &lt;code&gt;catch&lt;/code&gt; is 3 levels above, you &lt;em&gt;must declare the exception in the signature of the method between you and the catch&lt;/em&gt;. It means that a change at a low level of the software can force signature changes on many higher levels.&lt;br&gt;
Also, encapsulation is broken because all functions in the path of a throw must know about details of that low-level exception. &lt;/p&gt;
&lt;h5&gt;
  
  
  Provide Context with Exceptions
&lt;/h5&gt;

&lt;p&gt;Create informative error messages and pass them along with your exceptions. If you are logging in your applications, pass along enough information to be able to log the error in your &lt;code&gt;catch&lt;/code&gt;.&lt;/p&gt;
&lt;h5&gt;
  
  
  Do NOT Return Null
&lt;/h5&gt;

&lt;p&gt;When we return &lt;code&gt;null&lt;/code&gt;, we are essentially creating work for ourselves and foisting problems upon our callers. All it takes is one mission &lt;code&gt;null&lt;/code&gt; check to send an application spinning out of control.&lt;/p&gt;
&lt;h5&gt;
  
  
  Do NOT Pass Null
&lt;/h5&gt;

&lt;p&gt;Returning &lt;code&gt;null&lt;/code&gt; from methods is bad, but passing &lt;code&gt;null&lt;/code&gt; into methods is worse. Unless you're working with an API which expects you to pass &lt;code&gt;null&lt;/code&gt;, you should avoid passing &lt;code&gt;null&lt;/code&gt; in your code whenever possible.&lt;/p&gt;

&lt;p&gt;Passing &lt;code&gt;null&lt;/code&gt; into a method can possibly result in a &lt;code&gt;NullPointerException&lt;/code&gt; wherever a &lt;code&gt;null&lt;/code&gt; check is missing.&lt;/p&gt;

&lt;p&gt;In most programming languages there is no good way to deal with a &lt;code&gt;null&lt;/code&gt; that is passed by a caller accidentally. Because this is the case, the rational approach is to forbid passing &lt;code&gt;null&lt;/code&gt; by default. When you do, you can code with the knowledge that a &lt;code&gt;null&lt;/code&gt; in an argument list is an indication of a problem, and end up with far fewer careless mistakes.&lt;/p&gt;
&lt;h3&gt;
  
  
  Chapter 8: Boundaries
&lt;/h3&gt;
&lt;h5&gt;
  
  
  Third Parties
&lt;/h5&gt;

&lt;p&gt;Third-party implementation (aka libraries) has 2 important goals:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;it must have broad applicability (intention of providers).&lt;/li&gt;
&lt;li&gt;it must implement specific needs (intention of the users).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The users may want to use a library or API, but not have all its methods available to their developers.&lt;br&gt;
The book brings an example of the &lt;code&gt;java.util.Map&lt;/code&gt;, which demonstrate that the &lt;code&gt;Map&lt;/code&gt; API can have many methods available to who uses it, even if that's not the intention of the user to provide them. &lt;br&gt;
Let's say no one should remove an object from the &lt;code&gt;Map&lt;/code&gt;, what could be done, since the method &lt;code&gt;remove(Object key)&lt;/code&gt; is available?&lt;br&gt;
One suggestion is to encapsulate the use of the API in a class containing a &lt;code&gt;private&lt;/code&gt; variable and to expose the desired methods by creating proxy methods.&lt;br&gt;
Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class Products {

    private Map&amp;lt;Product&amp;gt; products = new HashMap&amp;lt;Product&amp;gt;();

    public Product getById(String: id) {
        return products.get(id)
    }

    public void delete(String: id) {
        products.remove(id)  // fell free to add a try/catch and throw a proper exception if the item does not exist
    }

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Code that does not exist
&lt;/h5&gt;

&lt;p&gt;When something needs to be developed to be integrated with a code that does not yet exist, it's possible to create a &lt;em&gt;fake&lt;/em&gt; interface to mock the API with the external code. It helps to test the code and to keep the internal consistency, without impact from methods and variables names or method signatures.&lt;/p&gt;

&lt;h5&gt;
  
  
  Clean Boundaries
&lt;/h5&gt;

&lt;p&gt;Boundaries with third-party must be coded in very few places to refer them. One of the advantages is that the code in the boundary has fewer maintenance points when the third-party changes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Chapter 9: Tests
&lt;/h3&gt;

&lt;p&gt;Test code must be implemented with the same standards of quality than production code. There must not be any license to break the rules in tests codebase.&lt;/p&gt;

&lt;p&gt;Having dirty tests is a horrible practice. The problem is that tests must change as the production code evolves. The dirtier the tests, the harder they are to change.&lt;/p&gt;

&lt;p&gt;A code must have tests to ensure that changes in the production code work as expected. If there aren't good tests, their maintainability becomes difficult, the number of tests decreases, the bugs may increase after releases, fear of changes make users believe that they will bring more harm than good. The code starts to rot.&lt;/p&gt;

&lt;h5&gt;
  
  
  What's make a good test?
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;Readability, readability, readability.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h5&gt;
  
  
  Single concept per test
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;We don't want long test functions that go testing one miscellaneous thing after another.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Each assertion deserves one test. If that's not possible, they should be grouped by the concept.&lt;/p&gt;

&lt;h5&gt;
  
  
  F.I.R.S.T.
&lt;/h5&gt;

&lt;p&gt;F: Fast&lt;br&gt;
I: Independent&lt;br&gt;
R: Repeatable&lt;br&gt;
S: Self-Validating (output must be true/false, pass/fail - nothing in between)&lt;br&gt;
T: Timely (written before production code)&lt;/p&gt;
&lt;h3&gt;
  
  
  Chapter 10: Classes
&lt;/h3&gt;
&lt;h5&gt;
  
  
  Encapsultation
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Variables and utility functions must be kept &lt;em&gt;private&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;If a test in the same package must call a function, it can be made &lt;code&gt;protected&lt;/code&gt; or &lt;code&gt;package scope&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;
  
  
  Small
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;The first rule of classes is that they should be small. The second rule of classes is that they should be smaller than that.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A class must have only one responsibility.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;We should be able to write a brief description of the class in about 25 words, without using "if", "and", "or" or "but".&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h5&gt;
  
  
  The Single Responsibility Principle
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;The Single Responsibility Principle states that a class or module should have one, and only one, &lt;em&gt;reason to change&lt;/em&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Classes should have one responsibility - one reason to change.&lt;/li&gt;
&lt;li&gt;Trying to identify responsibilities (reasons to change) often helps us recognise and create better abstractions in our code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;... SRP is often the most abused class design principle.&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Maintaining separation of concerns is just as important in our programming activities as it is in our programs.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Question: &lt;br&gt;
&lt;em&gt;Do you want your tools organised into toolboxes with many small drawers each containing well-defined and well-labelled components? Or do you want a few drawers that you just toss everything into?&lt;/em&gt;&lt;/p&gt;
&lt;h5&gt;
  
  
  Coehision
&lt;/h5&gt;

&lt;p&gt;Cohesion must be high. When cohesion is high, it means that the &lt;strong&gt;methods and variables of the class&lt;/strong&gt; are co-dependent and hang together as a logical whole.&lt;/p&gt;
&lt;h5&gt;
  
  
  Modifications
&lt;/h5&gt;

&lt;p&gt;Any modifications in the class have the potential of breaking other code in the class. It must be fully &lt;strong&gt;retested&lt;/strong&gt;.&lt;/p&gt;
&lt;h5&gt;
  
  
  Coupled vs Decoupled
&lt;/h5&gt;

&lt;p&gt;Coupled code: code connected to many others - where it depends on others and others depend on it.&lt;br&gt;
Decoupled code: code isolated.&lt;/p&gt;

&lt;p&gt;A system decoupled will be more flexible and promote more reuse. The lack of coupling means that the elements of our system are better isolated from each other and from change. This isolation makes it easier to understand each element of the system.&lt;/p&gt;
&lt;h3&gt;
  
  
  Chapter 11: Systems
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;It is a myth that we can get systems "&lt;em&gt;right the first time&lt;/em&gt;".&lt;/li&gt;
&lt;li&gt;Software systems are unique compared to physical systems. Their architectures can grow incrementally, &lt;strong&gt;IF&lt;/strong&gt; we maintain the proper &lt;strong&gt;separation of concerns&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;
  
  
  BDUF
&lt;/h5&gt;

&lt;p&gt;BDUF: &lt;em&gt;Big Design Up Front&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;The book mentions it is not necessary to do BDUF and that it is even harmful because It inhibits adapting to change, due to the psychological resistance to discarding prior effort and because of the way architecture choices influence subsequent thinking about design.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In a sufficiently large system, whether it is a city or a software project, no one person can make all the decisions.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h5&gt;
  
  
  Use standards wisely
&lt;/h5&gt;

&lt;p&gt;Standards must add demonstrable value. Teams cannot be obsessed with various &lt;em&gt;strongly hyped&lt;/em&gt; standards and lose focus on implementing value for their customers.&lt;/p&gt;
&lt;h3&gt;
  
  
  Chapter 12: Emergence
&lt;/h3&gt;

&lt;p&gt;Kent Beck defines "simple" design with the following rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Runs all the tests.&lt;/li&gt;
&lt;li&gt;Contains no duplication.&lt;/li&gt;
&lt;li&gt;Expresses the intent of the programmer.&lt;/li&gt;
&lt;li&gt;Minimises the number of classes and methods.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The rules are in order of importance.&lt;/p&gt;
&lt;h5&gt;
  
  
  Run all tests
&lt;/h5&gt;

&lt;p&gt;Making a system testable pushes developers toward a design where classes are small and single purpose. It's easier to test classes that conform to the SRP. The more tests we write, the more we'll continue to push toward things that are simpler to test.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;The fact is that we have these tests eliminates the fear that cleaning up the code will break it!&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We can apply anything from the body of knowledge about good software design. We can increase cohesion, decrease coupling, separate concerns, modularise concerns, shrink our functions and classes, choose better names, etc.&lt;/p&gt;
&lt;h5&gt;
  
  
  No duplication
&lt;/h5&gt;

&lt;p&gt;Duplication is the primary enemy of a well-designed system. It represents additional work, additional risk, and additional unnecessary complexity.&lt;/p&gt;
&lt;h5&gt;
  
  
  Expressive
&lt;/h5&gt;

&lt;p&gt;When software becomes big and complex, it demands more time from a developer to understand it, and there is even a greater opportunity to misunderstanding it.&lt;/p&gt;

&lt;p&gt;The clearer the author can make the code, the less time others will have to spend understanding it.&lt;/p&gt;

&lt;p&gt;Below what can reduce defects and shrink the cost of maintenance.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can express yourself by choosing good names.&lt;/li&gt;
&lt;li&gt;You can express yourself by keeping your functions and methods small.&lt;/li&gt;
&lt;li&gt;You can express yourself by using standard nomenclature.&lt;/li&gt;
&lt;li&gt;You can have well-written unit tests that are expressive.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Spend a little time with each of your functions and classes. Choose better names, spit large functions into smaller functions, and generally just take care of what you've created. Care is a precious resource.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h5&gt;
  
  
  Minimal Classes and Methods
&lt;/h5&gt;

&lt;p&gt;The goal is to keep the overall system small the functions and classes are also kept small. This is &lt;strong&gt;the lowest priority of the four rules&lt;/strong&gt; od Simple Design. &lt;/p&gt;

&lt;p&gt;So, although it's important to keep class and function count low, it's more important to have tests, eliminate duplication, and express yourself.&lt;/p&gt;
&lt;h3&gt;
  
  
  Chapter 13: Concurrency
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Writing clean concurrent programs is hard - very hard.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Correct concurrency is complex, even for simple problems.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;
  
  
  Concurrency Defense Principles - SRP
&lt;/h5&gt;

&lt;p&gt;The Single Responsibility Principle states that a given method/class/component should have a single reason to change. Concurrency design is complex enough to be a reason to change in its own right and therefore deserves to be separated from the rest of the code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Recommendation:&lt;/strong&gt; Keep your concurrency-related code separated from other code.&lt;/p&gt;
&lt;h5&gt;
  
  
  Know Your Library
&lt;/h5&gt;

&lt;p&gt;A few things to consider when writing threaded code in Java:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use the provided thread-safe collections.&lt;/li&gt;
&lt;li&gt;Use the executor framework for executing unrelated tasks.&lt;/li&gt;
&lt;li&gt;Use non-blocking solutions when possible.&lt;/li&gt;
&lt;li&gt;Several library classes are not thread safe.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Recommendation 1:&lt;/strong&gt; Review the classes available to you. In case of Java, become familiar with the &lt;code&gt;java.util.concurrent&lt;/code&gt;, &lt;code&gt;java.util.concurrent.atomic&lt;/code&gt; and &lt;code&gt;java.util.concurrent.locks&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Recommendation 2:&lt;/strong&gt; Learn the basic algorithms and understand their solutions.&lt;/p&gt;
&lt;h5&gt;
  
  
  Synchronized blocks
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;"... if there is more than on synchronized method on the same shared class, then your system may be written incorrectly"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The &lt;code&gt;synchronized&lt;/code&gt; keyword introduces a lock. All sections of code guarded by the same lock are guaranteed to have only one thread executing through them at any given time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Recommendation:&lt;/strong&gt; Keep your synchronized sections as small as possible.&lt;/p&gt;
&lt;h5&gt;
  
  
  Testing Threaded Code
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;Write tests that have the potential to expose problems and then run them frequently, with different programmatic configurations and system configurations and load. If tests ever fail, track down the failure. Don't ignore a failure just because the tests pass on a subsequent run.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h5&gt;
  
  
  Get Your Nonthreaded Code Working First
&lt;/h5&gt;

&lt;p&gt;This may seem obvious, but it doesn't hurt to reinforce it.&lt;br&gt;
So not try to chase down non-threading bugs and threading bugs at the same time. Make sure your code works outside of threads first.&lt;/p&gt;
&lt;h3&gt;
  
  
  Chapter 14: Successive Refinement
&lt;/h3&gt;

&lt;p&gt;This chapter of the book is a case study. Below there are a few aspects I thought interesting mentioning.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To write clean code, you must first write dirty code and then clean it.&lt;/li&gt;
&lt;li&gt;Much of good software design is simply about partitioning - creating appropriate places to put a different kind of code. This separation of concerns makes the code much simpler to understand and maintain.&lt;/li&gt;
&lt;li&gt;Programmers who satisfy themself with merely &lt;em&gt;working code&lt;/em&gt; are behaving unprofessionally. &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Nothing has more profound and long-term degrading effect upon a development project than bad code.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Of course, bad code can be cleaned up. But it's very expensive. As code rots, the modules insinuate themselves into each other, creating lots of hidden and tangled dependencies.&lt;br&gt;
On the other hand, keeping the code clean is relatively easy. If you made a mess in a module in the morning, it is easy to clean up in the afternoon.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The solution is to continuously keep your code as clean and simple as it can be. Bevel let the code rot.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  Chapter 15: JUnit Internals
&lt;/h3&gt;

&lt;p&gt;This chapter is somehow similar to Chapter 14. The JUnit framework code is analysed by the book author and criticised.&lt;br&gt;
Is not relevant to write down all the suggestions he's making to change JUnit code. &lt;/p&gt;

&lt;p&gt;Below the conclusion from the author of the book:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;... we have satisfied the Scout Boy Rule. We have left this module a bit cleaner than we found it. Not that it wasn't clean already. The authors (of JUnit) had done an excellent job with it. Bit no module is immune from improvement, and each of us has the responsibility to leave the code a little better than we found it.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  Chapter 16: Refactoring SerialDate
&lt;/h3&gt;

&lt;p&gt;This chapter is very similar to Chapter 15, but the code inspected was from the class &lt;code&gt;SerialDate&lt;/code&gt;. Just like in the previous chapter, it shows areas of potential improvement in the code.&lt;/p&gt;
&lt;h3&gt;
  
  
  Chapter 17: Smells and Heuristics
&lt;/h3&gt;

&lt;p&gt;This chapter is a summary of many things seen throughout the book.&lt;/p&gt;
&lt;h4&gt;
  
  
  Comments
&lt;/h4&gt;
&lt;h5&gt;
  
  
  Obsolete Comment
&lt;/h5&gt;

&lt;p&gt;Comments get old quickly. It is best not to write a comment that will become obsolete.&lt;/p&gt;
&lt;h5&gt;
  
  
  Redundant Comment
&lt;/h5&gt;

&lt;p&gt;Comments should say things that the code cannot say for itself.&lt;/p&gt;
&lt;h5&gt;
  
  
  Poorly Written Comment
&lt;/h5&gt;

&lt;p&gt;If you're gonna write a comment, take the time to make sure it is the best comment you can write.&lt;/p&gt;
&lt;h5&gt;
  
  
  Commented-Out Code
&lt;/h5&gt;

&lt;p&gt;That code sits there and rots, getting less and less relevant with every passing day. Commented-out code is an &lt;em&gt;abomination&lt;/em&gt;.&lt;br&gt;
When you see commented-out code, &lt;em&gt;delete it&lt;/em&gt;. Don't worry, the source code control system still remembers it.&lt;/p&gt;
&lt;h4&gt;
  
  
  Environment
&lt;/h4&gt;
&lt;h5&gt;
  
  
  Build Required More Than One Step
&lt;/h5&gt;

&lt;p&gt;You should be able to check out the system with one simple command and then issue one simple command to build it.&lt;/p&gt;
&lt;h5&gt;
  
  
  Tests Require More Than One Step
&lt;/h5&gt;

&lt;p&gt;Being able to run all tests is so fundamental and so important that it should be quick, easy and obvious to do.&lt;/p&gt;
&lt;h4&gt;
  
  
  Functions
&lt;/h4&gt;
&lt;h5&gt;
  
  
  Too Many Arguments
&lt;/h5&gt;

&lt;p&gt;Functions should have a small number of arguments. More than three is very questionable.&lt;/p&gt;
&lt;h5&gt;
  
  
  Output Arguments
&lt;/h5&gt;

&lt;p&gt;Output arguments are counterintuitive.&lt;/p&gt;
&lt;h5&gt;
  
  
  Flag Arguments
&lt;/h5&gt;

&lt;p&gt;Boolean arguments loudly declare that the function does more than one thing.&lt;/p&gt;
&lt;h5&gt;
  
  
  Dead Function
&lt;/h5&gt;

&lt;p&gt;Keeping dead code around is wasteful.&lt;/p&gt;
&lt;h4&gt;
  
  
  General
&lt;/h4&gt;
&lt;h5&gt;
  
  
  Multiple Languages in One Source Code
&lt;/h5&gt;

&lt;p&gt;The idea is for a source file to contain one, and only one, language. Realistically, we will probably have to use more than one. But we should take pains to minimise both the number and extent of extra languages in our source files.&lt;/p&gt;
&lt;h5&gt;
  
  
  Obvious Behaviour Is Unimplemented
&lt;/h5&gt;

&lt;p&gt;When an obvious behaviour is not implemented, readers and users of the code can no longer depend on their intuition about function names.&lt;/p&gt;
&lt;h5&gt;
  
  
  Override Safeties
&lt;/h5&gt;

&lt;p&gt;Turning off certain compiler warning (or all warnings) may help you get the build to succeed but at all risk of endless debugging sessions. Turning off failing tests and telling yourself you're getting them to pass later is as bad as pretending your credit cards are free money.&lt;/p&gt;
&lt;h5&gt;
  
  
  Duplication
&lt;/h5&gt;

&lt;p&gt;This is one of the most important rules in this book and it should be taken very seriously. Andy Hunt and Dave Thomas call it DRY (Don't Repeat Yourself). Kent Beck made it one of the core principles of Extreme Programming and called it: "Once and only once".&lt;/p&gt;

&lt;p&gt;Every time you see duplication in the code, it represents a missed opportunity for abstraction.&lt;/p&gt;

&lt;p&gt;Still more subtle are the modules that have similar algorithms, but that don't share similar lines of code. This is still duplication and should be addressed by using the TEMPLATE METHOD it STRATEGY pattern.&lt;/p&gt;
&lt;h5&gt;
  
  
  Base Classes Depending on Their Derivatives
&lt;/h5&gt;

&lt;p&gt;The most common reason for partitioning concepts into base and derivative classes is so that the highest level base class concepts can be independent of the lower level derivative class concepts.&lt;/p&gt;
&lt;h5&gt;
  
  
  Too Much Information
&lt;/h5&gt;

&lt;p&gt;A well-defined interface does not offer very many functions to depend upon, so coupling is low. A poorly defined interface provides lots of functions that you must call, so coupling is high.&lt;/p&gt;
&lt;h5&gt;
  
  
  Dead Code
&lt;/h5&gt;

&lt;p&gt;Dead code is code that isn't executed. After a while, it starts to smell. That happens because dead code isn't updated when the designs change. It still compiles but does not follow the newer conventions or rules.&lt;/p&gt;
&lt;h5&gt;
  
  
  Inconsistency
&lt;/h5&gt;

&lt;p&gt;If you do something a certain way, do all similar things in the same way.&lt;/p&gt;
&lt;h5&gt;
  
  
  Clutter
&lt;/h5&gt;

&lt;p&gt;Clutters are useless things in the code (my words).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Functions that are never called.&lt;/li&gt;
&lt;li&gt;Variables that are never used.&lt;/li&gt;
&lt;li&gt;Comments that are useless.&lt;/li&gt;
&lt;li&gt;Default constructor with no implementation.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;All these things are clutters and should be removed.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h5&gt;
  
  
  Missplaced Responsibility
&lt;/h5&gt;

&lt;p&gt;One of the most important decisions a software developer can make is where to put code.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Code should be placed where a reader would naturally expect it to be.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h5&gt;
  
  
  Innapropriate Static
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;If you want a function to be static, make sure that there is no chance that you'll want it to behave polymorphically.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h5&gt;
  
  
  Use Explanatory Variables
&lt;/h5&gt;

&lt;p&gt;One of the more powerful ways to make a program readable is to break the calculations up into intermediate values that are held in variables with meaningful names.&lt;/p&gt;
&lt;h5&gt;
  
  
  Function Names Should Say What They Do
&lt;/h5&gt;

&lt;p&gt;In the code below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Date newDate = date.add(5);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What do you expect this code to add to the date?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;5 seconds&lt;/li&gt;
&lt;li&gt;5 minutes&lt;/li&gt;
&lt;li&gt;5 hours&lt;/li&gt;
&lt;li&gt;5 days&lt;/li&gt;
&lt;li&gt;5 weeks&lt;/li&gt;
&lt;li&gt;5 months&lt;/li&gt;
&lt;li&gt;5 years&lt;/li&gt;
&lt;li&gt;...&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Variable names must be named to have an easy understanding for the reader.&lt;br&gt;
A better name for the code above would be name the method &lt;code&gt;addDaysTo(n)&lt;/code&gt; or &lt;code&gt;increaseByDays(n)&lt;/code&gt;.&lt;/p&gt;
&lt;h5&gt;
  
  
  Prefer Polymorphism to If/Else or Switch/Case
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;I use the following "ONE SWITCH" rule. There may be no more than one switch statement for a given type selection. The cases in that switch statement must create polymorphic objects that take the place of other such switch statements in the rest of the system.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h5&gt;
  
  
  Follow Standard Conventions
&lt;/h5&gt;

&lt;p&gt;Every team should follow a coding standard based on common industry norms.&lt;/p&gt;
&lt;h5&gt;
  
  
  Replace Magic Numbers with Named Constants
&lt;/h5&gt;

&lt;p&gt;This is probably one of the oldest rules in software development.&lt;/p&gt;
&lt;h5&gt;
  
  
  Be Precise
&lt;/h5&gt;

&lt;p&gt;When you make a decision in your code, make sure you make it precisely. Know why you have made it and how you will deal with any exceptions.&lt;/p&gt;
&lt;h5&gt;
  
  
  Structure over Convention
&lt;/h5&gt;

&lt;p&gt;Naming conventions are good, but they are inferior to structures that force compliance.&lt;/p&gt;
&lt;h5&gt;
  
  
  Encapsulate Conditionals
&lt;/h5&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;code&gt;if (shouldBeDeleted(timer)) {...}&lt;/code&gt;&lt;br&gt;
is preferable to&lt;br&gt;
&lt;code&gt;if (timer.hasExpired() &amp;amp;&amp;amp; !timer.isRecurrect()) {...}&lt;/code&gt;&lt;/p&gt;
&lt;h5&gt;
  
  
  Avoid Negative Conditionals
&lt;/h5&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;code&gt;if (buffer.shouldCompact())&lt;/code&gt;&lt;br&gt;
is preferable to &lt;br&gt;
&lt;code&gt;if (!buffer.shouldNotCompact())&lt;/code&gt;&lt;/p&gt;
&lt;h5&gt;
  
  
  Functions Should Do One Thing
&lt;/h5&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public void pay() {
  for (Employee e: employees) {
    if (e.isPayday()) {
      Money pay = e.calculatePay();
      e.deliverPay(pay);
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;should be split in&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public void pay() {
  for (Employee e: employees) {
    payIfNecessary(e);
  }
}

private void payIfNecessary(Employee e) {
  if (e.isPayday) {
    calculateAndDeliverPay(e);
  }
}

private calculateAndDeliverPay(Employee e) {
  Money pay = e.calculatePay();
  e.deliverPay(pay);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Encapsulate Boundary Conditions
&lt;/h5&gt;

&lt;p&gt;Observe that the snippet &lt;code&gt;level + 1&lt;/code&gt; appears twice in the code below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (level + 1 &amp;lt; tags.length) {
  parts = new Parse(body, tags, level + 1, offset + endTag)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a boundary condition that should be encapsulated into a variable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int nextLevel = level + 1;
if (nextLevel &amp;lt; tags.length) {
  parts = new Parse(body, tags, nextLevel, offset + endTag)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Java
&lt;/h4&gt;

&lt;h5&gt;
  
  
  Constants versus Enums
&lt;/h5&gt;

&lt;p&gt;Enums exist in Java for a while. Use them. Don't keep using the old trick &lt;code&gt;public static void final int&lt;/code&gt;s. The meaning of &lt;code&gt;int&lt;/code&gt;'s can get lost. The meaning of &lt;code&gt;enum&lt;/code&gt;'s cannot because they belong to an enumeration that is named.&lt;/p&gt;

&lt;h4&gt;
  
  
  Names
&lt;/h4&gt;

&lt;h5&gt;
  
  
  Choose Descriptive Names
&lt;/h5&gt;

&lt;p&gt;Make sure the name is descriptive.&lt;br&gt;
This is not just a &lt;em&gt;feel-good&lt;/em&gt; recommendation. Names in software are 90 percent of what makes software readable.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Names are too important to treat carelessly.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Tests
&lt;/h4&gt;

&lt;h5&gt;
  
  
  Insufficient Tests
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;A test suite should test everything that can possibly break.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h5&gt;
  
  
  Don't Skip Trivial Tests
&lt;/h5&gt;

&lt;p&gt;They are easy to write and their documentary value is higher than the cost to produce them.&lt;/p&gt;

&lt;h5&gt;
  
  
  Exhaustively Test Near Bugs
&lt;/h5&gt;

&lt;p&gt;When you find a bug in a function, it is wise to do an exhaustive test if that function. You'll probably find that the bug was not alone.&lt;/p&gt;

&lt;h5&gt;
  
  
  Tests Should Be Fast
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;A slow test is a test that &lt;strong&gt;won't get run&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Final Note
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Professionalism and craftsmanship come from values that drive disciplines.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>cleancode</category>
      <category>books</category>
      <category>career</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
