d-w-arnold / my-chat

Example chat utility application for recruitment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Programming Exercise

Name: David W. Arnold

I have expanded on this skeleton application (used as part of a software development interview).

All code snippets below represent the command-line arguments provided when running com/mindlinksoft/recruitment/mychat/ConversationExporter.main() to utilise a given feature.

Essential Features Usage:

  • A user can export a conversation from a given file path stored in the following file format into a JSON file at the given output path:

    (e.g. The first argument is the input file path, the second argument is the output file path)

    chat.txt chat.json
    
    chatDetails.txt chatDetails.json
    
  • Messages can be filtered by a specific user:

    (e.g. To filter by user "keith")

    chat.txt chat.json -u keith 
    
  • Messages can be filtered by a specific keyword:

    (e.g. To filter by the keyword "bread")

    chat.txt chat.json -k bread 
    
  • Hide specific words:

    (e.g. To hide/redact the words "hello", "there" and "world".)

    (Each word to hide is separated by a , character, though this can be changed in com/mindlinksoft/recruitment/mychat/CommandLineArgumentParser, on line 35)

    chat.txt chat.json -w hello,there,world
    
  • All essential features can be used at the same time, in any permutation:

    (Just a few examples...)

    chat.txt chat.json -u keith -k bread -w hello,there,world
    
    chat.txt chat.json -u keith -w hello,there,world -k bread
    
    chat.txt chat.json -k bread -u keith -w hello,there,world
    
    chat.txt chat.json -k bread -w hello,there,world -u keith
    
    chat.txt chat.json -w hello,there,world -u keith -k bread
    
    chat.txt chat.json -w hello,there,world -k bread -u keith
    

Additional Features Usage:

  • Hide credit card and phone numbers:

    chat.txt chat.json -hideCCPN 
    
  • Obfuscate user IDs:

    chat.txt chat.json -obfUsers 
    

    (When this flag is enabled, user ID's are replaced with a unique random 6-digit string, and a record of the obfuscated user ID mappings are written to obfUsers.txt)

  • A report is added to the conversation that details the most active users:

    chat.txt chat.json -report 
    
  • All additional and essential features can be used at the same time, in any permutation:

    (Just a few examples...)

    chat.txt chat.json -u keith -k bread -w hello,there,world -hideCCPN -obfUsers -report
    
    chat.txt chat.json -u keith -w hello,there,world -k bread -hideCCPN -report -obfUsers
    
    chat.txt chat.json -k bread -u keith -w hello,there,world -obfUsers -hideCCPN -report
    
    chat.txt chat.json -k bread -w hello,there,world -u keith -obfUsers -report -hideCCPN
    
    chat.txt chat.json -w hello,there,world -u keith -k bread -report -hideCCPN -obfUsers
    
    chat.txt chat.json -w hello,there,world -k bread -u keith -report -obfUsers -hideCCPN
    

Unit Testing

(All unit tests written using JUnit, see pom.xml for the specific version)

  • To unit test parsing of command-line arguments, run all tests in: com/mindlinksoft/recruitment/mychat/CommandLineArgumentParserTests.

  • To unit test the conversation exporter, run all tests in: com/mindlinksoft/recruitment/mychat/ConversationExporterTests.

  • To unit test the conversion from JSON to JSON string, run all tests in: com/mindlinksoft/recruitment/mychat/CreateGsonBuildTests.


(Original readme.md content below)

Instructions

  • Treat this code as if you owned this application, do whatever you feel is necessary to make this your own.
  • There are several deliberate design, code quality and test issues that should be identified and resolved.
  • Below is a list of the current features supported by the application; as well as additional features that have been requested by the business owner.
  • In order to work on this take a fork into your own GitHub area; make whatever changes you feel are necessary and when you are satisfied submit back via a pull request. See details on GitHub's Fork & Pull model
  • Be sure to put your name in the pull request comment so your work can be easily identified.
  • The project is written utilising some Java 8 features (java.time), we encourage using Java 7 or 8, but this is your project now, so you are free to choose a different version.
  • The project uses maven to resolve dependencies however if you want to avoid maven configuration the only external JARs that are required is junit-4.12 and gson-2.5.
  • Refactor and add features (from the below list) as you see fit; there is no need to add all the features in order to "complete" the exercise.
  • We will only consider candidates that implemented at least the "essential" features.
  • Keep in mind that code quality is the critical measure and there should be an obvious focus on TESTING.
  • REMEMBER: this is YOUR code, make any changes you feel are necessary.
  • You're welcome to spend as much time as you like.
  • The code will be a representation of your work, so it's important that all the code--new and pre-existing--is how you want your work to be seen. Please make sure that you are happy with ALL the code.

Things We Value

  • Good code structure - separation of concerns,
  • A well-formed exception model,
  • Tidy code,
  • Application of appropriate design patterns,
  • Unit tests.

Things To Avoid At All Costs

  • Throwing general exception,
  • Magic strings,
  • Methods that do everything,
  • No testing.

my-chat

Essential Features

  • A user can export a conversation from a given file path stored in the following file format into a JSON file at the given output path:
<conversation_name><new_line>
(<unix_timestamp><space><username><space><message><new_line>)*
  • Messages can be filtered by a specific user
    • The user can be provided as a command-line argument (how the argument is specified is up to you)
    • All messages sent by the specified user are written to the JSON output
    • Messages sent by any other user are not written to the JSON output
  • Messages can be filtered by a specific keyword
    • The keyword can be specified as a command-line argument
    • All messages sent containing the keyword are written to the JSON output
    • Messages sent that do not contain the keyword are not written to the JSON output
  • Hide specific words
    • A blacklist can be specified as a command-line argument
    • Any blacklisted word is replaced with "*redacted*" in the output.

Additional Features

Implementing any of these features well will make your submission stand-out. Features listed here are ordered from easy to hard.

  • Hide credit card and phone numbers
    • A flag can be specified to hide credit card and phone numbers
    • Any identified credit card or phone numbers are replaced with "*redacted*" in the output.
  • Obfuscate user IDs
    • A flag can be specified to obfuscate user IDs
    • All user IDs are obfuscated in the output.
    • The same original user ID in any single export is replaced with the same obfuscated user ID i.e. messages retain their relationship with the sender, only the ID that represents the sender is changed.
  • A report is added to the conversation that details the most active users
    • The most active user in a conversation is the user who sent the most messages.
    • Most active users are added to the JSON output as an array ordered by activity.
    • The number of messages sent by each user is included.

About

Example chat utility application for recruitment


Languages

Language:Java 100.0%