I am currently solving problems on Hacker Rank under the section Interview Preparation Kit. I have attempted one of the problem under the sub-section "Sorting" called Fraudulent Activity Notifications and I came up with 2 solutions. I will request you two have a look on my 2 versions and let me know the pros/cons in the design decisions i have taken.
I have also open a pull request for the later branch commits to the master for making some notes about the review.
My thoughts: for adopting second version as a solution I have designed the second version(the later one) as the evolution to what i had in my first version. there, i have refactored the Sorting related task by delegating it to the Containing Sorter interface(i have also written one of its implementation with the same logic as in my first version). this has a plus of modularity and Refactoring, also its easy to change the Sorter if needed to change at any point of time.
I have also written a unit test in the test folder on my github repo with the JUnit5 framework. i am also trying to learn the principles of TDD(Test Driven Development) but I have not read or practice much about it beside some of the APIs in the JUnit5 and have tried to apply in practice. Please review the tests also.
Some difficulties i need to know about in unit testing:
1.) How to test private methods: i have search about it and get answers like use reflection or some framework thats doing the same thing behind the scenes(i dont remember the name of framework but i think it's powermockito), some people argue that private methods are automatically tested during testing the units they are part of, i think its not be right to say this because it crosses the barriers of unit testing as later on somebody can also say testing the complete application implicitly test its all units. please advice. Is it a bad idea to temporarily change the private modifier to package private for testing purposes.
2.) Can somebody advice me some short book on TDD and Patterns in Unit testing.
Waiting to watch some Constructive Criticism and i will try myself to be a Egoless Programmer throughout the review!!
PS: I am learning git in parallel for getting comfortable with it through practice and since i have seen reviewers generally also advice about things done poorly there. so that's why i have attached the github link. if somebody is still not comfortable with github please let me know. i will post the code here.
Try to enjoy your work while doing it,it will Automatically convert in Hard Work...
1: You showed us three classes, but you only appear to have two GitHub links.
2: Your formatting is inconsistent. Sometimes your comments start with /*newline and sometimes with /* text. Your lines are too long, which makes them difficult to read. You have the  in the correct place for array declarations, but they shouldn't be preceded by a space.
3: Why didn't you make the comments on all your constants into documentation comments?
4: Some of your field identifiers are ambiguous: MAXM_SPENT_DAYS, for example. MAXM is harder to read than MAX/MAXIMUM. Does SPENT mean days spent doing something, days for spending money (see line 152), or days during which the offence is regarded as spent?
Only a few things, but I hope that gives you ides to improve the code.
If I had asked people what they wanted, they would have said faster horses - Ford. Tiny ad:
global solutions you can do in your home or backyard