ionostafi.com

2024-09-30

The M25 project

I once read about how muscles tend to atrophy if they do nothing for a prolonged time, and that it's better to remind them that they need to keep in shape. Do physical activity every 30 minutes. The idea is that more than 30 minutes of doing nothing is enough for muscles to think they are not needed. Well, I am sure there are better medical explanations for this phenomenon. My job and probably yours too, requires sitting in front of a computer for many hours a day. If that's true, you need to focus and take breaks.

There is a time management technique named pomodoro - 25 minutes of work and five of break. I tried it several times. At the beginning it didn't work, so I dropped the idea. It doesn't feel right to stop my focused work when I hear the timer. Most of the time, I am in a deep focus state.

Another day, I hear the timer, I know that I need to take a break, but I am in the flow state. I contine my work with the music in my ears. After a few minutes, I forget I have to stop. It's only when the physical pain reminds me to move my back.

"Flow is the melting together of action and consciousness; the state of finding a balance between a skill and how challenging that task is. It requires a high level of concentration." (wikipedia).

A few years later, I tried a different approach—using a new "marker" to signal the end of my sessions. I wanted something that would allow me to finish my flow state, but still prompt me to take regular breaks, ideally around every 25 minutes. I believe the brain doesn’t operate in fixed time intervals. It seems to have its own natural rhythm and desire to work. I don’t want to interfere with that, but I also don’t want to let it run for too long. I want to give it time to "cool down."

I tried using a music-based timer. When the music stops, I start to notice background noise. In the office, it’s people talking, fans running. At home, it’s pure silence. After a few minutes, I slip out of the flow, and my brain realizes the music has stopped—Oh, I need to take a break. This can still go out of control, as I can go so deep into focus state that I am unable to hear anything even if there is a building crashing nearby. But that is unfixable by any timer or be even a person nearby yealing at me.

One day, I got tired of the same playlist. It didn’t work for long, so I found a simple Mac app—Pomodoro Timer—that does part of what I wanted. I still use the app today, and it works for me. I can get into that little moment of "Wait, the music stopped, time for a break." But there’s a piece missing from the puzzle, you know. A perfectly timed music session, synced with my work session—where the last song plays until the very end. Does that make sense? 🙂 Probably not, but it’s fun!

The engineer in me couldn’t resist thinking about a solution. Haha, I took this so seriously that I started searching for an algorithm to generate the perfect 25-minute playlist. I didn’t even realize that the problem I was trying to solve is an unsolved math problem—the subset sum problem (Wikipedia). What does the subset sum problem have to do with a playlist? From a playlist of N songs, you need to find a sub-playlist of M songs that adds up to exactly 25 minutes.

££\sum_1^n seconds(song(n)) = 1500££

Now, I’m developing my own iOS app to generate the perfect Pomodoro playlist for each session. But I can’t just throw something together—I have to craft it with a carefully designed architecture, putting all my knowledge into this piece of software. What’s the point of reading books like Software Architecture in Practice or Code Complete if it all just stays theoretical? I want to try even the wildest ideas I come across into practice and see how they work in the real world.

I named the app M25, which stands for Music for 25 Minutes. Alongside developing the app, I plan to document the entire development process—covering everything from choosing software design patterns and refactoring code to switching development tools. I’m considering creating a series of articles that showcase how to implement the Model-View-ViewModel (MVVM) architecture in iOS development, or explore other mobile app architectures. I’ll also demonstrate how to use design patterns like the observer pattern and others.

The goal is to show how to take a software project from zero to production, focusing on best practices for building clean, maintainable codebases. It’s not just about writing an app quickly, but about leveraging professional development techniques and architectural knowledge.

Continue reading about architecture of the project


tags: ios