Git Product home page Git Product logo

tie's Introduction

Technical Interview Exercises Build Status Code Coverage

Technical Interview Exercises (TIE) is a lightweight open-source tool aimed at helping students learn key concepts, principles, and coding patterns that are important in software engineering. TIE allows users to write code to solve technical coding challenges and receive real time insightful and guiding feedback.

The project is currently in early Beta. This means that content and features are limited. We plan to add more content and features as we develop towards version 1.

User setup

  1. From https://github.com/google/tie/, click on the green "Clone or download" button then click "Download ZIP"
  2. Unzip the zip file
  3. Open the file client/question.html in a web browser
  4. Use the coding window on the right to code a solution and click "I think I'm done" if you think you have answer (repeat until you solve the question)
  5. To stop the TIE application, simply close the browser window
  6. To remove TIE from your computer, delete the downloaded files from steps 1 and 2

Disclaimer

This is not an official Google product. TIE is provided "as is" and without warranty (refer to the TIE LICENSE file for details).

tie's People

Contributors

a-zakem avatar abinash-behera avatar alblin avatar andersonw avatar apicardgoog avatar arbiter527 avatar benjaminholland avatar bsbandme avatar cwcai633 avatar davyrisso-at-google avatar dchen97 avatar ddmail2009 avatar eledavi avatar eprym avatar eyurko avatar huangme-zz avatar jianhaolyu avatar jianjinjian avatar jujudydy8196 avatar lumig242 avatar luofei11 avatar michaelrobbe avatar rabidbit avatar seanlip avatar shaman-rajan avatar skywalker-lili avatar theresa-lee avatar wmcalyj avatar xchenan avatar xiaoyig avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tie's Issues

Strange characters after pressing ctrl+z

How to reproduce:

  1. Open app.html with Chrome in Ubuntu 14.04;
  2. In question 1, select the text box where to enter the code;
  3. Without typing anything, press ctrl+z (the shortcut to rescind some edit), one could get what shows in the screenshot.

screenshot from 2017-04-04 10 42 19

Horizontal scrolling in editor leads to UI issue

Reproduction Steps:

  1. Open the app.html file in chrome
  2. Go to Sample Question 1 (Any sample question would do)
  3. Add a long line of code that extends beyond the visible area
  4. Scroll to the extreme right using the horizontal scroll bar

Expected Output: The line numbers should not overlap with the code

Actual Output: The code contents overlap with the line numbers on the left
screenshot from 2017-04-04 11 44 53

Last Question (encode and decode)

The problem statement is not so clear. We don't know what to expect as the result of the decoder. The problem said something about one-to-one mapping between the encoder and decoder, 23xa means 2aaa and not 23 of 'a'. However, it is not just clear in the problem statement.

User can change size of text boxes

Behaviour

screenshot from 2017-04-04 13 29 47

The text areas with the instruction and the question can be resized by the user.

Expected behaviour

Text areas resize or become scrollable based on the amount of text in them (with a fixed minimum size)

Repro steps

  1. Open app.html
  2. Click and drag from the marker on the bottom right corner of the instuction/question box

Error seen on console after completing first question

Expected behavior: No errors seen in Dev Tools console.

Observed behavior: "TypeError: Cannot read property 'forEach' of undefined" error written to Dev Tools console after completing the first question.

Steps to reproduce:

  1. Chrome Open Developer Tools console
  2. Complete first question
  3. Observe error

Show better error message if user deletes or modifies starter code.

Repro steps:

  1. Open app.html
  2. Navigate to the i18n problem.
  3. Change "abbreviate" to "isBalanced"
  4. Run code.
  5. You should see this error: ["Your code threw an error: AttributeError: 'StudentCode' object has no attribute 'abbreviate' on line 42"]

It might be worth catching that error and saying something closer to "You seem to be missing an 'abbreviate' method. Check the starter code and make sure that it hasn't been deleted or modified accidentally."

Suggest adding stdout

I wanted to print something to the screen with print(), but that did not work. I suggest adding stdout to the page, since that could be useful sometime.

screenshot from 2017-04-04 10 56 43

No message to warn against library imports

Reproduction Steps:

  1. Open "app.html"

  2. Navigate to a question

  3. Add a library import like import string or import re

  4. Use the import in the function like word[0] in string.whitespace or re.compile(r'\w')

  5. Click Run

Current message is:
NameError: name 'string' is not defined on line 3

Which could be:
Library imports are not permitted for this problem

screen shot 2017-04-04 at 10 15 23 am

Standard library imports like re and string may not be allowed as they make the problem solution too simple and unchallenging. However, it might be a god idea to say that explicitly.

[EDIT Mar 4, 11:24]
Suggested Solutions:
Option 1: Ban the use all libraries for all questions
This is a blanket solution. For each solution to any problem, check for an import statement. If there is one, don't compile the problem. Instead, show a message saying imports are not permitted.
This is how the system is currently designed and would only require adding a check and a message. This can be a good minimal solution.

Option 2: Ban libraries specific to questions
We could have two sets of libraries - banned in every question e.g. pandas and banned for this specific question e.g. re for string manipulation questions. This is a more elegant and sustainable solution and requires a little more work than the first option

[UI issue]Console display starts from middle of the message

Repro Steps:

  1. Open "app.html".

  2. Navigate to question 1.

  3. Change the returned string from "" to a random string(e.g., "abcd") which will produce wrong answer.

  4. Click "Run".

  5. The console now shows the input("moo cow bark dog") and the output("abcd"), and the expected output("oom woc krab god") if scrolling down the window.
    screen shot 2017-04-03 at 11 49 40 am

  6. Change the returned string from "abcd" to another random string(suppose the user is fixing the bug in the code).

  7. Run the code again.

  8. The console shows the expected output, but the actual output is not seen until you scroll up the window.
    screen shot 2017-04-03 at 11 51 00 am

Expected behavior: The console always displays the input and actual output, whenever the user runs the code. It's easier for the user to see what his/her code produced and debug the code.

Changing the function name results in error

Executing code after changing the function name displays error and breaks the output console.

Reproduction Steps:

  1. Open the app.html file in chrome
  2. Go to Sample Question 1 (Any sample question would do)
  3. Change the function name to any name of your choice
  4. Press 'Run'

Strange text when undo is used in editor

Pressing undo in the editor from the default text makes strange text appear in the editor.

screen shot 2017-04-03 at 7 52 46 pm

Repro steps:

  1. Open app.html
  2. Click on editor and press undo (command-Z used here on a mac)

[Question Schema] No Checks on Previous Tasks

The Judge does not test my code for tasks that I've passed before.

For example, on Question 2, my code went through Task One smoothly but had bugs on Task Two. Then I made some changes so as to pass the tests for Task Two. Even through now my code failed on the tests of Task One, the Online Judge would not find out, but instead moved me forward to the third task. Such design seemed quite inappropriate to me, because the next round task, based on the previous one, encourages challengers to generalize their codes, rather than allowing them to pass the tasks individually.

Add CodeSubmission object to Snapshot object.

Per discussion in #57, let's add the new CodeSubmission object to the Snapshot (that's used as part of a transcript) so that the transcript has all the information needed to restore a user session.

Element width not consistent and no centering in smaller window size

Behaviour

On a larger window, everything is centered with the same height on the left and right sides:
screenshot from 2017-04-04 13 40 46

On smaller windows, the elements do not have a consistent width, nor are they centered on the page. Also, the extra height on these is not required when the elements are stacked vertically.
screenshot from 2017-04-04 13 43 15

Repro steps

  1. Open app.html
  2. Decrease browser window size till the question box goes below the code editing box

No auto indentation for Python

Hi,

The current version of TIE does not do auto-indentation when there is a new line after 'def', 'if' or 'where' clauses. It just aligns the new line with the previous one. It may be more user-friendly and save some time if this feature is included, since it is not convenient for users to count spaces themselves.

I captured two screenshots to compare between TIE and Leetcode.

screen shot 2017-04-03 at 6 31 24 pm
screen shot 2017-04-03 at 6 32 25 pm

Confusing result when outputFunctionName != null

Retro steps:
In step3 of Question 4, Run-Length Encoding:
We write a one-line program to return the input directly, then click 'run'.
screen shot 2017-04-03 at 7 04 53 pm

Output:
The output of our function will be 'bbbbb' when input is '5xb'.

Expected behavior:
The output of our function will be '5xb' when input is '5xb'.

Possible causes:
'bbbbb' is the result after using the function 'AuxiliaryCode.decodeEncodedString' defined in 'outputFunctionName' attribute in JS script of questions on our output '5xb'. It may confuse some users cause the output in the console is not the actual output of their function.

Suggestion:
Maybe we can modify the text when outputFunctionName != null. For this question, a possible output could be 'Output after decoding:', 'Expected Output after decoding'. Or we can modify the question: give them the decoding function/strategy to ask them write correct encoding function to make sure the string remain the same after encoding and decoding. Or in the last step we can ask them to implement the decoding function by themselves.

No feedback to user when parsing fails

If you try the following in the reverse word question:

def reverseWords(word):
  if word == "moo cow bark dog":
    return "oom woc krab god"

Parsing fails and an error is written to console, but no feedback (or error) is given to the user.

Expected behavior: Some indication to user what went wrong.

Observed behavior: Nothing (unless you open a console and see the obscure error message written there)

OutputFunction isn't currently supported.

Any output function defined in the auxiliary code and then specified in the data schema (such as rle.js's decodeEncodedString) is not currently used.

Repro steps:

  1. Go to the run-length encoding problem, once I've pushed my fixes.
  2. Paste in the solution.
  3. Run until you get to the "decode" step.
  4. Your output should return 1x5xb for one correctness test, rather than 5xb, signifying that AuxiliaryCode.decodeEncodedString was not run on the output.

Arrays as input are not currently supported.

For are_all_unique, it takes in an array as an argument, but that's not currently supported, so jsonVariableToPython crashes.

Launch app.html
Navigate to i18n question
Complete tasks up to first instance of filling in are_all_unique
App should crash.

Code cannot be saved in the webpage

I finished the question 2 (compiled successfully and got tests passed) and moved forward to question 3. When I went back to question 2 (click "2" in the process bar) to review the code, the code has been reset and my code was not saved.

[UI problem] GUI problem

On the GUI it said "You'll see the first question to your right". However, the question appears in the bottom.

Add functionality for e2e tests to ensure that the application does not break.

We should probably add an end-to-end test that loads the page and clicks some of the buttons / submits some code, in order to prevent breakages like the one that was fixed in #80. (Note that even an end-to-end test which just loads the app.html page in a browser and checks that there are no console errors would have helped here.)

Protractor is likely to be a good library for this, and is worth investigating.

Unable to create custom test cases in the webpage

Sometimes users want to create custom test cases to figure out the bugs in their codes, but there is no place to do it in the webpage right now. So it should be helpful to have it and maybe it's better to embed a default right algorithm for each problem to show the correct result for the custom test case.

Description of question i18n not clear

The description/examples of this question could be more detailed, as dog->d1g is a valid case according to the description but failed here:

screen shot 2017-04-03 at 1 43 08 pm

Maybe like below:
An abbreviation of a word follows the form <first character><length of the middle of the string><last character>. Below are some examples of word abbreviations:
a) it --> it (no abbreviation)
b) d|o|g --> dog (no abbreviation)
c) i|nternationalizatio|n --> i18n

[UI Issues] Output text cannot wrap within the text area

The output screen at the left top corner has a black box to indicate the Run results, which only scales based on the screen size instead of the text length. Thus, if the text within this black box is longer than screen size, the rest text will simply extend out of the black box, which is not very elegant.

Repro instructions:

  1. Run app.html
  2. Navigate to Question-1
  3. Change code to return a very long string, such as

screen shot 2017-04-03 at 1 40 57 pm

  1. Click on Run button
  2. Actual result will come out in this black box

screen shot 2017-04-03 at 1 36 29 pm

We can find out the output text exceeds the actual size of the black box.

Allow students to ask questions.

(This comes from a suggestion in #88.)

It would be nice to have some sort of way for students to "ask questions". This could be as simple as having a question mark button in the bottom right and allowing them to select, multiple-choice style, clarifying questions from it (including "can I have a hint, please?"). That way, although they might not be able to practice coming up with questions on their own, at least they get a feel for what sort of thing to ask.

Better to keep user's code when they navigating different questions

Currently, if user navigate to another problem, they will lose all the work on current problem even without a warning message.

  1. Do some work on Q2
    image

  2. Click question 3
    image

  3. Then you lose all your work on Q2
    image

This can be very frustrating for users if they just navigate to another problem by accident, or they are stuck on the current one and they wish to work on another problem and come back later. We might keep user's work in session or at least add an alert message warning that they are about to lose all the current work.

[Sample question issue] RLE question gives confusing description

In the last phase of this question, the user are required to encode the word in a comprehensible manner, in which "5aaaa" can be decoded properly.
However, the most straight forward way is to encode "5" as "1x5", which conflict with the previous phase's requirement(encoding should be as short as possible).

Whitespace does not render correctly in feedback window

Expected behavior: When question or feedback looks at how whitespace is handled, whitespace is rendered properly in the feedback window.

Observed behavior: Whitespace appears as a single space character, regardless of whether it is a tab or consists of multiple whitespace characters.

Steps to reproduce:

  1. Try reverse string exercise
  2. Fail the whitespace prompt
  3. Look at feedback

Runtime errors have the wrong line numbers.

Repro instructions: Go to the reverseWords problem, and type the code seen in the screenshot below.

Observed behaviour: Runtime errors have the wrong line numbers. For example, in the screenshot below, the error is shown as being on line 15, whereas the actual error is on line 3.

Expected behaviour: The error message should show the correct line number.

screenshot from 2017-03-01 15 40 38

Prevent users from making calls to system-level classes.

Students should not be able to access AuxiliaryCode or System classes.

Repro steps (at least, the easiest ones):

Navigate to Problem 2
Paste in the following code:
def isBalanced(s): return AuxiliaryCode.countNumberOfParentheses(s)
Run code. You should get an error message (rather than a SyntaxError or something) since it called one of the AuxiliaryCode methods. We should block students from calling any of those classes, potentially via throwing a SyntaxError or a ForbiddenNamespaceError of our own making. Something to tell them yo you can't run our code.

Problems of input code screen

  1. Cannot add a character in middle.
    When users want to add 'c' in middle of 'abde', users will expect it becomes 'abcde'. But the actual result turns to be 'abce', where the new character 'c' covers the old character 'd' instead of adding itself between 'b' and 'd' in 'abde'.

  2. Cannot scale as two other output screens.

Error messages are not interpolated.

Repro instructions: Go to the reverseWords problem, and type the code seen in the screenshot below.

In the screenshot below, the feedback message is not interpolated, so it is meaningless. We should either support interpolation or choose a different feedback message.

screenshot from 2017-03-01 15 41 42

Indentation is often inconsistent and incorrect.

For some reason the editor is conflating tabs and spaces and it's causing all sorts of errors. I usually run into this on the i18n question when adding the length check to abbreviate.

Open app.html
Copy/paste solution.
Add lines to solution (hitting "Enter" after a complete line), and then tab inwards.
You see the correct indentation, but it's now mixed tabs with spaces.

Question 2 (parenthesis): hints not matching the real problem of user's code

In the code, we just return Booleans such as False, False or False, False or False or False...and so on. However, the hints got different every time. Seems like the hints are just iterating in the back-ends regardless of the actual mistake of user's code.

And if we return anything but an expression that results in False, such as None, True...It displays the input, output and the expected output. I kind wish it always displays so that users know what input they are tested against.

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.