3 ms·
Reminds me a little bit of the time in an intermediate programming course where we had to write a variety of programs and the input was an enormous string conta
by JohnMakin 3y ago
Reminds me a little bit of the time in an intermediate programming course where we had to write a variety of programs and the input was an enormous string containing the entire novel "Jane Eyre."
I discovered very quickly that building a string by concatenating the input one word at a time in Java, my preferred language at that time, was a huge mistake, because of the way string literals work in Java. StringBuilder to the rescue!
At first I was astounded at how slow it was, but when I learned how the underlying language semantics worked, it made sense.
- jandrese 3y agoWow, that's a fantastic exercise for a computer science class. Most classes only work on programs so small that students don't really get a feel for how things scale.
- JohnMakin 3y agoIt was one of my more memorable ones. It had ~50 exercises that I recall, and the core of the program was supposed to compute a word frequency list on the words in the novel (with a blacklist of words like common adjectives etc). The twist was you had to do it with a particular programming paradigm in mind each time - functional, object oriented, MVC, REST API, anything you could think of. It was very eye opening solving the exact same problem in so many different ways.