Place Constraints

Place some interesting constraints on your solution, describe them in your README's "Constraints" section and why you selected those particular constraints.

You may ask "why make my work harder?" The reality is that your projects will always be tightly bound by constraints, some are under your control but most are not. Taking time now to intentionally explore the effect of different constraints on your development process will pay off in the future.

Constraints are much more than just extra challenges! Well-selected constraints can help you:

  • Increase your creativity
  • Improve the quality of your finished solution
  • Understand challenges in new and unexpected ways
  • Learn new things from old or easy challenges
  • Practice dealing with common & realistic scenarios
  • Focus in on particular techniques, tools, or language features
  • Improve project estimation skills

Constraint Suggestions

At the beginning of your programming journey choosing helpful constraints will be very challenging, and you're already constrained enough by your lack of experience. There's no reason to go wild placing extra difficulties in your way. That said, there is one constraint we suggest that will help you develop good habits from the beginning:

Think of your functions as return-value photo copiers.

This isn't as challenging as it sounds and may even help by productively limiting your choices. Here's a few pointers for building this kind of function:

  • Initialize your function scaffold with the right type of return value at the top
  • Initialize your function scaffold by returning the empty return value
  • The main task of your function will be to build this empty value into a complete value before returning it
  • Never modify your arguments, they should only ever appear on the right hand side of an assignment. (ie. No matter where in your function you console.log and argument, it will always be the same.)
  • (Read through Lodash to see this constraint in action.)

More advanced constraint possibilities:

  • Work with only certain language features
  • Avoid certain language features
  • Place a time limit on yourself
  • Use a new library, like Lodash
  • Write the fewest lines of code you can
  • Make your function use the fewest steps possible (as measured by PythonTutor)
  • ... and so many more!


results matching ""

    No results matching ""