GithubHelp home page GithubHelp logo

ticketedmoon / social-url-database Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 39 KB

A simple REPL for storing Social URLs with the ability to export summary statistics highlighting social scores per domain.

Java 99.51% Shell 0.49%

social-url-database's Introduction

Social-Url-Database

A simple REPL for storing Social URLs in-memory with the ability to export summary statistics highlighting social scores per domain. Your store will be removed once the program has exited.

Prerequisites

  • JRE version >= 1.8
  • Apache Maven version >= 3.0.0

How to Run

I've created some bash scripts alternatives that can be run to build the program and run it, these will be mentioned below.

  1. run ./build.sh or bash ./build.sh, alternatively run mvn clean package to accomplish the same thing.
  2. run ./run.sh or bash ./run.sh, alternatively cd into nw-application/ and run java -jar target/nw-app.jar

Approach

This project is based off JDK8. Some improvements to the code could be made with future versions, such as the Enhanced Switch statement or, text blocks for the introduction message. The REPL was done with the java.util.Scanner package which accepts input until the program is exited. System.out is used to write output.

Something to note, is that I allowed the scores to be decimal in nature, rather than just Integer.

The project was structured with 1 sub-module with it's own pom. This was done in the scenario this project could be extended in the future and more modules may be added. The parent pom controls the versions of all the dependencies and the child poms can include these dependencies selectively without the version - as it will be inherited from the parent.

Also, I considered using a logger, but ultimately thought it wasn't necessary for the scope of this project. I opted for a Guard Clause approach around the majority of the conditional flows, as I find the code easier to read this way; by validating against the edge cases at the top and leaving the body of the method for the service logic.

java.net.URL did not provide enough built-in validation for checking against URLs, so I needed to add further validation on top of this to ensure commands like: ADD https:///www. 5.02 would be invalid.

Tests

I wrote a number of Junit tests (8) to accompany this small project, those can be run with mvn test.

Additionally, I wrote a test to cover the case given in the problem description. The output is slightly different with regard to the order of URLs when exporting and that my solution allows scores with 2 decimal places, other than that they are identical - you can find this test in LauncherTest::callMain_testAllOperations_withNwDataset

social-url-database's People

Watchers

Shane avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.