Diving into CS50: A Journey from Scratch to Abstraction

Zheyu ZhangZheyu Zhang
6 min read

๐Ÿ‘‹ Hello tech enthusiasts! As I embark on the enlightening path of CS50: Introduction to Computer Science, I'm thrilled ๐Ÿ˜„ to share with you my insights from Lecture 0. For those unfamiliar, CS50 is a renowned course from Harvard University ๐ŸŽ“ that introduces both majors and non-majors to the world of computer science and programming.

๐ŸŽ‰ Welcome to CS50! ๐ŸŽ‰

The journey begins with an assurance: CS50 is not just about coding ๐Ÿ’ป. It's about problem-solving, an empowering skill that's widely applicable beyond just this course. We're all starting somewhere, and while the learning curve may feel steep, remember that it's more about personal growth than meeting a set standard.

๐Ÿ” What Lies Ahead ๐Ÿ”

CS50 promises to be a transformative experience, not just in terms of programming knowledge but also in shaping a holistic approach to problem-solving and critical thinking. Here's a glimpse into what lies ahead:

  • ๐Ÿ“š Foundational Knowledge: Prepare to gain a broad and robust understanding of computer science and programming. This course is not just about learning a programming language; it's about understanding the foundational concepts that underpin the entire field.

  • ๐Ÿค– Algorithmic Thinking: The ability to think algorithmically and solve programming problems efficiently will be a key takeaway. It's a skill that transcends languages and platforms.

  • ๐Ÿ—๏ธ Key Concepts: Dive deep into essential concepts like abstraction, algorithms, data structures, encapsulation, resource management, security, software engineering, and web development. These concepts form the bedrock of any advanced study or profession in computer science.

  • ๐ŸŒŽ Multilingual Proficiency: Familiarize yourself with a plethora of languages. From the structured world of C to the versatility of Python, the query capabilities of SQL, and the front-end magic of JavaScript, CSS, and HTML, you'll be well-equipped to tackle diverse challenges.

  • ๐Ÿ‘ฅCommunity Engagement: Engage with a vibrant community of like-minded learners spanning different levels of experience. This community will be your support system, sounding board, and source of endless inspiration.

  • ๐ŸŒ Real-world Application: The problem sets you'll tackle are inspired by real-world domains, including biology ๐Ÿงฌ, cryptography ๐Ÿ”’, finance ๐Ÿ’น, forensics ๐Ÿ”, and gaming ๐ŸŽฎ. This ensures that your learning is grounded in practical application.

  • ๐Ÿ† Capstone Project: Culminate your learning journey by developing and presenting a final programming project to your peers. This will be a testament to your learning, growth, and the skills you've acquired.

๐Ÿ’ก The Essence of Computational Thinking ๐Ÿ’ก

At its core, computer programming is all about transforming input into output. Think about taking attendance or counting numbers. We learned how computers use a binary system, consisting of ones and zeros, to represent everything โ€“ from numbers to letters and even emojis.

Algorithms: The Heartbeat of Solutions

How would you find a name in a phone book? Sequentially flipping pages, or perhaps a more strategic approach? These different methods, called algorithms, have their own efficiency metrics. For instance, the first algorithm, highlighted in red, has a big-O of n because if there are 100 names in the phone book, it could take up to 100 tries to find the correct name. The second algorithm, where two pages were searched at a time, has a big-O of n/2 because we searched twice as fast through the pages. The final algorithm has a big-O of log2n as doubling the problem would only result in one more step to solve the problem. From linear searches to logarithmic ones, the art of choosing the right algorithm is central to problem-solving in computer science.

big o notation

๐Ÿ“ Pseudocode: The Blueprint of Programming ๐Ÿ“

Before diving into the syntax and intricacies of any programming language, it's often helpful to draft a high-level representation of your logic. This draft, called pseudocode, allows you to focus on the logic and flow without getting caught up in specific syntactical details.

Consider, for instance, the algorithm of searching for a person's name in a phone book:

1 Pick up phone book

2 Open to middle of phone book

3 Look at page

4 If person is on page

5 Call person

6 Else if person is earlier in book

7 Open to middle of left half of book

8 Go back to line 3

9 Else if person is later in book

10 Open to middle of right half of book

11 Go back to line 3

12 Else

13 Quit

This pseudocode beautifully illustrates a binary search approach, where we keep halving our search space until we find the desired name in the book or quit .

Upon closer examination of this pseudocode:

  • Functions: Some of these lines begin with verbs like "pick up", "open", and "look at". In programming, actions or operations are often encapsulated into what we call functions. These become the building blocks of our programs.

  • Conditionals: We notice the usage of statements like "if" and "else if". These play a pivotal role in decision-making within our code and are aptly named conditionals. They dictate the flow of execution based on whether certain conditions are met.

  • Boolean Expressions: There are specific conditions, such as "person is earlier in the book", which evaluate to either true or false. Such expressions are termed boolean expressions, and they form the crux of decision-making in programming.

  • Loops: Lastly, directives like "go back to line 3" indicate repetition. In formal programming, structures that allow us to repeat certain operations are termed loops. Loops enable us to efficiently perform repetitive tasks without having to rewrite the same code multiple times.

Pseudocode, with its simplicity, reveals the foundational concepts that underpin all of programming. It's a stepping stone towards writing efficient, effective, and error-free code.

๐Ÿพ Taking the First Step with Scratch ๐Ÿพ

MIT's visual programming language, Scratch, offers a fun and interactive introduction to programming. Using drag-and-drop blocks, we learned how to make programs interactive, respond to user inputs, and even integrate video sensing.

scratch interface

scratch coordinate system

๐Ÿ” Abstraction: Simplifying Complexity ๐Ÿ”

Abstraction is a core concept in computer science that revolves around simplifying complex problems by breaking them into more manageable sub-problems.

For example, if you were hosting a huge dinner for your friends, the problem of having to cook the entire meal could be quite overwhelming! However, if you break down the task of cooking the meal into smaller and smaller tasks (or problems), the big task of creating this delicious meal might feel less challenging. You could focus on preparing the starter, then the main course, followed by the dessert, instead of being daunted by the entire feast at once.

In programming, abstraction helps us manage complexity by allowing us to focus on high-level functionalities without getting bogged down by intricate details. It's like looking at the bigger picture while having the ability to zoom into details when needed.

In Conclusion

CS50 promises not just a deep dive into programming but an enhanced way of problem-solving. As I progress through this course, I'm excited to continue sharing my experiences, insights, and discoveries with all of you. Here's to a journey of growth, challenge, and endless learning!

0
Subscribe to my newsletter

Read articles from Zheyu Zhang directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Zheyu Zhang
Zheyu Zhang

Here i will show you guys my programming Journey !!!