Letting the Data Lead the Code

Abstract

Sometimes the data format used can radically simplify the code. A simple change to the way data is stored in a file can make a big difference in the code required to read it. This was made apparent recently with some Visual Basic code which would locate a list of numbers based on certain search criteria. The code was about one thousand lines and needed to be converted to C# for a new application. It was time to rethink how this could be simplified. The original data format was just a series of numbers stored in an Excel spreadsheet accessed by variable names. Through a long series of if-then-else and case statements the code determined which data to read from the file. The data-search hierarchy was in the source code. It was found that by changing the data format in a hierarchically structured way the code could be drastically simplified. After changing the data format the search function was simplified to about forty lines of code. Although this article will describe a specific data type search algorithm, it may inspire the developer to think more about the data-code design.

Open PDF

Document Details

Document Type
Technical Report
Publication Date
Aug 01, 2015
Accession Number
ADA626701

Entities

People

  • Darryl Bryk

Organizations

  • United States Army Tank Automotive Research, Development and Engineering Center

Tags

Communities of Interest

  • Materials and Manufacturing Processes

DTIC Thesaurus Topics

  • Abstracts
  • Algorithms
  • Basic Programming Language
  • Classification
  • Computer Programs
  • Data Sets
  • Directives
  • Governments
  • Hierarchies
  • Information Operations
  • Maintenance
  • National Governments
  • United States
  • United States Government

Fields of Study

  • Computer science

Readers

  • Computer Programming and Software Development.
  • Database Systems and Applications
  • Systems Analysis and Design