https://www.dendron.so/ logo
Join DiscordCommunities
Powered by
# dev
  • j

    jojanaho

    09/01/2020, 4:45 PM
    > you can use them when you have lots of notes under a hierarchy and want to enforce some sort of consistency yep, for this case I'm thinking what is the benefit of the namespace schema for me, as the user. Since by default the namespace allows anything there, it lacks the consistency (only patterns would have some)
  • k

    kevins8

    09/01/2020, 4:46 PM
    namespaces are a bit better than not having anything
  • k

    kevins8

    09/01/2020, 4:47 PM
    since they match
    {namespace}.*
    , it's better than the glob equivalent of
    **/*
    which would match not just the child but all children
  • k

    kevins8

    09/01/2020, 4:47 PM
    and while a namespace can be arbitrary, you can still have a well defined structure under a namespace
  • k

    kevins8

    09/01/2020, 4:48 PM
    eg. my project schema
    Copy code
    yml
    version: 1
    imports:
      - cli
      - _cook
      - lang
    schemas: 
    - id: p
      desc: dev project
      parent: root
      children:
        - lang.operator
        - cli.cli
        - concepts
        - topic
        - config
        - debug
        - qa
        - design
        - internal
        - lifecycle
        - quickstart
        - changelog
        - _cook.cook
        - issues
        - lang.flow
    - id: design
    - id: issues
    - id: config
    - id: concepts
    - id: topic
      data:
        namespace: true
    - id: internal
      desc: Explanation of how code works
    - id: lifecycle
    - id: quickstart
    - id: concepts
    - id: debug
    - id: qa
    - id: changelog
      template:
        id: p.template
        type: note
  • k

    kevins8

    09/01/2020, 4:49 PM
    i use this for software projects (eg. dendron). while the project names are arbitrary, i do have a defined hierarchy for what I expect to be under the project namespace
  • j

    jojanaho

    09/01/2020, 4:55 PM
    hmm, what does the matching note hiearchy look like? I was expecting "p" to be namespace
  • j

    jojanaho

    09/01/2020, 4:56 PM
    also in this example topic has data attribute and namespace is there?
  • k

    kevins8

    09/01/2020, 4:58 PM
    the
    data attribute
    is a leftover from pre v1 schema. it's still valid but today, you would just do
    namespace: true
  • j

    jojanaho

    09/01/2020, 5:01 PM
    hmm, so this would imply structure like p.topic.dendron ? I was expecting structure like p.dendron.design
  • k

    kevins8

    09/01/2020, 5:02 PM
    topic is a child of dendron. so this would match
    p.dendron.topic.*
  • k

    kevins8

    09/01/2020, 5:03 PM
    by default, a schema will inherit the pattern prefix of its parent
  • k

    kevins8

    09/01/2020, 5:03 PM
    since
    topic
    is a child of
    project
    , the pattern to match topic is the pattern for project
    p.*
    + the pattern for topic
    t.*
  • j

    jojanaho

    09/01/2020, 5:11 PM
    shouldn't "p" be a namespace?
  • j

    jojanaho

    09/01/2020, 5:11 PM
    since it allows e.g. dendron below it?
  • k

    kevins8

    09/01/2020, 5:12 PM
    opps, it is. i was correcting the
    data: namespace
    thing before pasting and removed the whole thing 😅
  • j

    jojanaho

    09/01/2020, 5:14 PM
    ok, in this example, why namespace is assigned for "topic"? What would happen if it wouldn't be a namespace?
  • k

    kevins8

    09/01/2020, 5:15 PM
    the reason is because i use topic as a junk drawer for stuff that might differ from project by project
  • k

    kevins8

    09/01/2020, 5:15 PM
    eg. see topics under dendron
  • j

    jojanaho

    09/01/2020, 5:16 PM
    sure, but since notes can be added anywhere despite of the schema, I guess any sub-node can be also a junk drawer?
  • j

    jojanaho

    09/01/2020, 5:16 PM
    so is there some benefit of explicitly stating that
  • k

    kevins8

    09/01/2020, 5:16 PM
    vscode is also a
    project
    in my knowledge base. the topics under vscode are the following
  • k

    kevins8

    09/01/2020, 5:17 PM
    > > so is there some benefit of explicitly stating that > @User the benefit is of having it recognized by the schema
  • k

    kevins8

    09/01/2020, 5:18 PM
    so this is similar to typescript - you can compile your typescript code into javascript even if the types don't match (depending on your
    tsconfig
    ). types help make your projects maintainable, especially as they grow
  • k

    kevins8

    09/01/2020, 5:19 PM
    currently, the only thing dendron will do is show you an indicator if your schema doesn't match
  • k

    kevins8

    09/01/2020, 5:19 PM
    in the future, we'll have a strict mode where we will actually prevent you from creating notes that don't match your schema
  • k

    kevins8

    09/01/2020, 5:22 PM
    schemas at the end of the day help you construct consistent hierarchies for your notes. consistent hierarchies alleviate the cognitive overhead of needing to understand and track N things where N can be very big. instead, you can construct a single schema that encompasses the common areas of all N things
  • k

    kevins8

    09/01/2020, 5:23 PM
    this allows you to quickly reference anything within your hierarchy because they all have the same shape. for me, it also helps with understanding a topic - i find my schema for a domain tends to reflect my mental model for said domain as well
  • k

    kevins8

    09/01/2020, 5:24 PM
    eg. I'm using nodejs and need to access a file. i have no idea what the builtin/recommended library for file access is. instead of having to dig up
    fs-extra
    or
    fs
    , i can navigate to
    l.node.file
    and see my notes on the best way to work with files
  • k

    kevins8

    09/01/2020, 5:25 PM
    you can replace
    node
    with any other programming language. now i have a general way of referencing file access for all languages without needing to remember the specific implementation detail of any of them
1...456...108Latest