Showing posts sorted by date for query elevator simulation. Sort by relevance Show all posts
Showing posts sorted by date for query elevator simulation. Sort by relevance Show all posts

Wednesday, March 14, 2018

Object-oriented design review

March 14, 2018

Introduction


It is so exciting to have a partner to work together on the object-oriented design. The peer was very passion and like to apply factory pattern on the design. What an exciting project! Also the project is divided into two parts, version one and version two. We had half an hours discussion in mock interview, and later I received the code.

Code review


I work hard and also like to give some good support to encourage the peer to work hard. So I wrote a code review. Here is my review. I also pasted in the following:

I read your email and also code. Overall I like to see the business rules are defined in your words, and user cases are defined in your function spec. But I am not sure if this practice is old school style. I may be wrong, sorry for my honesty feedback.

You reminded me the elevator simulation algorithm I did last year in the contest. I ended up staying later 4:30 AM.


So here is my coding blog called Hackerrank contest algorithm: elevator simulation.

So here is the discussion panel.

Here is the discussion panel about the algorithm. Every business rule is determined by players as a user case, so we have to define how many user cases in your design, otherwise you will fail test cases.

I like to refer you to those discussion, one of test cases is wrong, then the publisher apologized for the error.

I like to say that it is good idea to get involved in the community like hackerrank contest, some of problems are totally object-oriented design, you have to go through exactly the process of system design, define how to scale, storage, define user cases, and also data structure and algorithm design. There are unknown test cases to pass.

Remember that I may have some hacker spirit, and behave like a warrior borrowed from tennis player Maria Sharapova; that is what I believe and just share with you. I do not worry about too much factory pattern or implementation. Sometimes you know that the job market is so competitive, you cannot expect that the project is waterfall style, you even do not have time to think about the pattern and you have to figure out the business rule you miss and hidden test case you can not pass, how to scale is more important these days, like I did in the contest, staying later up to 4:30 AM to try to score something to improve my ranking, just business-minded and stay aggressive.

That is just my opinion, you can be very intelligent that you are believed that you can apply any pattern you want, if you have time, you have interest, and also you think that it is right thing to do.



Saturday, March 25, 2017

Code Review: Implementation of a Card class in Java

March 25, 2017

Introduction

Julia likes to know when she can be object-oriented programming expert. One thing she can do is to work on a simple class code review, and understand how to make it perfect. Today, she chooses to study this Card class in Java and then get herself comfortable to choose public/ private, static, and name of variable.

Last time when she wrote static for elevator simulation algorithm,  she could not recall when to use static exactly.

Code review study 

Implementation of a Card class in Java


code review study

code review: Play a game of Rock, Paper, Scissors

March 25, 2017

Introduction

Julia likes to work on the object-oriented design, one of her ideas is to post a question on code review for her submission of the algorithm - elevator simulation, but she hold on for some reason. 

Julia came cross this algorithm - play a game of Rock, Paper, Scissors, so she likes to do some study and see how many things can apply to her previous submission of elevator simulation.

Code review study


Play a game of Rock, Paper, Scissors

Sunday, March 12, 2017

Hackerrank - woman codesprint #3, elevator simulation

March 12, 2017

Problem statement

Contest performance 


Call it a day, 4:25am. Finally, after 4 hours writing code and dubugging, scored 18.00. Pass 7 test cases, fail 10 test cases. 8 runtime error, 2 wrong answers, Julia could not figure out and then she needs to go to sleep.

I never experienced this kind of coding, Elevator simulation, very good workout.

Julia, you should train yourself coding not in the contest. Julia enjoyed the adventure of coding this medium algorithm called elevator simulation. Julia could not believe that people can write the algorithm in less than one hour.

Here is the progress report, for the contest.


Follow up after the contest 


Here is the C# code submission in the contest.

Code Review of the function SimulationElevator


A few places have duplicate code, need to extra a new function for class WaitLine, Passenger, Trip, and then make the function SimulationElevator from 160 lines of code to less than 50 lines of code.

First revision 


April 3 2017
Julia spent over one hour to code review the submission on April 3 2017. The C# code is here. Plan to spend some time to review the design, try to pass all test cases. And then ask a code review on stackexchange.com.


Follow up 


March 14, 2018

I got an email about object-oriented design code review request from the peer in the morning 2:30 AM. so I gave some feedback. My main idea is to get into a community like hackerrank, and also being a hacker, and have some warrior spirit.

Here is my review.