Jayd Saucedo


The Universal Sandwich Tree

I like to tell people I can explain the universe by explaining a sandwich. I then use this opportunity to trick them into learning about data structures. This sandwich based data structure is something I built about a year ago. I haven’t really updated it since I built it. However, I wanted to talk about it because I think it’s one of my favorite database structures I’ve had to implement. It’s somewhat complicated, but it’s easy to explain. The project was for a software engineering class. Originally we were gonna work with some company on an angular modules project, but then we decided we wanted to do our own thing. We wanted to implement something in the MEAN stack. For a lot of members in my team, this was their first web development experience. For me, this was my first experience using the MEAN stack. I gravitated towards the backend because I like to think about data structures.

The idea we came up with is a recipe search engine. We called it recipe stacker because you simply input ingredients and it finds recipes with those ingredients in them. The front end is pretty awesome, that was most of our team member's original goal, to learn angular. So a lot of time was spent focusing on the front end. I did a bit of work on the front end, but the backend is what interested me.

I had never worked with a non-relational database before. So the sandwich based schema I came up with turned out to be a nightmare. Also this was my first time working with NodeJS. Needless to say my code isn’t very pretty, and I’m not gonna show much of it. What I think is more interesting is the actual database structure, and what it allows us to do.

The idea is that there are three basic types of data structures that make up our recipes. There is a Composition, Abstract, and Primitive structure.

The rules are as follows: