Subscribe to Stuck in an Infiniteloop        RSS Feed
***** 2 Votes

Snippets: A Brief How-To

Icon Leave Comment
1. If your snippet has specific functionality, put it in a function. This allows me to quickly test it as a module. There are exceptions to this, but by and large, it should be in a function (or method if you're British in Java).

2. Provide a description. The field is there, but often is unused. Context is key in this business. Sure I can tell "what" your code is doing from the code, but the "why" is just as important. It's a brief glimpse into your thought process and that is infinitely more interesting then anything you could write.

3. Provide a test case, especially if you neglected number two. What you used you as input, what you got as output, and a brief description. Or, at the very least, expected I/O sans details. It would be even better if you provided a small sample implementation (a little main() or whatever).

4. If you pulled an algorithm from somewhere, post the algorithm or its source. i.e. there are a lot of ways to calculate sine/cosine/other math functions which often differ in minute ways. Linking or posting the "blueprint" allows a quick verification to see if it's right or if any small changes are needed to make the function work.

0 Comments On This Entry

 

January 2022

S M T W T F S
      1
2345678
9101112131415
161718192021 22
23242526272829
3031     

Tags

    Recent Entries

    Recent Comments

    Search My Blog

    22 user(s) viewing

    22 Guests
    0 member(s)
    0 anonymous member(s)