Manny DaSilva | Computer Science ePortfolio

Security+ Certified Software Engineer at Arcfield | Computer Science Graduate from Southern New Hampshire University | Master's Student in Artificial Intelligence | Focused on secure, scalable, high-performance software development.

View on GitHub

Enhancement 2 – Algorithms and Data Structures

Overview

The artifact selected for this enhancement is PowerScale, an Android weight-tracking mobile application originally developed in CS 360 Mobile Architecture and Programming. The application was built using Java, XML, and SQLite and allows users to create accounts, log in, record weight entries, set a goal weight, and track their progress over time.

This artifact was selected because it provides a strong foundation for demonstrating algorithmic thinking and data structure usage in a real-world application. The system already stores weight entries as a time-series dataset using an ordered list, making it well suited for implementing analytical algorithms.



Enhancement Description

This enhancement introduced weight trend analysis by implementing a sliding window moving average algorithm along with trend direction detection.

In the original application, weight entries were stored and displayed but not analyzed. This enhancement transformed the data from a passive dataset into an active source of insight for the user.

A 7-day moving average was implemented using a single-pass sliding window algorithm, allowing efficient computation without recalculating sums repeatedly. In addition, trend direction logic was introduced to classify user progress as:

This functionality provides meaningful feedback to users based on their weight trends over time.


Key Improvements


Algorithm and Feature Screenshots

The following figures illustrate the design, implementation, and user-facing functionality of the algorithmic enhancements introduced in Enhancement 2. These include the system design, the moving average algorithm implementation, and the resulting trend analysis feature within the application.

Figure 5. Enhancement 2 design diagram illustrating the integration of the moving average algorithm and trend analysis workflow.


Figure 6. Sliding window moving average algorithm implementation used to efficiently compute weight trends with O(n) time complexity.


Figure 7. Trends screen displaying calculated moving average results and trend direction for user weight data.


Skills Demonstrated

This enhancement demonstrates:


Course Outcomes Alignment

Outcome 3

Design and evaluate computing solutions that solve a given problem using algorithmic principles and computer science practices while managing design trade-offs.

This enhancement demonstrates Outcome 3 by designing and implementing a moving average algorithm to analyze weight data. The decision to use a simple 7-day moving average instead of a more complex statistical model reflects a conscious trade-off between efficiency, usability, and complexity.


Outcome 4

Demonstrate an ability to use well-founded techniques, skills, and tools in computing practices to implement solutions that deliver value and accomplish industry-specific goals.

This enhancement applies well-founded algorithmic techniques to improve application functionality. By introducing efficient data processing and meaningful analytics, the application now delivers increased value to the user.


Challenges and Solutions

One of the main challenges during this enhancement was ensuring that the algorithm handled edge cases correctly. This included situations where there were fewer than seven weight entries or where data showed minimal fluctuations.

To address this, validation logic was implemented to prevent invalid calculations and ensure accurate trend results.

Another challenge was integrating the algorithm into the existing application flow without disrupting current functionality. This required aligning the computation with the data retrieval process and ensuring results updated consistently as new entries were added.

A specific issue occurred with LiveData updates, where trend results were not being reflected properly in the UI. This was due to improper observation of the data source. The issue was resolved by restructuring how LiveData was observed between the Repository, ViewModel, and UI layers, ensuring updates were triggered correctly.


Reflection

This enhancement strengthened my understanding of how algorithms and data structures can be applied to real application features. One of the most important lessons was learning to treat stored data as a structured dataset rather than simple display data.

I also gained a deeper understanding of algorithm efficiency, particularly how techniques such as maintaining a running sum can significantly reduce computational overhead.

This experience reinforced the importance of designing algorithms that are not only correct, but also efficient and practical for real-world applications.


Summary

This enhancement transformed PowerScale from a basic data-tracking application into a more intelligent system capable of analyzing user data and providing meaningful insights.

By applying algorithmic principles and efficient data processing techniques, the application now delivers greater value to users while demonstrating strong competency in algorithms and data structures.