ruju11235 / csp

Small programs using the JavaScript syntax. I'm just starting to learn :)
0 stars 1 forks source link

Introduction

I am just beginning to learn computer programming. With the advent of AI (typically used as a marketing buzzword, although it may be serious), not many people want to learn to code. But I want to do it for the fun of it. I am a high school student now (September 2024).

I was not attracted to coding initially. But I am learning it a little more with my dad. He is a computer programmer. I am also appearing for CollegeBoard's AP CSP exam. It may not be such a good idea, but one should learn to walk before running.

My dad's focus is on showing me the beautiful parts of coding. He thinks that programming is a way of thinking.

He may be right.

Some Ideas

We use our words to express ourselves in writing. Since we use text in it, coding is a form of writing. We strive to express ourselves clearly while writing anything. So should it be with coding. My dad believes our computer programs should be for humans to read and only incidentally for computers to run. We must strive for clarity.

He steaches me to code. Steaching, yeah, I know, that's not a word, but he is a steacher. Steaching is a portmanteau of Studying and Teaching. He thinks that he is the student of the subject matter and a student of his student before he can think of teaching.

In one of our first conversations about AP CSP, he told me about the great mathematician Vladimir Arnold. Arnold believed that mathematics was a branch of physics where experiments (or apparatus) were cheap. My dad thinks that one can say that of programming as well.

Nowadays many students have a phone and a laptop. I know that is a luxury for many, but a reasonably powerful laptop or desktop has become cheap enough for a middle-class student to afford. Once you have a computer, you can experiment a lot with your programs. Most of the software required to run your little programs is freely available. We don't always realize this, but that gives a programmer immense power. GitHub, the website on which you read this README, helps programmers organize their programs for free. This is a big help! I hope it continues to remain useful to everyone.

In summary, I am going to try to learn to program by writing a lot of programs.

Environment

My dad struggled to find the right environment for me to code in. He's a minimalist. On one 4' x 6' blackboard, we wrote everything ("abstraction", basic data types, if-else, while/until, lists, imperative vs. functional programming) he thought should enable me to write sophisticated programs.

I like that idea. Use simple tools and a simple setup to express yourself clearly in your programs. Avoid the clutter and complicated machinery.

After a lot of emotional turmoil, he chose JavaScript and Node.js. This may not be the best choice. Here is how we arrived at this decision:

  1. Use a Linux machine. I was already familiar with it.
  2. Use Chrome DevTools as the IDE. I'd write my programs on the Chrome DevTools Sources tab. This avoids having to learn yet another IDE. I am already familiar with Chrome.
  3. Initially he thought of the advice that he heard from Doug Crockford: Use the <src="script.js"> in an HTML file. You may find this idea used in the previous commits of this repo.
  4. That results in too much to learn besides vanilla JavaScript. So, he abandoned the idea. Choice of JavaScript, he thought, would be strange, but we are only using a (very) small subset of JavaScript anyway.
  5. Then he recalled that Node.js is available for standalone JavaScript programs! That way, I could just create my JS files and then run them using the node file.js command! We installed node.js on my laptop.

So, my workflow is simple:

  1. Think of programs to write or receive programming assignments. No program is stupid. Programming is a newfound hammer; everything should look like a nail!
  2. Clone/pull this repo from GitHub. Learn git and back up the code.
  3. Open the cloned repo in the Chrome DevTools Sources tab as my workspace.
  4. Write programs and save them.
  5. Run/test them on a terminal using the node file.js command. Fix bugs. Improve. Commit and push to GitHub. Write good commit messages.
  6. Go to 1 if not tired, go to 7) otherwise.
  7. Go for a run maybe?

I hope my interest in programming remains even after the AP CSP exam. Wish me luck!