How to Do Short Response and Coding Assignments
Last updated
Last updated
Table of Contents:
Software Engineering (SWE) code assignments are opportunities for you to practice the skills learned in your Software Engineering fellowship at The Marcy Lab School. In these assignments, you can expect to:
Create code from scratch
Modify existing code
Debug broken code
Code assignments will typically have an src
directory where you will be writing your code. They will also have a tests
directory with .spec.js
test files that will automatically test your code each time you push to your repository.
Tests are an essential part of professional software development. Without testing our code, we run the risk of deploying code with unexpected bugs. With testing, we are forced to think critically about how we expect our program to behave and then write our code to satisfy those tests. This process of first writing tests and then writing code to satisfy those tests is called Test-Driven Development (TDD).
Import functions from source code
Run those functions with various inputs
Compare the returned values against the expected values.
A Jest test is written in a file ending in .spec.js
or .test.js
and looks like this:
Each assignment will have automated test files in the tests
directory. They will show you exactly how we expect your functions to behave. DO NOT MODIFY THE TESTS.
To run these automated tests, use the command:
After running this command, you will see the following output. Initially, all tests will fail.
The test output provides some really useful information.
We can see which tests failed
For each failing test, we can see which expect()
statement failed
We can see what the expected value is (12.566...
) and what our function actually returned (undefined
).
Armed with this information, we can more confidently build our functions knowing that we have a specific set of targets to aim for. Automated tests allow us to repeatedly run our code against the same set of tests until all expectations are met.
All assignments will also come with a src/playground.js
file that you can use to manually test your code as you develop. We recommend the following workflow:
Run the automated tests to see what you are aiming for.
Copy the function you are currently working on into the playground.js
file and use the test cases to manually test your code
Once you are satisfied, copy your function back into the original file and run the automated tests again.
If anything fails, return to the playground.js
file to make adjustments.
Repeat.
In order for a coding assignment to be marked as "Complete", it must pass at least 75% of the automated tests (though you should always strive to pass 100% of the tests!).
For example, an assignment with 10 automated tests requires 8 passing tests to be marked "Complete".
There is no limit to the number of times you can submit an assignment. As such, you are encouraged to always submit your assignments on time to ensure that your instructor can provide you feedback and support to complete your assignments.
To support you in your growth as a software engineer, your instructor may provide feedback on any of the following areas (roughly in order of importance):
Code Quality
Adherence to coding standards and conventions (e.g., ESLint rules)
Use of proper naming conventions (variables, functions)
Avoidance of code duplication
Clear and concise comments
Functionality
Does the code meet the project requirements?
Does it pass all tests, both automated and edge cases?
Correctness of input/output handling
Modularity and Reusability
Proper use of functions or classes
Modular and reusable code (avoiding large, monolithic functions)
Clear separation of logic
Version Control Practices
Meaningful commit messages
Consistent use of branches
Proper use of pull requests and code reviews
Code Structure and Organization
File structure
Separation of concerns
Readability and logical flow
Error Handling
Proper use of try-catch blocks
Graceful handling of unexpected inputs or states
Meaningful error messages
Efficiency and Performance
Time and space complexity
Use of appropriate data structures and algorithms
Avoidance of unnecessary computations
Software Engineering (SWE) Short Response (SR) assignments are opportunities to develop your technical communication skills.
In these assignments, you may encounter the following types of prompts:
Research a new topic and share your findings.
Explain a piece of syntax with examples and analogies.
Analyze a programming best practice and list its advantages and disadvantages.
Your intended audience should be someone with some experience programming but who is still learning. As such, strive to be as clear and concise as possible. There is a fine balance between too much information and just enough but when in doubt, provide more details. Examples and analogies can often help!
Strive to do more than just answer the prompts. Use the prompts as opportunities to practice your technical communication. While anyone can write functional code, not everyone can communicate clearly so take pride in this work!
Every response will be given a score from 0-3 using the following scoring system:
0 — Did not attempt to answer the prompt
1 — Attempted the prompt and the response is more wrong than right, or parts of the prompt are not fully answered, or the answer is lacking in clarity. Examples and/or diagrams are missing (when required).
2 — Attempted the prompt and all parts of the prompt are answered, but there are some mistakes and/or the clarity could be improved. Examples and/or diagrams may be missing or could be improved.
3 — Answered the prompt correctly and completely. The response is clear and concise. Examples and/or diagrams are well-chosen and enhance the response.
We understand that typos and grammar mistakes can happen, however, you will also lose .5 points on any the prompt where typos or grammar errors are "distracting". Distracting meaning that if you saw this on the job, it would have to be retyped for clarification or for the sake of presentation.
To support you in your growth as a technical communicator, your instructor may also provide feedback on the following areas:
Clarity: The communication is precise, concise, and unambiguous. Technical jargon is explained, and terms are used consistently.
Completeness: The communication covers all necessary technical details, scenarios, and edge cases, providing sufficient examples or references.
Structure and Organization: For longer answers, answers are logically organized with clear sections, headings, and transitions between ideas. The structure enhances understanding.
Use of Examples and Diagrams: Uses well-chosen examples, diagrams, or code snippets (when appropriate) that significantly aid understanding and clarify complex concepts.
Accuracy: The content is technically correct and adheres to current best practices and standards.
Conciseness: The communication is efficient, avoiding unnecessary detail or excessive language, while still being comprehensive.
For example
Below are some examples of responses that would score a 1, 2 or 3.
On short response assignments, you may use generative AI tools like ChatGPT to help structure and refine your responses and to check for spelling and grammar mistakes. However, the majority of the writing should be yours! As a rule, aim to have no more than about 25% of the content written by a generative AI assistant.
On coding assignments, you may use generative AI tools like ChatGPT to help explain assignment instructions or test code. You may also use it to improve code that you've already written in areas such as code quality, structure, or efficiency.
If you are really stuck, you can use solutions generated by generative AI tools in the same way that you would use coding solutions found on the internet. However, the majority of the code should be yours! As a rule, aim to have no more than about 25% of the content written by someone other than you.
All code generated using AI or found on the internet should be cited using comments. Every line of found code should be commented with an explanation of the code
"Grades" don't exist at Marcy. We only need performance data in order to know how you're doing, and make sure the people who need help get it as quickly as they can. It's ok if you didn't finish by the deadline! Just show us what you have. We'll have office hours and reviews, and we want to know what you are all struggling with so we can use those meetings effectively. This is not about grades, its about seeing what you know, and where we can help!
For short response and coding assignments, you will create a new branch called draft
to complete your work. When you are ready to submit, you will create a Pull Request (PR) and tag your instructor for review.
Below, you will find detailed instructions for setting up your assignments and for submitting your assignments.
Upon receiving any assignment, you should do the following setup steps:
Accept the assignment using the provided GitHub classroom link. It should generate a repository that is unique to you.
Clone down your repository and cd
into your repository.
(For coding assignments only) Run the following commands:
This will install any necessary dependencies and then show you all the tests you need to work on. We may explain each function in the README.md
, but always run the tests because they are crucial to explaining what the code literally must do.
Create and checkout a new branch called draft
To submit an assignment, do the following:
Add, commit, and push your draft
branch to your repository.
You may need to set an upstream branch using the command
Create a pull request using the Pull Request tab (and ignore the "Compare & pull request" button).
Change the compare branch to be your draft
branch and then click Create pull request!
Tag your instructor as a Reviewer.
Submit the URL of the pull request on canvas. The URL should start with https://github.com
and end with /pull/NUMBER
, like this: https://github.com/benspector-mls/hello-world/pull/3
Your instructor will provide feedback on GitHub and will either approve your branch to be merged or will request that you resubmit.
If you've accidentally added code to your main
branch and want to move it into a draft
branch, no need to worry. You can undo this by moving your code into a draft
branch and reverting your main
branch to the previous commit.
First, do the following to create / update your draft
branch with the latest changes in main
:
On your own computer, cd
into the repo and git checkout main
and git pull
to make sure your local main branch is in sync with the remote repository.
Then git checkout draft
(git checkout -b draft
if you don't have a draft
branch).
Run git merge main
to make sure that the draft
branch is up to date with the main
branch.
git push
to push your draft
branch to GitHub. You may need to run git push --set-upstream origin draft
if this is your first time pushing your draft
branch.
Go to GitHub and double check that your draft
branch has been pushed and that it contains your work.
Then, do the following to revert your main
branch back to the initial commit:
git checkout main
and git log
to see the full commit history.
Find the commit you want to return to. Copy the commit SHA code (a 40-digit code identifying the commit).
Run the command git reset --hard <commit_sha>
replacing <commit_sha>
with the copied SHA from the last step. This will return your main
branch back to that commit.
DANGER: Running this next command will permanently delete the most recent commit from your main
branch's commit history. Make sure that your draft
branch on GitHub contains all of your work before proceeding.
Finally, in your main
branch git push -f
to force the remote main
branch return to the previous commit as well.
Once you've done this, return to GitHub and confirm that the main
branch has returned to the previous commit and that your draft
branch still contains your work. Then follow the steps above to create a Pull Request.
As you work on your coding assignment, you may be tempted to jump right in and start coding. However, it is often best to slow down and plan out your approach first. Look at the problem and make sure you understand fully what it is asking you to do. At Marcy, we recommend that you use the PEDAC approach ().
You may get stuck along the way, which can always be frustrating. Debugging is an essential skill but its hard to know where to start sometimes. That's why we love the "rubber duck" approach ()
At Marcy, we use to write automated tests for coding assignments. Automated tests are JavaScript files that:
Short Response prompts will always be found in the README.md
file of your assignment. Each prompt will be listed under a ## Prompt X
heading and you should add your responses under the ### Response X
heading using Markdown ().
For more details on our AI Policy, refer to the .
Want to learn more about git branching and making Pull Requests? Check out the !