DEV Community

Cover image for Developing an Expense Tracking App: A Case Study of Pocket Planner
David Njoroge
David Njoroge

Posted on

Developing an Expense Tracking App: A Case Study of Pocket Planner

Introduction

Managing personal finances is a crucial skill in today’s fast-paced world, where tracking expenses and income efficiently can lead to better financial decisions. With this goal in mind, I set out to develop Pocket Planner, a user-friendly mobile application that helps individuals keep their personal finances organized. This blog explores the journey of creating Pocket Planner, a feature-rich expense tracking app. We'll discuss the development process, challenges faced, and key takeaways.

You can visit the official website of Pocket Planner to learn more about the app, check out the GitHub repository, or download the app for Android.


Project Overview

Pocket Planner is designed to be more than just a simple expense tracker. It offers a robust and intuitive solution for logging expenses, tracking income, setting monthly budgets, and visualizing financial data. Built with Kotlin Multiplatform, Pocket Planner runs seamlessly on both Android and iOS platforms. The app allows users to maintain complete control over their finances, even offline.

Key Features of Pocket Planner:

  • Expense and Income Tracking: Record daily expenses and log sources of income effortlessly.
  • Monthly Budgets: Set up a monthly budget to stay on track.
  • Interactive Data Visualization: View spending trends and income patterns through engaging charts.
  • Offline Functionality: Manage finances without an active internet connection.
  • Cross-Platform Availability: Works on both Android and iOS devices.

App Architecture

Pocket Planner was developed using a modular architecture and followed the Clean Architecture principles to ensure maintainability and scalability. The app implements the Model-View-Intent (MVI) pattern to create a reactive and predictable user interface.

Modular Architecture Breakdown:

  1. Presentation Module: Contains UI-related components such as navigation, screens, and view models.
  2. Navigation Module: Handles app navigation and dependency injection.
  3. Theme Module: Manages colors, shapes, dimensions, and typography to ensure a consistent design across the app.
  4. Core Module: Contains utility functions and network handling.
  5. Data Module: Handles database operations using SQLDelight and provides access to repositories.
  6. Domain Module: Contains business logic, models, and use cases for expenses and income.
  7. Components Module: Houses reusable UI components like buttons, alert dialogs, and charts.
  8. Test Module: Provides comprehensive unit tests for various app components and use cases.

The app's modular architecture not only ensures separation of concerns but also improves maintainability and scalability.


Technologies Used

During development, I utilized several cutting-edge technologies to ensure performance, scalability, and cross-platform compatibility. Here’s a breakdown:

  • Kotlin Multiplatform: Enabled development for both Android and iOS using a shared codebase.
  • SQLDelight: Managed database interactions in a type-safe manner, ensuring consistent data access and offline functionality.
  • Orbit Core (MVI): Used to implement the MVI pattern for reactive UI management.
  • Koin: A lightweight dependency injection framework.
  • Kotlinx Coroutines: Handled asynchronous tasks, ensuring smooth operation and user experience.
  • GitHub Actions: Automated continuous integration (CI), including running unit tests and enforcing coding standards.
  • Kotlinm-Charts: Provided a variety of charts for visualizing financial data in a user-friendly format.

Development Process

The Pocket Planner app was developed using the Agile software development methodology, which emphasizes iterative development, collaboration, and adaptability. Throughout the project, the team worked in sprints, with each sprint focusing on delivering specific features or improvements.

The Agile process allowed for continuous feedback from stakeholders and users, helping us to prioritize tasks based on real user needs and product goals. This iterative approach ensured that each phase—whether designing UI/UX, implementing new features, or testing functionality—was subject to ongoing review and enhancement.

Sprint Phases in the Agile Process:

  • Sprint 1: Core functionality and initial UI design. The focus was on setting up the basic project architecture, user authentication, and navigation.
  • Sprint 2: Budget and expense management, enabling the app to track expenses and log incomes.
  • Sprint 3: Integration of financial charts and data visualization using Kotlinm-Charts, ensuring the user could view their financial data interactively.
  • Sprint 4: Offline functionality and performance optimization. Focused on database synchronization using SQLDelight.
  • Sprint 5: Testing and deployment, refining features based on feedback from testers and preparing the app for production.

At the end of each sprint, we conducted sprint reviews, retrospectives, and adjusted priorities for the next cycle. This iterative process ensured we could adapt to changing requirements, provide incremental value to users, and maintain transparency in the development timeline.


Algorithms and Data Structures Used

During the development of Pocket Planner, I leveraged several key algorithms and data structures to optimize performance and ensure the app could handle large datasets and complex operations efficiently.

Algorithms:

  • Budget Allocation Algorithm: This algorithm dynamically calculates a user’s remaining budget by subtracting expenses from the total budget. It supports custom budgets per category and alerts users when they exceed their allocated budget. The algorithm optimizes performance by using caching techniques to minimize redundant recalculations.
  • Sorting Algorithms: Used primarily for sorting expense records, both by date and amount, ensuring users can view transactions in the order that suits them best.
  • Search Algorithm: Implemented a binary search to allow fast filtering and retrieval of specific financial transactions. The algorithm supports searches by category, date, and amount, ensuring swift access to the data users are most interested in.

Data Structures:

  • HashMap: Used extensively for storing category-based expense data, allowing for quick lookups and updates of expense records associated with a specific category.
  • ArrayList: Employed for maintaining ordered lists of expenses and incomes, ensuring smooth iteration and manipulation of financial data.
  • Graph Data Structure (For Charts): Leveraged to represent the user’s financial data in a graphical format, enabling smooth rendering of charts in the UI.
  • Queue: Used in asynchronous task management to ensure that background operations like data sync and caching are performed in a first-in, first-out (FIFO) manner.

By choosing the right algorithms and data structures, I was able to optimize the performance of Pocket Planner, allowing the app to handle large amounts of data smoothly and provide real-time updates to users.


Software Development Phases

As a Software Engineer, I approached the development of Pocket Planner not just as a software developer but with a focus on system design, scalability, and maintainability—skills crucial for building complex applications.

1. Requirement Gathering:

This phase involved identifying the key features the app needed to address user pain points. I conducted extensive user research, surveys, and competitor analysis to understand what users expected from a personal finance application. The main requirements included tracking expenses, logging income, setting budgets, and visualizing financial data.

2. System Design & Architecture:

After gathering the requirements, I designed the system architecture using Clean Architecture principles to ensure maintainability and scalability. The app was built with a multi-module structure, each module handling different responsibilities such as data management, UI rendering, and business logic. By implementing a modular architecture, I ensured that features could be easily extended or modified without affecting other parts of the app.

3. UI/UX Design:

Collaborating with a design team, I contributed to creating an intuitive, user-friendly UI that aligns with modern design standards. Using Jetpack Compose, the app’s UI components were designed to be responsive, customizable, and capable of handling diverse screen sizes across Android and iOS devices.

4. Development (Implementation):

The actual development was carried out in multiple sprints using Kotlin Multiplatform for cross-platform compatibility. The app followed the Model-View-Intent (MVI) pattern, ensuring predictable state management across UI and business logic layers. I implemented various features, including:

  • Expense tracking: Enabled users to record, edit, and categorize their expenses.
  • Income logging: Allowed users to record multiple sources of income.
  • Data visualization: Created interactive charts that let users explore their financial data.
  • Offline functionality: Using SQLDelight, the app stored financial data locally and synchronized it when the user came back online.

5. Testing:

Comprehensive testing was a critical part of the development process. I implemented unit tests for the core business logic and UI tests to verify the integrity of the app’s user interface. We used GitHub Actions for continuous integration, automatically running tests and ensuring code quality in every pull request.

Key testing areas:

  • Unit Testing: Validated the correctness of algorithms like budget calculation and data retrieval.
  • UI Testing: Ensured that the app worked seamlessly across different screen sizes and devices.
  • Performance Testing: Focused on ensuring the app could handle large datasets without lag or delay, especially when rendering charts and financial reports.

Challenges Faced

Developing Pocket Planner came with its own set of challenges:

  1. Cross-Platform Development: Integrating a single codebase for both Android and iOS was complex. I had to account for platform-specific features, which required extensive testing and debugging.
  2. State Management: Managing the app’s state using the MVI pattern posed challenges in synchronizing UI states across various components and ensuring reactive flows.
  3. Database Synchronization: Implementing SQLDelight for offline functionality required careful handling of data consistency and synchronization across platforms.
  4. UI Responsiveness: Ensuring that the charts and visualizations were responsive across various screen sizes and handled large datasets smoothly was a key challenge.

Key Takeaways & Achievements

Despite the challenges, Pocket Planner achieved several significant milestones:

  1. Successful Cross-Platform Integration: Pocket Planner works seamlessly on both Android and iOS, providing a unified experience.
  2. Comprehensive Testing: The use of unit tests, combined with GitHub Actions for continuous integration, ensured that the app remained stable and reliable throughout development.
  3. Offline Functionality: Achieved full offline functionality, enabling users to track expenses and income without needing an internet connection.
  4. Interactive Data Visualization: Developed user-friendly, interactive charts using Kotlinm-Charts, allowing users to visualize their financial data easily.
  5. Scalable and Maintainable Architecture: The use of a modular, Clean Architecture ensures the app can scale in the future, with potential for adding new features or supporting more platforms.

Conclusion

The development of Pocket Planner was a comprehensive process beyond just writing code. As a Software Engineer, I applied best practices in system design, architecture, and performance optimization to create a feature-rich, scalable, and maintainable app. Utilizing Agile principles ensured that user feedback shaped the app iteratively, while a strong focus on testing guaranteed its reliability and performance across platforms.

If you're interested in learning more or exploring the codebase, you can visit the app's dedicated website or check out the GitHub repository.

Download the app here.

To contact me you can visit my website or though linkedln


By sharing my experience in developing Pocket Planner, I hope to inspire other developers to take on similar projects and approach them with a solid architectural foundation and thoughtful technology choices.

Top comments (0)