Archive for the ‘tips and tricks’ Category

My Cloud Backup Approach

I have continously talked about my drive to never lose a file again, after I lost my first file to a failed floppy disk drive in 1996. The fanatical backup approach has been used to work as follows:

  1. Create a new version of whatever I am working on everyday – for files add the date, for web application development (create a new folder)
  2. For development create a separate folder for staging and production files adding to them as needed
  3. For files whenever I am to make a significant change I create a version too, even if it is for the same day so that I can track when I made made major pivots
  4. Backup to a shared magnetic backup drive (before 2010)
  5. Move backups to a cold storage hard drive which is only used for that purpose

Overall I used to end up with 3 different copies of any file over time, and storage is cheap so duplication was not an issue.

The cloud came and all I had to do was adapt my workflow as the primary, secondary and cold storage are all cloud based

  1. Primary work
    • Dropbox and Google for personal use, these are fast syncing for regular use. I have 13GB in Dropbox gained from various offers at the time of launch, and have a 200GB Google One subscription (the 2TB next package does not add value due to being higher for unused space)
    • Box – for ofice use
  2. Primary Backup – this is Google Drive, with a 200GB Google One subscription where I place archived projects, home photos and miscellaneous files that I need to maintain
  3. Cold Storage – Apple iCloud 50GB where I zip files that I do not expect to use for a long time

What I have learnt:

  1. I work directly in the cloud service folders, therefore do not need to remember to backup or synchronize the files
  2. All cloud services are set to automatically startup on machine reboot so are always active
  3. The primary cloud service you use depends on what you are comfortable with
  4. Most cloud service providers charge about $20 per year for 200GB then $99 per year for 2TB, I found the price jump not justifiable hence the move to iCloud for my cold storage
  5. The power and Internet services in Uganda are not very stable and consistent so the option for a NAS

What’s your approach to backups, what tips and tricks have you learnt along your journey?

Life and Tech – Choices, Decisions and Options

A couple of weeks ago Friday, I shared lessons from my life in technology with a team of upcoming software developers, Life in the Tech Lane, and I got a number of follow-up questions like the one below. On reading the questions, it spurred this post as the responses needed to be long form

For that matter I got a number of questions that I would like you to address that I couldn’t easily ask yesterday. These are the questions that I have:

How did you know that software delivery is your thing, amongst all the various options?

My first taste of technology related work was in my S.6 vacation at an email service firm where I helped develop UNIX training materials, setup & troubleshoot modems for email services, and my initial foray into server scripting. I worked on this through my undergraduate course, even when I worked in a civil engineering consultancy it was all software related work. I was hooked, to the problem solving, creation of digital solutions & learning that came along with the work, making my life very interesting.

Over time, I have embraced the challenges of having to develop solutions quickly, train users, support them as products evolve, which has kept me in the line of work.

I also tried management, and found out it was not for me thus came back in the trenches. However I come with a lot more value, I understand the needs of executives in a sector, can put myself in the eyes/place of a user and have a good handle on technology.

Overall it seems like software delievery chose me, I am still engaged 20+ years later, and see a future as an older software developer/engineer by evolving myself and skillsets to maintain relevance

 Why PHP and not the other languages, I mean there is a number of new technologies and spaces being created everyday, why stick to the”old” one PHP?

I started programming in UNIX shell scripting, Turbo Pascal, Visual Basic 6 and Visual Basic for Applications (for Excel), Java 1.1 & 1.2. At the time of Java we were building enterprise web applications, however deployment was a challenge which was how one of the clients introduced us to PHP.

This is a language made for the web, with lots of libraries through PHP Classes, Stack Overflow and other sites. The frameworks, Symfony, Code Igniter, Yii simplified the process of building and maintaining custom web applications. Addoitional solutions, such as CMSes (Joomla, Xoops, WordPress) were the foundation for website development.

I used PHP for over a decade, during which I became familar with the language, quirks (that were reduced in versions 5.6 and the 7.x series), thus it became a familiar tool which I can keep using within the space for my current and future work.

I have also learnt and used Python, Ruby on Rails, Java 8 (which I use in my day job), however I find the PHP language my tool of choice to provide technology solutions as it aligns with how I solve problems. This has been made easier with the Laravel framework, which provides a great eco-system with alot of existing tools & solutions, so I can focus on business problems rather than tech and tooling.

What advice would you give me as a young profession who is in the early days of formal employment in the tech industry. I have a challenge about my career path or direction. I want and I feel more joy when doing data science/analytics work but I have failed to get the opportunity of pursuing that space and it’s for that reason that I have taken on the software development path as these are the opportunities that have been available, it’s not that I don’t enjoy it, I do but my utmost passion is data science. What advice would you give me regarding that?

  1. The best way to predict the future is to create it. A future in technology is easier to create leveraging opensource tools and technologies – thus if you want to do data science, I would suggest picking a problem you are passionate about and spend your personal development time growing it, working on it, writing about it (you need to share your lessons and paths) so that you keep growing
  2. Find opportunities within your current employer for the data science/analytics work – if opportunities do not exist, create them by talking to your colleagues, taking part in meetings/discussions or even starting the discussions on leveraging data science/analytics within your organization
  3. Take time to get better at the role you are hired to do, as that can provide the basis to growth and opportunites being taken on you
  4. Join local meetups and activities around data science/analytics to grow your network
  5. Take courses on your chosen path to ensure you are ready to take up any opportunities that come up
  6. Be persistent in finding opportunities along your chosen, do not give up it may take longer than expected

The Case of a Platform Rebuild from Laravel

This post is a discussion with a colleague who reached out to me requesting for advice on whether to rebuild their successful e-commerce platform whose usage has grown exponentially over the last 18 months.

Advice on Platform Rebuild
Laravel is not Enterprise Ready

My first piece was 90% of platform rebuilds and re-architectures fail, especially since there are always unseen constraints in the new tooling that slows down the process. My approach is always to advice to squeeze as much as you can from your existing framework, language and platform before starting to look elsewhere

While this post is Laravel – specific, the ideas are applicable to any framework, programming language or even mix of technologies

As a Laravel developer who is passionate about architecture and solving scaling challenges, this is a series of questions to drive decision making

  1. Are you on the latest PHP 8.1 and Laravel 9?
    • Uprading to the latest version of PHP and Laravel pulls in the latest performance improvements in the language stack
    • This also applies to the webserver Apache/Nginx
    • Is your database the latest applicable version
    • Server hardware
      • CPU latest generation of processors for the configuration
      • OS patches – remove unused and unneeded services
      • SSD disks for IO bound performance
      • RAM – the more the better
    • Network configuration – unnecessary round trips from the application to the database (see below too)
  2. Is your database and application well tuned? Indexes, reducing the size of requests and number of queries
    • Application tuning is an art that can be taught – for a database heavy application like this case the Eloquent Performance Patterns by is a key resource (https://eloquent-course.reinink.ca/)
    • This also involves removing unused plugins and libraries, and leveraging the framework best practices – Larvel Beyond Crud (https://spatie.be/products/laravel-beyond-crud) and Frontline PHP (https://spatie.be/products/front-line-php) from the team at Spatie are excellent primers
    • The memory usage per request can easily be shown by the Laravel Debug Bar (https://github.com/barryvdh/laravel-debugbar) during development
    • Checking the size of requests and responses may improve performance – send as little data as required for the operation, paginate in the database not the application
    • Add indexes to improve table joins, redesign tables for needs, separate data collection & reporting (denormalization may be needed here)
    • Use Specific API requests for cases where generic default CRUD ones do not perform well
    • Is all that Javascript necessary in the application pages?
    • Is all that that CSS necessary in the application pages?
    • Is the database tuned for the hardware that it is running on?
  3. Are you using the framework tools like queues to offload processing into asynchronous operations via queues
    • At times performance issues may be experienced by users especially in e-commerce setups where actions that can be asynchronous are added into a synchronous workflow slowing down responses to end users e.g., sending a confirmation email (adds 2-5 seconds to the order response) can be done after so the ordering process completes faster for the customer
    • For faster throughput using extensions like Octane can provide the necessary performance boost
    • Tweaking the web server Apache/Nginx to handle more users
    • Load balancing across more than one webserver can provide quick wins
  4. Increasing your database resources – bigger server, tuning the MySQL
    • Computing power is cheap thus a beefier server or more RAM may do the trick depending on whether the deadlocks are CPU/Disk or memory bound
    • If a beefier server does not help, probably load balancing across multiple smaller servers even for stateful vs stateless requests could improve performance
  5. Concurrency using Laravel Vapor and Octane?
    • Vapor is a paid service to bring serverless to the Laravel applications
    • Octane increases the concurrency of request handling though application changes may be needed to cater for the constraints Octane places
  6. Are you profiling your application with tools like Blackfire or Sentry to find performance deadlocks?
    • The performance improvement approach is measure, find the bottleneck, tweak to improve, then rinse and repeat
    • Are there errors or failures that are causing the application to slow down
  7. Have you refactored and cleaned up your data model to match the current reality?
    • As applications evolve there is a need to remove old code, data columns to suit the new reality
    • Refactoring code to match reality removes any unncessary baggage that is carried along
  8. Is your architecture the simplest that it can be – https://future.a16z.com/software-development-building-for-99-developers/ as your organization may not need the complexity of a Fortune 500 or FAANG
  9. There are hidden gems which can also be leveraged to improve your architecture & unearth performance issues
    • Test Driven Development – even if tests are written after the code, unit testing complex algorithms while carrying out end-to-end workflows of critical user paths
    • Design for failure – especially for external services
    • CI/CD – automate deployments to get new features, bug fixes and enhancements into production as fast as possible
    • Setup staging sandboxes to test out ideas and tweaks
    • Monitor your production application service health – Laravel Health (https://spatie.be/docs/laravel-health/v1/introduction) provides an excellent starting poing

When all else fails and a platform rebuild is necessary the Strangler Fig Pattern is a great way forward – replace different parts of the application as needed replacing them with newer architectural pieces referred Legacy Application Strangulation : Case Studies (https://paulhammant.com/2013/07/14/legacy-application-strangulation-case-studies/)and Strangler Fig Application (https://martinfowler.com/bliki/StranglerFigApplication.html)

What are you thoughts and suggestions? What has worked for you and what pit falls did you find? Any additional advice?

Geek Tools – My Keyboard Journey

As a software engineer my days and nights are driven by the need to type instructions for a computer to execute into text files. Thus the keyboard is my primary tool for this input.

My primary workhorse over the last couple of years has been a MacBook Pro laptop and now majority of the time, I use it in clam shell (closed) with an external monitor and mouse. An external keyboard is critical in this mode, so sharing my journey over time

Regular Computer Keyboards

I started with the DELL Keyboard and it just works when you need it

Apple Keyboards

I purchased the full wired keyboard and the Magic Keyboard 2 – these are excellent low profile keyboards for use anywhere and I would totally recommend them. The full wired keyboard is best for a fixed location, while the Magic Keyboard is a lightweight travel friendly keyboard with great battery life, can be used during charge and the key responses are excellent, though I find it a little low and hard on my hands

Logitech MX Keys

I started out with the MX Keys and later got the MX mini (as the full keyboard would not fit on my standing desk with the mouse), and I should say these are awesome keyboards. They are so alike, one just having a numeric keypad while the other does not. The build quality is excellent, feel bulkier and more solid the Apple keyboards, love the 3 computer switch capabilities by just pressing a key, and the travel is just right (like Golidilock’s porridge). They are priced similar to the Apple keyboards, but IMO they provide more value

Mechanical Keyboards

I have had the chance to try out the Keychron K6, and I love them – more travel than the MX Keys but love the RGB backlighting, and the tactile feedback. I am currently in search for a low profile mechanical to try out, with an eye on the Keychron K3, as I await feedback

Split Keyboards – The Bucket List

These I have on my bucket list with https://ultimatehackingkeyboard.com/ leading the pack – will see if 2022 gives me the opportunity to try this type of keyboards out

What is working for you, do share your experiences and ideas, I am a work in progress and continously experimenting to find those tools that make me happy

My Code Review Workflow

My role involves reviewing code written by different members of my team, which is an important process in the software delivery lifecycle. In certain cases, code reviews turn into gatekeeping which does not deliver the intended value for the process

The reason for code reviews

  1. Get a shared understanding of the code submitted – an opportunity to share, learn and collaborate
  2. Find opportunities to improve the code and what it is doing – refactoring
  3. Find edge cases that may not have been covered
  4. Verify that the code does what is expected

I just thought I would share my PR review approach and I hope it may help others here

  1. Read through the code changes across the files in the GitHub/GiLab or version control UI – this helps me get a sense of files which should not be there, too many files, too few files etc
  2. Pull the PR locally on my machine – Jetbrains IDEs and VS Code have pull request views and functionality if you are not a cli guru like yours truly
  3. Run the code and test the features as documented both happy path and some random abrupt paths

The improvements we are going to add to our projects (still looking for ideas here)

  1. Automated code checking for formatting and linting

I tend to use Firefox developer edition (set to always start in private mode) for web stuff to view it in a clean browser. Chrome is the new Internet Explorer 6 (the most painful growth phase of the web)

What is your code review workflow, what tips and tricks have you used to make it smoother and more streamlined?

UPDATE 1: November 4, 2021 – excellent reference on by Chelsea Troy https://chelseatroy.com/2019/12/18/reviewing-pull-requests/

%d bloggers like this: