The Daily WTF
Follow
CodeSOD: Uniquely Enough Identifiers
Running a database can be expensive, especially with limited expertise. To save costs, an application used Google Sheets as its database for a marketing team with a small number of users. However, the application lacked proper maintenance and expertise, leading to suboptimal performance.To generate unique identifiers, the application employed a custom function that combined random strings with timestamps. The function was inefficient and prone to errors.The IDs were then checked against a list of existing IDs by extracting all values in the ID column and using a loop to generate a unique ID.This approach made the system more fragile and confusing for users, as it was more complex than simply using a spreadsheet with clear instructions.The application's design prioritized cost-saving over efficiency and maintainability, resulting in a system that was difficult to manage and lacked scalability.By attempting to avoid the need for a dedicated database, the application introduced additional complexity and limitations.In hindsight, it would have been more effective to use Google Sheets as a spreadsheet with clear user instructions rather than attempting to implement complex database functionality.The application's unique approach highlights the potential pitfalls of prioritizing cost-cutting over long-term maintainability and scalability.The example demonstrates how adding code to a system without proper planning and expertise can lead to unintended consequences and a decline in performance.It serves as a reminder of the importance of investing in appropriate database solutions for applications that require data management beyond the capabilities of a spreadsheet.