DEV Community

Martin J
Martin J

Posted on • Updated on

What do you use for prototyping data structures?

So far I've mostly used pen&paper. Tools for designing the data structure or graphing felt either a bit clunky or way too complex for my needs.

What about you?

Recently, since I picked up typescript I found using interfaces just for this purpose to be quite useful.


interface User {
    id: string
    email: string
    location: Location
    avatar: string
    name: string
    geoBin: string //uber h3?
    friends: string[] //friend user id array
}

/**
 * Can even use jsdoc for stuff
 */
interface Location {
    longitude: number
    latitude: number
}

interface Listing {
    owner: string //userId
    created: number //ts
    updated: number //ts
    geoBin: Location
    system: string[] //array or string, array for more
    online: boolean
    description: string //markdown
}

Enter fullscreen mode Exit fullscreen mode

Discussion (0)