School Navigator

Technologies used

Project worked on Spring 2015

At age 17

Project worked on for about 2-4 hours a day for about 4 weeks

Description

An application that generates directions between two rooms in my high school.


Why I Built It

The reason for this app is to help people who don't know their way around the school, like incoming freshman, or parents at back-to-school night. With this app, the user enters the room number where they are and the room number they want to get to, and directions are generated.


Technical Details

This app is made up of two pieces, a Web Server and a Map Server. The Web Server and Map Server interact via a Sockets connection. The Web Server serves web pages to the client browser and submits directions queries to the Map Server. Then it displays the Map Server's response back to the client. The Map Server has a Listener Thread running that waits for a Socket client to connect to it, then once a client has connected, it spawns a new Client Handler thread to handle that client. The Listener Thread then returns to listening for client connection requests. The Client Handler Thread is assigned to an available Map Thread. It reads the directions request from the client and passes it to an available Map Thread via shared memory. The Map Thread uses Dijkstra's algorithm and the Map Data it has to find the shortest path between the two rooms provided. Then it generates written directions in English and sends them back to the Client Handler Thread via shared memory. The Handler Thread then sends the English directions back to the Socket client, at which point the Client Handler is terminated.

The Map Data is read into memory when the process is started. There is a maximum number of ten concurrent Map Threads. Each Map Thread makes its own copy of the Map Data in order to execute Dijkstra's algorithm. So there is a balance needed between number of concurrent Map Threads and the amount of memory consumed. The more concurrent threads running, the more CPU resources the application is capable of using.

The Map Data represents all the hallways and rooms in the school. It is stored in XML format and is read into memory to populate Hallway, Intersection, and Room objects.


What I Learned

  • XML data format / XML parsing

  • Dijkstra's shortest path algorithm

  • Better understanding of Java servlets

  • Multithreading


The Project's Story

Shortly after joining my high school's Code Club, fall of 2014, we went through a process of coming up with projects we might want to work on as a club. One idea that was thrown out was the idea of making an app to give freshmen directions around the school. I was excited to start on this project and we began some initial conceptualization and planning. But then robotics season started and many of the people in the group were then too busy to work on this project. After robotics season ended, the other people in my group were no longer interested in working on the School Navigator app at that time, so I decided to work on it independently.

The first piece of the application I decided to work on was path-finding. After doing some research, I found Dijkstra's shortest path algorithm and figured out how to use it to generate directions. After consulting a fellow code club member, I decided the best first implementation of the application would be as a web app. We also considered making an Android and/or IOS app, but decided on a web app as it would available to the most users.