Algorithms

Computer Science: The Good Parts

Computer Science: The Good Parts

by Jeffrey Cohen

In "Computer Science: The Good Parts," Jeffrey Cohen presents a beginner-friendly overview of fundamental computer science concepts, emphasizing their practical applications in modern technology. Drawing from his own non-traditional journey into the field, Cohen highlights that one doesn't need a formal computer science degree to grasp important principles that are pivotal in developing software today.

Key Points:
- Personal Journey: Cohen shares his background as a self-taught developer who initially faced imposter syndrome and developed an aversion to traditional computer science education, later becomming a master’s instructor in the subject.

- Data Structures: He discusses the importance of data structures for data storage, emphasizing that programming revolves around data transformation. Concepts such as linked lists and binary trees are introduced to illustrate how data can be organized efficiently for retrieval and processing.
- Binary Trees and Algorithms: Cohen explains how binary trees facilitate quick data management and decision-making processes, drawing parallels to structures applied in systems like air traffic control or social networks.
- Graphs and Connections: He elaborates on graph theory, showing how these models help in finding optimal paths, such as routing in navigation systems, underscoring their relevance through real-world applications.
- Historical Context: Through anecdotes about influential figures in computing, like Alan Turing and Grace Hopper, Cohen connects foundational computer science concepts to historical events, emphasizing the impact of their work on modern computing.
- Complexity Analysis with Big O Notation: He introduces concepts like Big O notation to assess algorithm efficiency, explaining variations such as O(n) and O(log n), which indicate how execution time can scale with input size.

- The Broader Impact of Computer Science: He concludes by affirming that computer science extends beyond data structures and algorithms; it involves using programming skills to make meaningful contributions to society, encouraging developers to engage with their communities and foster innovation.

In summary, Cohen's talk serves as an empowering call to embrace the foundational aspects of computer science, demonstrating that any developer can harness these

00:00:15.400 What's up, everybody? It's an honor to be closing out the day. I'm from Chicago, part of the Chicago Ruby community.
00:00:20.890 You probably don't know who I am. I've been a software developer for about 20 years. I started using Ruby on Rails in 2006.
00:00:28.990 I went to school to study audiology and speech pathology, and after graduating, I realized that my degree prepared me to do absolutely nothing.
00:00:38.540 So, I was able to get an entry-level programming job at a nonprofit in my town, and one thing led to another; I just kept programming.
00:00:47.260 I figured that one day, people would find out that I don’t really know much about computer science, and then I would have to find another job. It turns out this is something called imposter syndrome, where you feel like you don't belong even when you actually do.
00:01:07.670 It took about 10 years for me to realize that I'm just as capable as someone who might have a computer science degree.
00:01:14.750 I even developed a very anti-computer science attitude. I reached a point in my career where I was hiring other people and interviewing college graduates who had just come out of college with a CS degree, but it felt like they didn’t really know anything in terms of actually being able to sit down and start programming.
00:01:28.160 This was because of a misconception I had in my head, leading to a very strong anti-attitude toward computer science.
00:01:35.780 However, a number of years ago, I became interested in the field. I started reading things on the Rails talk mailing list or the Ruby core list, and I began encountering terms I didn’t really know, prompting me to look them up.
00:01:48.770 Eventually, this led me into some computer science.
00:02:01.159 I now teach in the master's program for computer science at the University of Chicago. Don't tell them I don't have a computer science degree! I just want to share a quick story of how my journey into computer science has transformed me as a developer, and hopefully, it can inspire you as well.
00:02:58.370 You may have caught on to the title of this talk, an inside joke referencing the famous Crockford book about JavaScript. There's the 'JavaScript: The Definitive Guide' on the left and then 'JavaScript: The Good Parts' on the right. You can tell by the relative thickness.
00:03:09.410 What I'm going to try to do is something similar with computer science. I want to make you aware of the good parts of computer science, just enough so you can learn on your own.
00:03:20.530 I'll be taking a very beginner-focused approach, so you don’t need to know anything about computer science to get something out of this talk.
00:03:43.790 If you were to open any computer science textbook, you would see something about data structures. This is usually where I closed the book because I can't think of anything more boring! But computer programming is essentially about data transformation. This may sound like a weird way to think about programming, especially for someone like me, who is an object-oriented thinker.
00:04:04.070 To think about data as having that primary role might seem strange, but it's fundamentally how we approach programming.
00:04:30.380 This photo illustrates a messy garage. It highlights that if you have something to put away, you want to store it in such a way that you can easily retrieve it later. Depending on what you're putting away, you may need different kinds of containers. I want to frame my thinking about data structures in this context.
00:05:06.080 We use data structures only because we need a place to store data when we’re not using it right at that moment. It would benefit us to organize our data effectively so that we can retrieve it easily when needed. Let’s start with probably the most primary data structure that one learns in computer science: the linked list.
00:05:38.029 As Ruby developers, we’re used to arrays, but a linked list is not an array. It's a data structure with just the most primitive operations you can think of, designed only to store a list of things.
00:05:49.339 In a linked list, you can only access the first element. From there, you can get the next element that it's connected to, so each element is linked to the next, similar to a chain.
00:06:09.770 You could think of it as a line of elephants, trunk to tail. I once built a Ruby class to implement this functionality—it taught me a lot about how to traverse a linked list. I could only push things into the list, get the first element, and then retrieve the next one. If I wanted the fifth element, I had to start at the beginning and walk the chain.
00:06:40.009 It's a great exercise. If you were to step away from this talk and write this simple Ruby class tonight, I think it would expand your understanding of data structures and how they work. The solution to my implementation was counterintuitive, and there are many different approaches.
00:07:11.250 From there, you may have heard of binary trees. Here, instead of having just one connection between elements, we can have two. The cool thing about that is that if you’re smart about making connections, you can effectively pre-sort the data as you go.
00:07:35.399 The basic approach is simple: let's say we start with the number 60. When someone gives me 31, instead of just attaching it directly, I have two options: if it’s less than 60, I’ll place it on the left; if it’s greater, I'll put it on the right.
00:08:04.949 For instance, if the next number is 80, it goes on the right. If the next number is 70, I'd start at the top (60), move right to 80, and then back to the left for 70. That's how we begin populating this binary tree.
00:08:28.349 Traversing a binary tree becomes easy because it’s in a pre-sorted order. So who would use such a structure? A binary tree can actually be utilized in many ways, such as decision making in complex systems or managing object hierarchies.
00:08:42.448 If you’ve ever worked on decision management systems, or if you’re curious about how programming languages and abstract syntax trees work, you can see how these concepts are used in practice.
00:09:12.160 You may even find it useful for modeling things like social networks, maps, plumbing systems, electrical grids, and more. For example, this is how air traffic control works—figuring out degrees of separation within the network.
00:09:38.750 When I flew down from Chicago, I thought about driving. I punched it in Google Maps, and it gave me three instant options for my route. How does it know? Our connections work as a graph.
00:10:07.260 The edges, or connections between the roads, have values—be it distance or traffic—and using those values, we can determine the shortest path.
00:10:41.060 That extends into industry, where we can model costs similarly. Speaking of costs, did you know that Honolulu has an interstate highway? I’d love to know the reason for that!
00:11:14.160 This is a snapshot of our current electrical grid's transmission system. Building an automated self-balancing network for our energy supply is crucial to our lives.
00:11:26.990 Recognize this iconic photo? It's from the Curiosity rover we landed on Mars years ago, beginning with—and I joke about this—the first thing we ever taught it to do was take a selfie.
00:11:55.670 The entire landing process was exceptionally complex. Typically, landing something on Mars involved throwing it in a massive trampoline and letting it bounce until it landed where it would.
00:12:35.230 Curiosity required an incredibly sophisticated system—parachutes, heat shield, crane mechanisms—and the whole operation was fully automated.
00:12:51.230 There’s no direct control from NASA; light transmission takes about three minutes to reach Mars. At the time, I was skeptical if this even could work, given my background in computing.
00:13:18.900 However, our current technology operates automatically without human intervention. This leads us back to discussing data structures.
00:13:58.160 To understand these data structures, we cannot ignore algorithms. Many of you might know Charles Babbage and Ada Lovelace, pioneers in thinking about how machines could perform tasks.
00:14:24.490 This eventually culminated in significant historical events, such as Apollo 11, the moment Neil Armstrong stepped onto the moon after years of preparation.
00:14:55.310 But interestingly, when Armstrong descended the ladder, if that’s him, who’s taking the photo? That's Buzz Aldrin! He captured the historic moment, which is monumental in our understanding of computers.
00:15:37.690 This era marked the first time we completely trusted computers with our lives. A malfunction would have meant there was no rescue plan—they had to trust their calculations.
00:16:10.180 A significant contributor to this achievement was Margaret Hamilton, lead engineer for the Apollo space program. Her ingenuity in coding was crucial—she even introduced concepts like priority in threading that saved their lives.
00:16:54.730 She was one of the first to coin the term 'software engineer' and emphasized the importance of software quality, highlighting the complexity in creating reliable systems.
00:17:20.750 Continuing on, we must address complexity in computer science. For any given problem, there are infinitely many good solutions. However, not all implementations of solutions are created equal. We compare these by evaluating execution time and space usage.
00:18:03.600 In this context, Big O notation serves to express an implementation's efficiency and behavior based on input size. It's a nuanced concept that many struggle to grasp initially.
00:18:41.660 For example, if we take a simple Ruby method to check if a name exists in a list and it checks each item one by one, it runs in O(n) time, meaning its execution time grows linearly with the increase in data size.
00:19:11.640 Alternatively, consider a binary search. Here, you would cut the list in half on each search iteration, leading to logarithmic complexity—O(log n)—which is much more efficient.
00:19:37.150 This holds true with methods that drastically reduce search times, making searches across large datasets much more feasible. It’s essential to understand these performance implications.
00:20:04.840 Lastly, with a nested loop to find all combinations in an array, where every element interacts with every other, you’d achieve O(n^2) complexity. This can become unmanageable with even small increases in data.
00:20:45.100 Moving into the future, it’s essential to understand the ongoing evolution in computer science. Let’s step back to World War II. Who can name the British mathematician known for breaking the German Enigma machine? Exactly, that would be Alan Turing.
00:21:47.970 Turing contributed significantly beyond code breaking. After the war, he pondered deeply the role of computers in society and the potential for machines to think like humans.
00:22:09.810 This debate continues today with figures like Elon Musk contemplating the implications of AI. One takeaway from studying Turing is the distinction between computer programming and computer science.
00:22:34.450 Computer programming focuses more on implementations and syntax, while computer science represents a foundational way of thinking known as computational thinking.
00:23:09.240 It’s vital to break things down into smaller components—something I strive to teach many beginner programmers. This thought process seems inherent to seasoned professionals but often challenges new learners.
00:23:24.700 Equally important is understanding the legacy of computer science. Consider Grace Hopper, another significant figure in our history. She became the first female admiral and was pivotal in defining the role of the compiler.
00:24:03.820 Her efforts led to profound changes in programming language design. Hopper was known for teaching practical concepts, particularly the time it takes for light to travel.
00:24:21.820 She brought a tangible understanding of technology, reminding us that humans tend to resist change. This lesson resonates in many industries.
00:24:40.580 Progress necessitates deviation from established norms. Frank Zappa once said, 'Without deviation from the norm, progress isn't possible.' A ship in port is safe but meant for the sea.
00:25:15.210 Many of us here are entrepreneurs or aspiring developers seeking to innovate in a challenging landscape. The sea can be intimidating, yet we find solace in our shared journey through the complexities of computer science.
00:25:56.920 Ultimately, I’m incredibly grateful for having discovered computer science. We are not alone; we stand on the shoulders of countless others who came before us.
00:26:44.270 Computer science transcends data structures and algorithms; it's about using our programming skills to contribute meaningfully to society. Life is brief, and it's essential to channel our unique abilities toward significant causes.
00:27:37.170 In line with Matz's sentiment that the rise of Ruby development stems from community efforts, I urge you to assist those around you. Whether it’s contributing to open-source projects or mentoring others, let's elevate our ecosystem.
00:28:24.150 Together, we can make a difference. As we rise with the collective tide, we enhance opportunities for all. Thank you very much!