Third party cookies may be stored when visiting this site. Please see the cookie information.

PenguinTutor YouTube Channel

Computer Science - Agile Programming

Agile programming is an iterative and incremental approach to software development. It prioritizes flexibility, collaboration, and rapid delivery of working software. Traditional software development (such as waterflow development) often followed a more rigid, linear plan with significant planning before starting development. Agile methodologies break down projects into small, manageable chunks called sprints or iterations, typically lasting 1-4 weeks. Each sprint involves cross-functional teams working together to design, develop, and test a specific set of features, allowing for continuous feedback and adaptation to changing requirements.

As most of my code is developed by myself rather than a team then I don't always follow the full agile methodology. I have however adopted many of the agile ideologies in my own code development. This includes taking a more practial approach to development rather than working out the full structure first.

Code Refactoring

One potential issue with agile programming is that there is a risk of creating code that can be difficult to follow or maintain. This is where refactoring comes in. Refactoring involves reviewing the code with the aim of improving its readability, making it easier to maintain and debug, and creating a more flexible codebase for future development. In my case I also needed to decouple the classes as that was creating confusing code. This is explained in the video below:

Refactoring is something that should be done fairly frequently. It's not the first time I've refactored the code on this project, but I really should have done this part earlier as I identified that the code was getting confusing a while ago.

Design Patterns

When refactoring the code I looked at how different design patterns may help to make the code cleaner. I implemented an Event Bus design pattern to simplify event passing, a singleton design pattern for the Device Model (or Domain Model), and reduced the passing of the GUI thread between the different classes.

This also uses QThreadPool for responsiveness and I used the Pyside Signals and Slots for passing data between the different threads and classes. The concept of threading is explained more in my previous article on Creating a responsive application with Python Pyside 6 and QThreadPool.

More information

More information about the Raspberry Pi Model Railway GUI application.

See my other programming guides at:

Blog links and videos on programming

Previous Beginners algorithm design
Beginners algorithm design
Next Introduction to API
Introduction to API