Skip to content

quinnsprouse/drive-capital

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌐 Network Analyzer

Network Analyzer is a program that processes network relationships between partners, companies, and employees. It reads commands from a file and prints out the companies' strongest relationships.

Table of Contents

🏗️ Building

To build this program, you'll need Node.js installed on your system.

  1. Clone the repository:

    git clone https://github.com/username/network-analyzer.git
  2. Navigate to the directory:

    cd network-analyzer
  3. Install the dependencies:

    npm install

▶️ Running

You can run the program by executing the following command:

node start input.txt

Replace input.txt with the path to the file containing the text you want to process.

🧪 Testing

To run the tests, use the following command:

npm test

🧠 Approach and Design Decisions

The problem was approached by defining classes to represent partners, companies, and employees and encapsulating their relationships and interactions. The NetworkAnalyzer class is responsible for processing commands and performing the relationship analysis.

  • Class Design: Classes were created to make the code more modular and easier to read.
  • Command Processing: Commands are processed line by line from the provided file, allowing easy extendability for additional command types. This also allows us to process the file line by line instead of loading the entire file into memory.
  • Analyzing Relationships: Relationships are analyzed and printed at the end of processing to determine the strongest relationship for each company. Having the printing functionality isolated from the file processing allows us to output the results in different formats in the future. For example, we could print the results to a file instead of the console.
  • Dependency Injection: Dependencies like the file reader and console were injected instead of relying on global dependencies. This way, we can mock these during testing.

📝 Assumptions and Edge Cases

  • Assumptions about Input Data:

    • The input file must follow the specific command format.
    • Companies and Partners must be defined before Employees and Contacts.
    • Employee names and company names are unique.
  • Possible Edge Cases:

    • Handling of missing or malformed commands.
    • Handling of duplicate commands for the same entity.

About

Drive Capital Assessment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published