Code Monkey home page Code Monkey logo

wordtally---build-your-own-wc-tool-from-unix-coding-challenge's Introduction

๐Ÿ”ค WordTally - Build Your Own wc Tool Coding Challenge

https://codingchallenges.fyi/challenges/challenge-wc/

wordtally - Unix wc tool replica


โ–ถ๏ธ A wc tool replica made in Java 17 to print a newline, word, char and byte counts for each input file and a total number of lines, words, bytes and chars if more than one FILE is specified. A word is a non-zero-length sequence of printable characters delimited by white space.

โ–ถ๏ธ In case there is no file as input, the app will read from standard input. Since this is a linux/unix command, this standard input, which is created by another tool and redirected with pipe (|), will be read from the stdin file descriptor of the process id of wordtally (/proc/PID-number/fd/0).


final-Small.png

Concepts/technologies used:

  1. Object-Oriented Programming Principles;
  2. Collections Framework โ€” Array, ArraysList and HashMap;
  3. Lambda functions, Streams and Method references along with serialization into a JSON;
  4. Design patterns from the GoF: Singleton and Builder along with Dependency Injection and Inversion of Control;
  5. Spring Boot with CommandLineRunner interface and Lombok, Jackson and Apache Commons CLI dependencies;
  6. GraalVM for conversion from .jar into a binary file;
  7. Logging and banner were disabled (spring.main.banner-mode=OFF, logging.level.root=WARN) on Spring Boot along with Tomcat Server (spring.main.web-application-type=NONE);
  8. Asynchronous with Concurrency processing implemented with CompletableStage/CompletableFuture API to handle multiple files as input much easier and faster;
  9. IO and NIO libraries for input/output processing;

Note

Challenge is ๐Ÿ’ฏ completed!


๐Ÿ‘จโ€๐Ÿ’ป How To:

โœ… In the target directory in this repo you can find everything you need to run the app, the .jar and binary file made with GraalVM.

Screenshot-from-2024-04-21-07-46-08.png


โœ… Use it with short options and files as input.


โœ… Use it with short/long options with files or standard input.


โœ… What happens when proper input is not provided (wrong options, files, etc).

๐Ÿ‘‰ If you want to see the code and make additions, you can clone this repo and try it. In case you want a binary file as a final product, then you need to install SDKMAN from sdkman.io and then with sdk GraalVM (22.3.r17-nik). Please know that for this project I'm using Java 17 Corretto from Amazon. Before you start to build the binary file with Maven, make sure that Runtime Environment is set to GraalVM as you can see bellow:

[root@republic]# java --version
openjdk 17.0.5 2022-10-18 LTS
OpenJDK Runtime Environment GraalVM 22.3.0 (build 17.0.5+8-LTS)
OpenJDK 64-Bit Server VM GraalVM 22.3.0 (build 17.0.5+8-LTS, mixed mode, sharing)
[root@republic]#

โ–ถ๏ธ Current UML diagram:

WordTallyUMLDiagram.png


HitCount

valentinsoare - wordtally stars - wordtally forks - wordtally

GitHub release License issues - wordtally

License

Released under MIT by @valentinsoare.

wordtally---build-your-own-wc-tool-from-unix-coding-challenge's People

Contributors

valentinsoare avatar

Watchers

 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.