Zettelkasten Forum


Capturing Code Snippets?

This discussion was created from comments split from: Introduction to the Zettelkasten Method.

Comments

  • edited March 31

    Thank you very much for creating the Introduction post. I am very excited about it!

    I want to start my own Zettelkasten but I have some doubts on how to approach it.

    I am software developer and I would like to capture not only thoughts but also snippets of code with short explanation on how to use it. However, code is not a thought and it doesn't fit the Zettelkasten very well.

    How do you treat this kind of information?
    Could you point me to read more about it if it is already discussed somewhere?
    Maybe it should live outside of the boundaries of Zettelkasten?

    Edit: I found this link in the forum which discusses how to use Zettelkasten as a developer.

  • Code is one of the cases I am not qualified to have an opinion on. But there are some coders on this forum. @ctietze can tell more.

    I am a Zettler

  • @plam4u

    I am in the same boat as @Sascha , but I'll offer an opinion anyways (keeping in mind that "those with experience need never be at the mercy of those with an opinion").

    It is simply this - don't code snippets still capture some coding idea or have some specific purpose? If so, what is wrong with putting them in a zettle, with a brief description of what they do and why they are useful? That zettle can then be connected to other zettles with a similar purpose or overlying theme.

    I at times struggle as well with what to include in my ZK and what to store outside of the ZK. If it's any help, I try to err on the side of including something in the ZK rather than not. What stays outside my ZK is usually a fact devoid of any idea content, although that definition may not be too helpful.

  • Thank you @Sascha!

    Thank you @GeoEng51! I asked specifically about code snippets because they are like quotes from books and one of the principles is to write in your own words and not copy-paste what you read. So, I thought to myself that perhaps it is not a good idea. However, I do agree that it is not the same since code snippets are usable "as is" and finding that note has value. If you add some context that I guess makes it a perfect citizen of your ZK.

  • @plam4u said:
    Thank you @Sascha!

    Thank you @GeoEng51! I asked specifically about code snippets because they are like quotes from books and one of the principles is to write in your own words and not copy-paste what you read. So, I thought to myself that perhaps it is not a good idea. However, I do agree that it is not the same since code snippets are usable "as is" and finding that note has value. If you add some context that I guess makes it a perfect citizen of your ZK.

    I do this all the time with graphs and tables that contain engineering information - usually something that I will use for design in the future. They contain a small amount of very focussed information and need context (description), but they fit into my ZK perfectly.

  • @plam4u Sounds like you reached a conclusion similar to the one I have: capture code snippets as-is, or better yet, trim down if possible (to remove context specific limitations and increase potential reuse).

    I do sometimes read a blog post where code examples are in, idk, C# and then adapt the gist to a language I can parse and write more easily. Ruby for the love of it, or Swift for everyday use, for example. Still, the resulting code of an algorithm is then stored as-is to tell future me how to do the thing.

    It kind of looks like a quote, but as you pointed out, it is actually something else because you can use or rather run it as is. Sometimes it pays off to paraphrase the piece to tell what this is about, or what the approach is, and why this was used and not something else, but the paraphrases only annotate and not replace the code.

    Author at Zettelkasten.de • https://christiantietze.de/

Sign In or Register to comment.