r/AskComputerScience • • May 26 '19

Can you recommend a simple network exercise?

I am a volunteer teacher at a prison where inmates can earn a degree and move to the job market after release. I teach Math, but I have an advanced student who is interested in learning CompSci. Since I'm about the only person in the facility who can teach him anything about CompSci, I've been doing my best to guide him through CLRS. Although I am a CompSci novice, by my estimate he's doing well. We've covered list and graph algorithms, he's implemented them in Java, we're now doing hash functions, FFT, and we'll probably cap it off with NP-Completeness.

He's now getting interested in moving on to studying networks, and here I am just way out of my depth. I'll research, recommend, and order him some books. In the mean time I was wondering if there were some very introductory exercise that he and I could work on. Say for instance, to build a very simple simulation of a network in Java or JavaScript on a very old computer with no internet. If such a thing makes sense, does anyone know where I could get some guidance, like a website or book that describes how to do this? The goal would just be to get a basic, hands-on idea of what a network is and what simple things you can do to it and with it. It could smooth things over when we get around to a book.

Thanks.

36 Upvotes

7 comments sorted by

3

u/[deleted] May 26 '19

What kind of network? It sounds like he's interested in graphs (networks that are interesting because they simulate structure), but it could also mean he's interested in networking (getting two computers to talk to each other). If it's the graphs, there's a lot he could do. For starters there are libraries to represent graphs in many languages. A graph is just a list of associations, so a list of objects with "source" and "target" properties should suffice. There's also a matrix representation as well. If I'm not mistaken CLRS covers this pretty well and obviously has some graph algorithms, but this is merely a problem about encoding the network.

If you're actually interested in applications, I would check out Barabasi's Network Science book. It does a good job of going through the history and applications of networks. http://networksciencebook.com/. Also, get him a copy of SICP https://mitpress.mit.edu/sites/default/files/sicp/index.html. These sort of data structures problems are the meat of SICP and could be good to just work through if he's interested in CompSci.

3

u/AddemF May 26 '19 edited May 26 '19

The answer is probably "Whatever kind of network is typically studied in a college course titled 'Networks'." I'm guessing that's the latter of the two you mentioned. Also a hint as to which it is, is that he's interested in BitCoin and more generally the idea of the blockchain. I tried reading a book with him about the subject, but it involved too much information about computers talking to each other that I couldn't understand, so I had to give up on that. Therefore he did too. So we probably also want to understand "Whatever kind of network one must first understand, to then study the blockchain."

Also, he's not especially fond of Algorithms, he's just studying them because 1) it's one of the few CompSci courses I can speak about with above-average understanding, and he doesn't have better options than working with me; and 2) I've convinced him that people in industries typically say that the course they use the most in their daily work is Algorithms. So he's doing it inspite of not really enjoying the subject, rather than because he enjoys it.

(Note: I know the blockchain is a fad, but if he walks away understanding hashing and distributed systems better, it can only be good for him. If he's extra motivated by the hype, so be it. He's also relatively good about not getting to lost in the details of current technologies and focusing on the Science so that when he's released he can figure out the latest technology easily.)

(Another note, I've actually tasked him with building his own graph class complete with an interface and parameterized types! He's implemented DFS, BFS, Prim's, Kruskal's, and other graph algorithms. So we're actually pretty on-the-ball when it comes to this version of a network. I directed him to make it an adjacency list representation and I did this very crudely just to not get bogged down in details without ever getting to the algorithms. But we talked enough about the matrix representation that he gets the idea.)

Interestingly I've already ordered SICP and he has it in the library. I've not read it but I promised him it's legend in CompSci circles and promised we'd work through it together over the Fall semester. I was unaware that it was very relevant to Networks, I thought it was mostly good for what would fall under a "Design of Languages" course, and a "Compilers" course. I know neither of these subjects very well, but I'm good enough with functional programming that I feel I can tackle it better than I did the blockchain.

2

u/Terny May 27 '19

I would recommend teaching subnetting. I'm assuming you already covered binary and octect, if not, go over these. Most of the exercises can be done pen and paper.

1

u/AddemF May 27 '19

By binary, do you mean binary numbers, like base-2? If so, yeah, we're fine with anything that intersects math and CS like that. (In fact, the notes I made for him had the section numbering zero-indexed and in base-2. :) )

→ More replies (1)

1

u/obiwanks May 27 '19

What you want is a network simulation software like Packet Tracer. You can simulate physical networks in the Packet Tracer environment by dragging, dropping and connecting network equipments (or you can use commands like in linux terminal). Google Packet Tracer Labs and go with the one that starts from scratch.

1

u/AddemF May 27 '19

Can't download anything, no internet connection.

What I had in mind was sort of like what we did for graphs. We made an interface giving high-level descriptions of how the object should behave and then implemented the details in some very crude way. Here, I'd think along the lines "Ok, a network, what is that? I guess it's nodes. Maybe the nodes can get distinguished between clients and servers? Or is there really a deep difference from a network perspective? Are there other kinds of nodes I would need to plan for? I dunno, would need a reference for this. Anyway, the nodes can connect to each other, and when they connect there is some kind of protocol. I've heard the phrase "handshake", I'm not sure what that is. Anyway, they connect and now they can start "talking". ..." And so write an interface with methods for connecting and talking and so on.

Nothing fancy, nothing extremely optimized and as complex as the real thing. Just the rough sketch of what a network is, as a Java class.