How To Code Well

How To Code Well

By Peter FisherTechnology
Download on the App Store

How To Code Well episodes

  • 148 - The Best Bug Tracking Tools

    Change log

    • EP 147 is now available. In that episode I talked about the process of fixing a bug
    • PHP UK

      • Keynote: Never stop learning, or how cursory and cross pollination drives innovation by Pauline Vos
      • Talk on OpenAPI from Rob Allen - Lots of useful resources and a guide to the Yaml configuration
      • Talk on improving your documentation by Alexandra White
      • Embrace the pitfalls (Our stop start journey to Change) by Stacy Cashmore
      • Closing keynote: Passwords are so 1990 by Sam Bellen
      • Keynote: Open source is good for business by Lorna Jane Mitchell
      • Talk on PHP fibers by Milko Kosturkov - Async PHP code
      • Talk on the blockchain and crypto (Hop on the PHP Block chain rocket to the MOON!) By Drishti Jain
      • Talk on Practical advanced static analysis by Date Liddament
      • From Betamax to VCR: Harden your API integration testing by James Second
      • Closing keynote: Leading in Tech by Michael Cullum
      • We have a new puppy called Goose

        • 8 Weeks old
        • English Springer Spaniel
        • Super cute
        • I gave a talk to PHP South West (in person) and to the Symfony user group in Portugal (Remote)

          • Code with confidence using PHPStan
          • I want to give a shout out to JoelTheDeveloper who I meet at PHPUK, he has a his own YouTube channel which talks about development and the mindset of devs. He’s done a great video regarding handling your ego as a developer. Please checkout his channel 

            Bug tracking tools

            • It doesn’t mater what tool you use as long as you have eyes on the issues
            • Friction hurts progress.
              • Tools should be easy to use
              • Easy to integrate with the current toolset
              • Easy to integrate outside of the current ecosystem
              • Low learning curve
              • Will it be self hosted
              • Can you import your current bugs/tasks
              • Can you export bugs/issues
              • What are the security implications
              • Can all devs on your team use it on their platforms
              • Does it need to be mobile friendly
              • How can it integrate well with other tools
                • Does it have an API
                • Watch the show on YouTube

                  Contact me and let me know your thoughts or get something read out on air.

                  55 min
                • 147 - How to fix a bug

                  Change log 

                  - Yesterday I gave a talk about PHPStan and code confidence to PHP South West 

                  - I’m going to give the talk again:  

                  The Symfony user group in Portugal on the 22nd of Feb  

                  North West Drupal User group on the 8th of March 

                  - On Tuesday we fixed a unit test which turned out to be a larger issue than I expected and uncovered a big code smell which I need to fix in the coming evenings.  

                  - I did a YouTube, Twitter and Discord poll about stopping the music whilst live coding.  I will leave the poll going until the end of the week but so far it looks like you lot prefer silence when I code.

                  The stages of bug fixing 

                  1. Investigation and discovery
                  2. Testing and verification
                  3. Fixing
                  4. Testing and verification
                  5. Deployment
                  6. Watch the show on YouTube

                    Contact me and let me know your thoughts or get something read out on air.

                    My web development courses

                    ➡️ Learn How to build a JavaScript Tip Calculator 

                    ➡️ Learn JavaScript arrays

                    ➡️ Learn PHP arrays

                    ➡️ Learn Python

                    ✉️ Get my weekly newsletter

                    ⏰ My current live coding schedule (Times are BST)

                    Thursdays 20:00 = Live Podcast YouTube

                    Sundays 14:30 - Live coding on Twitch

                    49 min
                  7. 146 - What makes an acceptable bug ticket

                    Change log 

                    • We got to lesson 4 of the PHP course on Tuesday.  Lots of bad documentation has been fixed
                    • Working on a Jenkins server for HTCW as I want to move away from GitHub Actions 
                    • We’re getting another English Springer Spaniel called Goose in a few weeks time.  He will only be a puppy 
                    • I am giving a new talk called coding with confidence using PHPStan at PHP South West next Wednesday. 
                    • What makes an acceptable bug ticket 

                      • Bugs are not equal and no bug should be treated equally.  Therefore no ticket is equal nor should the ticket be created or processed equally.     
                      • Bugs come in various shapes and sizes.
                      • There is a fine line between having too much or too little process     
                      • A ticket which requires over processing in its lifespan will slow down delivery of the fix.  This is due to the amount of red tape needed to record and fix the bug     
                      • A ticket which doesn’t require the right amount of process during its lifespan will slow down the project as the actors that influence or oversee the ticket may have insufficient information required. 

                      • Usually a bug is categorised by priority.     

                        • P1 is critical    
                        • P2 is less so and so on     

                        • We are skirting around the ITIL  change management process    

                          • An incident is not the same as bug or an issue         
                          • An incident is an unplanned interruption. An incident could be a bug after investigation        
                          • A bug is a fault in the system found by a tester and accepted by the developer         
                          • A issue is a business question that could needs to be addressed. The app doesn’t work on X but should it?    
                          • I have not done ITIL (Information Technology Infrastructure Library) training so please don’t see me as an authority on change management or IT service management disciplines. 

                            In my opinion the the minimum a that a bug ticket should have are:     

                            • A heading that quickly summaries the bug     
                            • Clear and concise steps to reproduce the bug     
                            • Clear requirements and environmental setup     
                            • Clear acceptance criteria (A definition of the correct behaviour)     
                            • Clear priority and the priority definitions     
                            • Clear understand of the bug impact  

                            • 43 min
                            • 145 - 5 Things you should not do in Software Development

                              Change log 

                              - New personal site peterfisher.me.uk 

                              - New job 

                              - Speaking at Symfony user group in Portugal - Code with Confidence with PHPStan 

                              - Won’t be streaming on Twitch this weekend as I’m traveling  

                              5 Things you should not do in Software Development

                              1. Don’t rush     

                              • Re-read the problem more than once. 
                              • If it doesn’t make sense to you then re-write the problem in your own words and get it checked     
                              • Ask questions if you don’t understand     
                              • The first solution might not be the best     
                              •  Break down the problem into smaller problems but try not over abstract 
                              • 2. Don’t panic     

                                • Bugs can be solved     
                                • A computer only does what it is told to do     
                                • Others have come before you and others will replace you     
                                • If you can’t think of the solution then walk away but always come back     
                                • Software development is huge so take your time 
                                • 3. Don’t worry     

                                  • We all make mistakes. As long as you learn from them then you are improving     
                                  • Keep away from the trends and focus on what you are having fun with     
                                  • We all learn at different speeds and different levels.      
                                  • At the start, don’t worry about how long you take     
                                  • You don’t need to learn everything - you can’t 
                                  • 4. Don’t over do it     

                                    • Learn to pump the breaks if you are reaching burnout     
                                    • Holidays are holidays.  Hands off the code     
                                    • Learn how to identify burn out     
                                    • Keep doing other things you enjoy outside coding     
                                    • Socialise with other coders out side of work 
                                    • 5. Don’t over think it     

                                      • Over abstracting a solution is a very big and common mistake     
                                      • Its just syntax, just written in a different order     
                                      • Learn the basics first before jumping into the deep end     
                                      • You can learn by listening, watching, coding, and reading     
                                      • Keep a log of what you’ve learnt and look back at your progression
                                      • Watch the show on YouTube

                                        Contact me and let me know your thoughts or get something read out on air.

                                        My web development courses

                                        ➡️ Learn How to build a JavaScript Tip Calculator 

                                        ➡️ Learn JavaScript arrays

                                        ➡️ Learn PHP arrays

                                        ➡️ Learn Python

                                        ✉️ Get my weekly newsletter

                                        ⏰ My current live coding schedule (Times are BST)

                                        Thursdays 20:00 = Live Podcast YouTube

                                        Sundays 14:30 - Live coding on Twitch

                                        46 min
                                      • 144 - 5 Build tools every Software Developer needs to learn

                                        Today I am going to talk about 5 build tools that every software needs to learn.

                                        These include the following:

                                        1. Step debugger
                                        2. Command Line Interface (CLI)
                                        3. Integrated development environment (IDE)
                                        4. Output tools such as Postman
                                        5. Project management tools
                                        6. Watch the show on YouTube

                                          Contact me and let me know your thoughts or get something read out on air.

                                          My web development courses

                                          ➡️ Learn How to build a JavaScript Tip Calculator 

                                          ➡️ Learn JavaScript arrays

                                          ➡️ Learn PHP arrays

                                          ➡️ Learn Python

                                          ✉️ Get my weekly newsletter

                                          ⏰ My current live coding schedule (Times are BST)

                                          Thursdays 20:00 = Live Podcast YouTube

                                          Sundays 14:30 - Live coding on Twitch

                                          41 min
                                        7. 142 - 6 Ways to improve your code tests

                                          Change log:

                                          • All the code notes for Docker for beginners course has been written. This is available on GitHub
                                          • I’ve started work on transcribing that course. This will take a long time.
                                          • I’ve fixed issues on howtocodewell.net regarding signup, forgotten password and other minor fixes
                                          • I’ve added the functionality to lock and unlock courses. This will turn them into private or public courses that require enrolment
                                          • 6 ways to improve your testing

                                            1) Automate as much as you can

                                            • Use CI pipelines
                                            • Run these locally even if your’e not committing any changes
                                            • Include other code auditing tools such as phpstan or phpmd
                                            • 2) Statics are evil

                                              • There is no way to test a static method that calls another static method
                                              • 3) Having many mocks is an indication of bad code design

                                                4) Use tests to help refactor you code

                                                • If a unit of work cannot be easily tested then it usually means the code is not designed well
                                                • Break up your tests into smaller chunks
                                                • Tests can highlight micro and minor refactors
                                                • Refactor your code and then re test
                                                • Try and do this in a TDD fashion
                                                • 5) Avoid flaky tests

                                                  • Clean up state
                                                  • Check for bottle necks which could cause timeouts
                                                  • Mock external services or dependancies
                                                  • Look into potential memory leaks
                                                  • 6) Re think what testing means to you

                                                    • Testing is a contractual agreement between the programmer and the code
                                                    • Testing is documentation - Gherkin, Acceptance Criteria, Business requirements
                                                    • Testing is boundary setting which helps with focus
                                                    • Testing is future proofing
                                                    • Watch the show on YouTube

                                                      Contact me and let me know your thoughts or get something read out on air.

                                                      My web development courses

                                                      ➡️ Learn How to build a JavaScript Tip Calculator 

                                                      ➡️ Learn JavaScript arrays

                                                      ➡️ Learn PHP arrays

                                                      ➡️ Learn Python

                                                      ✉️ Get my weekly newsletter

                                                      ⏰ My current live coding schedule (Times are BST)

                                                      Thursdays 20:00 = Live Podcast YouTube

                                                      Sundays 14:30 - Live coding on Twitch

                                                      40 min
                                                    • 142 - 5 Ways to improve your business logic

                                                      Business logic isn't just for businesses in the money making sense.   

                                                      Business logic encapsulates entities and the business rules or policies that solve real world problems.  Business logic is used to model entities that relate to business objects. For example your application may require orders, order items, payments, customers and the addresses.  

                                                      5 ways to improve Business logic  

                                                      1. Keep it portable 
                                                      2. Keep it out of view logic 
                                                      3. Small isolated rules 
                                                      4. Avoid large recalculations of data 
                                                      5. Don't over abstract
                                                      6. Watch the show on YouTube

                                                        Contact me and let me know your thoughts or get something read out on air.

                                                        My web development courses

                                                        ➡️ Learn How to build a JavaScript Tip Calculator 

                                                        ➡️ Learn JavaScript arrays

                                                        ➡️ Learn PHP arrays

                                                        ➡️ Learn Python

                                                        ✉️ Get my weekly newsletter

                                                        ⏰ My current live coding schedule (Times are BST)

                                                        Thursdays 20:00 = Live Podcast YouTube

                                                        Sundays 14:30 - Live coding on Twitch

                                                        36 min
                                                      7. 141 - Web Development Guide for 2022

                                                        Web Development Guide for 2022

                                                        • Web assembly won’t replace JavaScript.
                                                        • TypeScript won’t replace JavaScript.
                                                        • GitHub actions won’t replace you.
                                                        • Next.JS won’t replace PHP.
                                                        • PHP won’t replace Python.
                                                        • AWS will continue to build more stuff that you don’t need but will be require you to use it for unrelated but coupled tasks.
                                                        • Google Cloud will keep playing catchup.
                                                        • Docker will continue to be the containerisation tool of choice.
                                                        • Podman will not replace Docker.
                                                        • Microsoft will sell developer focused laptops. Dell has done this but Microsoft could bundle the laptops with pre installed developer software tools.
                                                        • Microsoft will attempt to by a Linux laptop manufacturer.
                                                        • Kubernetes will continue to dominate the cloud.
                                                        • Web 3 will not replace web 2.
                                                        • Web services that offer subscriptions will introduce their own block chains and wallets.
                                                        • A games manufacturer will release their own wallet and coins/tokens which can be exchanged for in game purchases or game expansions.
                                                        • Open source could be funded by crypto.
                                                        • A Spotify like company that focuses solely on podcasts could pay artists/creators based on the number of listeners or listen time. This could be done via the blockchain.
                                                        • We will see more JavaScript frameworks with "meta" and "web 3" buzzwords their titles.
                                                        • More NPM hacks.
                                                        • More developers will try and downsize their dependancies using micro frameworks.
                                                        • GraphQL won’t replace REST.
                                                        • NoSQL won’t replace relational databases.
                                                        • Job requirements will start to require experience with the blockchain and dapps.
                                                        • Serverless won’t replace servers but serverless technology will become more popular and it will be a sought after skill.
                                                        • CI/CD will become the norm.
                                                        • In the next Covid lockdown or the next set of restrictions, the job market will be better then it was during the first lockdown
                                                        • Remote working will become the default for all levels of developer.
                                                        • VR will improve but we won’t need to put a helmet on to go to a meeting.
                                                        • FaceBook or Twitter will start selling promoted adverts with crypto currencies.
                                                        • API’s will still be king.
                                                        • Headless CMS’s will become more popular.
                                                        • Let me know your thoughts or get something read out on air.

                                                          My web development courses

                                                          ➡️ Learn How to build a JavaScript Tip Calculator 

                                                          ➡️ Learn JavaScript arrays

                                                          ➡️ Learn PHP arrays

                                                          ➡️ Learn Python

                                                          ✉️ Get my weekly newsletter

                                                          ⏰ My current live coding schedule (Times are BST)

                                                          Thursdays 20:00 = Live Podcast YouTube

                                                          Sundays 14:30 - Live coding on Twitch

                                                          59 min
                                                        • 140 - Code Iteration time is critical to web development success

                                                          Change log

                                                          • We’ve almost finished the first pass of the documentation for the new PHP course. I have 1 / 2 lessons to go. There are two more passes that I want to do before recording any of the lessons. The next pass will be to create the project from start to finish using the documentation but on a Ubuntu VM. The last pass will be to do the same bu on a Windows VM
                                                          • Last weeks show that was on shopping carts went live earlier this week. I had some internet issues last week so I couldn’t do the live stream
                                                          • Your feedback

                                                            1) Eric writes in on my hack to check if PHP is working YT short and asks if the next video will be on the PHP 8 match expression and when to use it.

                                                            I can’t promise that it will be the next YT short but I can say that It is on the schedule.

                                                            2) Keral writes in on my PHP array sum tutorial and asks how do we sum fields in a database.


                                                            There is a SUM function in MySQL. It takes one argument and that is the expression that you want to calculate. You can use it to find the sum of a field from several records by suppling the field name as the expression. Then add the reset of the query as usual.

                                                            For example, To get the sum of a shopping basket you could do something like this; Let’s say you had a table of order items with a foreign key linking to an orders table. Each order item record would also have a price field. You could get the sum of the orders price like so: select sum(order_item.price) from order_item where order_item.order_id = 4; Obviously change the table name of order to something else as order is a reserved keyword in MySQL.

                                                            If you have a comment that you want read out on the show then either write a message on a YouTube video or send me a message on our contact form.

                                                            Code Iteration time is critical to web development success

                                                            I want to talk about a blog posted titled 3 lines of code shouldn’t take all day https://devtails.xyz/3-lines-of-code-shouldnt-take-all-day by Adam Berg. In the post Adam talks about his time developing video games at Electronic Arts. He mentions that due to the testing tools and development requirements it could take up to a day to write 3 lines of code. This iteration time was greatly reduced when he used 'test beds'. 

                                                            Adam mentions in his article that the test beds focused on particular areas of code which meant the tooling was slimmed down. This allowed him to laser in to the code that needed to be tested and as a result made the code iteration far quicker.

                                                            He goes on in the post to talk about using unit testing which also made his life a lot easier. These test packages only contained the code which was specific to his teams requirements. Again, this was a slimmed down portion of a game.

                                                            He mentions that these test packages took less than a second to compile and run. This made him less distracted and he could focus on the task at hand.


                                                            34 min
                                                          • 139 - Shopping carts are hard

                                                            Changelog

                                                            • No live stream tonight, My internet has been super patchy today so I’m not even going to try.
                                                            • Unfortunately no PHP 8 short this week. It has been recorded, I just haven’t had the chance to upload and do the thumbnail yet.
                                                            • We documented the 7th lesson of the new PHP course. This included some TDD, some array nesting and some PHP 8 array shapes
                                                            • Shopping carts are hard

                                                              A shopping cart needs to be frictional-less to the end user (Customer). The quicker a customer can purchase a product the better.

                                                              There are many questions that need to be answered when designing the user flow of a shopping cart

                                                              These are just some things to think about:

                                                              Shipping

                                                              • Will you be shipping a physical good and if so will the shipping cost be dependent on user location?
                                                              • Will shipping be based on the item(s) weight?
                                                              • Will shipping be discounted in certain regions?
                                                              • Will you require shipping information to make a payment (Security checks)?
                                                              • Will there be discounted shipping based on quantity?
                                                              • Will there be a quantity limit based on different regions?
                                                              • Currency

                                                                • What currency will you be offering?
                                                                • What is the conversion rate?
                                                                • How will you track that?
                                                                • What are the tax implications for you versus the customer?
                                                                • How are you going to calculate tax?
                                                                • Users

                                                                  • Will you require an actual user to login before and order is created?
                                                                  • Can someone make a guest account?
                                                                  • Will there be teams or individual accounts?
                                                                  • Will you require the customer to be verified before making a purchase. Some places like Stripe require a user email address?
                                                                  • Product

                                                                    • Is it a digital good?
                                                                    • Will there be stock?
                                                                    • How will the stock be recorded/monitored?
                                                                    • How will an out of stock product be displayed?
                                                                    • Can products be bundled?
                                                                    • Do bundled products get a discount?
                                                                    • How are products removed from the cart?
                                                                    • How are products updated on the cart?
                                                                    • How are quantities updated on the cart?
                                                                    • Checkout

                                                                      • What happens when a logged out user access the checkout page?
                                                                      • What happens to abandoned carts?
                                                                      • What defines an abandoned cart?
                                                                      • At what point does the cart get created in the database?
                                                                      • At what point does the cart get associated with the user?
                                                                      • Other items to consider

                                                                        • Refunds
                                                                        • Subscriptions
                                                                        • Cancelations
                                                                        • 28 min

                                                                        About How To Code Well

                                                                        From the publisher's feed

                                                                        Web development discussions and interviews from Peter Fisher. Covering JavaScript, Linux, Docker, PHP, Python, MYSQL, HTML and more