Cognizant Coding Challenge

When I joined Cognizant they had most everyone write some code. Here is that old code. Yeah, I know, it hasn’t aged well. Hopefully I’ll be able to make a new version soon.

Albums Coding Challenge Response.docx164.3KB
coding_challenge.zip746.4KB

High Level Design

Both stacks (EspressJS and Spring/Scala) follow a similar structure with domain model approach. Requests flow into the REST framework and through the routing system. Parsers and ORM/DAO functions are encapsulated in their respective services and repositories.

Discussion

NodeJS Stack

  • ExpressJS: Used as the core framework due to its popularity and ease of use for REST API implementations.
  • Typescript: Provides strong linting, compiled code, and error reduction through stronger typing and typed models.
  • Papa Parse: Chosen for CSV processing due to its speed, modern promises support, and streaming capabilities.
  • Mongoose and MongoDB: Used for ORM and data storage due to easy setup and management.

Spring Boot Stack

  • Spring Boot: Chosen for its powerful options, strong dependency injection, and a large ecosystem.
  • Scala: Benefits from case classes which work well with Spring REST and Spring Data.
  • CSV Parsers: Kantan and PureCSV were chosen for their concise and effective parsing capabilities.
  • Spring Data: Provides a nice ORM for accessing and saving data easily.

REST API Endpoints

NodeJS Implementation

  • PUT Import Albums from File: http://localhost:3000/album/import
  • PUT Add a single Album: http://localhost:3000/album/
  • GET Get all the albums: http://localhost:3000/album/
  • PUT Export the albums back to a CSV file: http://localhost:3000/album/export
  • GET Get albums report by year: http://localhost:3000/album/report?groupBy=year
  • GET Get albums report by genre: http://localhost:3000/album/report?groupBy=genre

Spring Boot Implementation

  • PUT Import Albums from File: http://localhost:<port>/album/import

Scalability and Real Product Creation

  • Proper CICD and SDLC: Move to Gitlab for source code control, automated builds, and tests.
  • Application Containers: Dockerize and deploy applications on public clouds using Kubernetes and DevOps tools.
  • Event Processing Model: Use Kafka for high scale and availability.
  • Datastore Options: Consider options like PostgreSQL, Cassandra, and InfluxDB based on data usage patterns.

Known Gaps and Issues

  • NodeJS: Clunky promise handling, complex group functions with Mongoose.
  • Spring Boot: Clunky aggregates requiring extra Service component, reliance on POSTMAN for testing, need for more unit testing.
  • CSV Parsers: Varying stages of marshalling to and from domain models.