Thursday, October 15, 2020

Learn to Code: For Girls

 I think that everybody needs to learn to code. That includes girls or depending upon their age, women. And there is quite a few people who agrees with me, considering the number of organizations devoted to either teaching girls to code, or at least heavily involve them. All that is good.

I started having trouble accepting them, however, when I see the course materials. It seems that the lessons aren't good for girls at all. In fact, I think that most of these classes, the course materials is rather alienating girls who code. Not that I think they do it on purpose, but that I think that they don't know any better. The only exception I can think of is Carrie Ann Philbin Geek Gurl Diary, where the topics presented are suitable for girls. 

I think the reason for this ignorance is because, well, ignorance. STEM is very popular program, and rightly so. It brings the nerdiness of engineering into the masses. That's a good thing. The problem is in the execution. It focuses on STEM and ignore everything else. I'm sure Dean Kamen, the creator of STEM, would have done differently had he not been such a nerd. A super genius nerd at Einstein level, to be sure, but a nerd nonetheless.

Here's what's needed to bring girls into Coding: STEAM. It stands for Science, Technology, Engineering, Art, Math. Art is very important for girls. I still remember Wolfram presentation, TED, I believe, where he presented his daughter's code for Polygonation of a Circle, or something like that. I was struck by one part of it where you can choose the color of the circle. Wolfram said, "yes, that's important," How can color be an important element in doing what is basically Learning Calculus? Answer: she's a girl!

No man will want to buy a shirt in every color. When you mention that somebody wants to buy a dress/bags/shoes in every color, what are the chances that such person is male? female? You guessed it: female.

There in lies the problem of teaching STEM instead of STEAM. Girls just aren't interested in learning Calculus. They may learn it, but they're not interested in it. So, what's interesting for girls? Art. That means products. Things that they can make and use and show off to other people. Without it, there's just no motivation. Before you complain, let me say that money isn't a good motivation. It's good to have it, but only up to a point.

James Damore noticed the problem. He wrote a paper about it, and was fired for his trouble. That's a bad move. It's not that James Damore is perfect. I think the paper could have been written in a more accesible way, gentler, more accomodating to the reader. However, the issues he raised are important, and deserve scrutiny. Wihtout people like him, there's just nobody to recognize the problem and thus the problem will go unsolved. Google's firing of James Damore does nothing good for the women at Google. Preach Diversity all you want, the proof is in the pudding. Has the situation regarding female coders improved? Or are they keep getting cycled over, with high turnover rate? There you have the answer.

So, when somebody ask me why girls don't code, I'd answer with a question: "Why would they want to?" This has been taken as insult, whereupon they then do ad hominem or personal attack upon me. And yet, the question is an important one. Why would girls want to code? If the answer is money, then I suggest that a career in financial industry is more beneficial to them.  The correct answer to the question is "because it's fun" or "because I can do great things with computers." So, you see, if the motivation isn't a personal satisfaction and ideals, they are probably good for doing something else, and that's true regardless of gender. Males who concentrates on getting tons of money coding aren't doing so good, either.

At this time, I need to make some generalization regarding sex differences, and that has been used as an excuse to censor me somewhat. But the distinction is important: when I say that these things are generally true, it means that there is an overlap in actuality, but that those things are generally true. Males and females aren't the same. For example, if they watch a popular movie that both agree are good, and asked what's so good about the movie, then males tend to focus on the action sequences, where as females tend to focus on the acting. Ignore that, and you will fail to create an environment where females prosper. That's why people like James Damore are so important, not because the paper he wrote are so righteous, but because the issues he raised are crucial in recognizing the problem, and give hints as to how to go about solving the issue. If you are unwilling to even acknowledge that there is a difference between boys and girls, then your effort is bound to fail.

So, let's get back to the issue of teaching girl to code. What's wrong with them? The idea is correct, even noble, but the execution is very much flawed. You see, when I see the way they teach girls to code, I see them teaching the same way they teach boys to code: Math and plenty of it. Girls don't like math. They don't like puzzles. They like socializing and communication. So, the phrase "In order to be a good programmer, you need to be good at Math" is certainly uttered by male computer programmers. Female tend to be on the communication side. Grace Hopper:"Here is FORTRAN so that you don't have to worry too much about machine language and have an easier time programming the computer using a language that people can use easily!" See the difference?

I don't believe that anyone would argue that Grace Hopper is a bad coder, nor Ada Lovelace for that matter. But I just don't see the acknowledgement that their skills lies not in coding, but in language. Ada Lovelace just happens to be good at math, but when she wrote down her programs, it wasn't in machine code. It was in a form that people can read. That is the difference. One is focused on Math; the other, Language.

I would like to see a change in the course of materials in teaching girls to code: Less Frogger and Flappy Bird. More IF and RPG. Basically, less single player action game, and more story-based multi-player experience. Until that is done, there's just no good answer to "Why would girls want to code?"

If you really want to have girls to enjoy coding, and therefore code for life, then it will takes more than just having Flappy Bird with Bow, or Frogger in every color. Therefore, figure out what girls want, and then give it to them. It's that simple.


Tuesday, October 13, 2020

Coding Skill for Everybody

There was such time, in the not too long of a distant past of the last century, that it was thought that everybody should have a computer of their own. This was a time where the smallest computer was the size of a refrigerator. It was, of course, by the process of inference, that it was thought that everybody should have a refrigerator, and that it would prove as useful.

Another analogy can be had with a car. A very expensive device that will get you from one place to another. And that is the thing that everybody would do daily. To work, to shop, to do leisure. But isn't it true that not everybody can have a car? Still, it is the idea that everybody can have a car that is important.

Now, a refrigerator or a car is a rather complex device to build, yet so easy to operate. In fact, that is the matter of great consideration when trying to increase the adoption rate for a particular device.

Nowadays, we have extremely powerful computer no bigger than our hand. A smartphone, we call it. It wakes us up, it shops, it gives direction, it answers our most trivial whimsy. It also lets up talk to other people not in our immediate vincinity. In short, it's a miracle device, equivalent to the most powerful wizard's wand.

But is it easy to use? Yes, it is. Buttons are plenty. All you have to do is point and click. Or in sufficiently advanced technology, spoken words may be used since these devices feature voice recognition technology. So, indeed, it is very easy to use. In my cynical mind, too easy, as those accidental purchases of goods may attest.

How about creating them? Just as it is extremely difficult to create refrigerator and cars, it is exceedingly difficult to create computer programs. We have to use something called "The Command Line" to do our bidding. There, there is only dark void awaits us. A little prompt in otherwise blank screen. Nothing there helps us to prepare to use its capabilities to the fullest.

Yet, it is more powerful than ever before. You can do much more, much faster than what is posible by pressing buttons. You can even chain commands using "pipes" as data flows from one process to another. This is a very powerful and convenient way to create programs.

But nothing much came out of it for one simple reason: Very few people know what to do. It's just a simple blank screen with nothing to guide you to achieve what you want. You have to familiarize yourself to the task. That endeavor requires much learning, studying thick tomes full of arcane knowledge. 

Why would you want to spend a lot of time learning these difficult things? It would be so easy to just take the ignorant way to do things and just use the pretty icons interface. And yet, there in lies the deception of the whole thing! It's not difficult to do!

If you can imagine, little bits of icons, each doing their own little things. Each can be connected to other little icons. Give them some custom parameters in order to use them. Well, it's easy to do, right? However, it will be overwhelming once you get so many of these little icons, that you are having to keep track which icon does what. So, you write little bit of text to differentiate from one icon to another. Words emblazoned on the icons.

What I've described to you, of course, is the equivalent of kanji and roman alphabet (romaji). Kanji are notorius to learn properly. Yet, people say that drag-and-drop language is the future. Yet, here we are, sitting before our QWERTY (or DVORAK) keyboards, typing one word after another.

So, what does it take to have everybody to learn to code? The same way we learn to speak languages: Vocabulary, Grammar, Sentence structure, and the Communication of Ideas. In other words: Communication skills.

For as long as people think that in order to code a program, you need to be good at math, coding will never be a common skill. It is not the math skills you need, but the communication skill.

Learn to communicate. Learn to Code.



Sunday, October 11, 2020

How to Code PNG? FAIL!

 PNG stands for Portable Network Graphic. It was a mystery to me then, and it is a mystery to me now. The problem lies in the compression method. The PNG standard specifies compression as a necessary element. Specifically INFLATE/DEFLATE method. If you want to store uncompressed data, you need to use the uncompressed data block of DEFLATE method.

I was shocked to see that in PNG specification. Common sense design means that uncompressed data should be included in the specification. That way, you can implement the program to deal with the simple case before investing in further effort. 

So, what's the problem? The fact that the compression/decompresion algorithm isn't part of PNG standard means that there is a dependency that is needed to be resolved before I can code my own PNG encoder. That's bad.

Especially since the reference for such code is located in some FTP site, and it was busted. I don't think the site even exists anymore. Hence, broken dependency. All I know about the algorithm is that it is a variant of LZ77 with Huffman encoding, which can be extremely varied depending upon implementation. How am I supposed to implement PNG program?


I am aware that there is a PNG lib somewhere out there. I'm not using that. I want to code it from scratch. That way, I know that the specification is good. The way it is now, the specification is no good. It is too complicated and incomplete. There is no way to specify multiple images, for example. 

I suspect that I should just abandon the endeavor entirely, and focus on improving something easier to do, such as PBM, Portable BitMap format.

Thursday, October 8, 2020

Perl is Write Only?!

There are way too many Python users who bad mouth Perl scripting language, including Mark Lutz, the author of Learning Python. In fact, he took every opportunity in that book to disparage Perl so much that it left a bad taste. If he spend so much effort discrediting Perl language, then it must be because it's so good, that in order to make Python a better language than it is, Perl needs to be taken down. Which is not only stupid, but incredibly harmful, that I wonder why O'Reilly, the publisher of Learning Perl would put up with it.

I certainly wouldn't put up with such destructive comment, even if they're true. They aren't true. Half of the criticism levied to Perl isn't true, and the other half ... also applies to Python! How's that for self-destructive behavior?

I'm going to focus the on one criticism that has been applied to Perl in this post, that is the claim that you cannot read the code after 6 months has passed. There are several considerations:

1. It's a complicated algorithm. No matter how clean the language is, if your program is full of regex manipulations, people who aren't comfortable handling them will have trouble.

2. Advance features. Perl has several variables worked on behind the scene. That is, you don't necessarily see the variables being set. One regex operation sets up so many different variables all at once, and unless your Perl skill is top notch, then you're going to be confused.

3. You have spaghetti code. Perl is linguistic, and so, extremely natural to write. However, it does mean that it allows you to express your ideas anyway you choose. If your linguistic skill is subpar, then yes, you will have trouble reading the code afterwards.

4. Shorthand coding. Interestingly, Perl also allows you to code very densely. This is similar to C programming language, where although you can write in clear formatting style, the high density style marks you as expert programmer and should be sought.


So, now that you know the reasons why Perl code can be hard to read, what can you do about it? 

1. Well, you can pick up Python, or BASIC. Yes, BASIC. No, I'm not kidding. There's no reason why BASIC needs to be slow anymore, and besides, Python isn't known for speed either.

2. You can write in clear style formatting. Perl and C lets you write in however coding style you choose. Simply write in clear, well documented manner, and you should be fine. More importantly, those maintenance programmers who will come after you, who has never seen your code, will be able to read and understand your program quickly, easily, and effortlessly.

3. Write a Design Document! This is one of the biggest fail of computer programmers. In professional programming environment, I always write the Design Document. That's because it's essential to have it. Just because the source code is readable, doesn't mean that you can skip writing the Design Document. So, you write the Design Document that tells the reader what your program is doing, in plain English. There wouldn't be any confusion at all. Then you figure out what the Perl code would look like, which will be instantenous if you know what you're doing. If not, then your Design Document is faulty, and needs a rewrite. How do you know your Design Document is good? Once you figure out how to code it in Perl, simply look at the source code and you should see the exact code already there. Hence, no confusion.


Most people would choose option 1. I chose option 2 and 3, and I can tell you from experience that I never had any trouble reading my source code many months or years later, simply because I have no problem reading the Design Document. You don't need to be a coding hero if you have good Design skills.

Why is learning Python a bad thing? Learning Python is not a bad thing if that's what you want. If you need structured coding to be imposed upon you, then by all means, use Python. But that doesn't mean that you can put down other languages that are very expressive and fluid in their coding, just because those languages do not impose structure upon you. Some of us are highly disciplined coders, you know? The more you complain that Perl is Write-Only, the more you tell me that you do not have good design skill and coding discipline necessary to write high level or high standard computer programming.

I will also mention that a lot of Python coders aren't really coders when all they do is glue library functions, but that's topic for another day.


Tuesday, October 6, 2020

Your First Programming Language

 So many people want to learn how to program the computer. The inevitable question is: what should your first computer programming be? And if you can only learn one computer programming language, what should it be?

Anytime somebody asked me that, the answer is obvious: BASIC. It stands for Beginner's All-purpose Symbolic Instruction Code. That language is _designed_ for beginners! And it works. The old computers from 8 bit era all feature BASIC as the default programming language. Microsoft has a lot to do with it. It is not, however, the only version. And that's where trouble lies.

You see, it's not that BASIC is slow or limited. Some dialects of BASIC are very fast and powerful. The slowness with BASIC is a myth. Old style BASIC is slow because old computers are slow. In fact, modern languages such as Python can even be slower than BASIC! Just make sure you use compiled BASIC versus Intrepreted ones.

Today's modern languages are quite powerful, and that includes BASIC. Modern BASIC has structure. They are no longer the flat style coding language of the past. It hasn't been like that for decades. Why do people still hate them? There's absolutely no reason to do so, nowadays.

Should everybody learn BASIC? I think so. The next natural question then becomes, of all BASIC language dialects, which one should your learn? And that question, I cannot answer. I rather like SmileBASIC 3 for Nintendo 3DS. There is SmileBASIC 4 for Nintendo Switch, but I cannot recommend it because I think it's too powerful, not so friendly to beginners. But Nintendo 3DS is on the way out, you say? Well, yes. So I cannot recommend SB3 either! 

Is there a standard version of BASIC? There is Posix BASIC, but it's too primitive, so definitely cannot be recommended. There's GameMaker and Scratch, but support for non mainstream computer platform is weak. QB64 is a Microsoft compatible BASIC, and you should look for it. But in all, there is no Universal BASIC version that I can recommend right now. As a lover of BASIC programming language, this disheartened me.

Why should beginners learn BASIC? Well, it's easy to learn, and that's good for beginners. Any other languages is too complicated for beginners. Do you know that O'Reilly book Learning Python is about 1500 pages? How is that suitable for beginners? It's not suitable at all! Maybe version one is doable, but not version 3! How long does it take to learn BASIC? In my case, 3 hours by reading a book. About the same amount of time for me to learn HTML 2.0. Scratch? It's practically instantenous! I simply looked at the shapes, drag and drop, and there you go. Instant. No learning curve whatsoever.

Is there a reasonable powerful computer programming language today, that is reasonably supported across multiple platforms? Well, there's one: Processing. I love the language, but not the name. Trying to research "Processing" on Google yields so many hits on data processing. But the language is good. I recommend looking over Dan Schiffman wonderful YouTube video series for you to learn the language features. It's too nerdy for me most of the time, but sometimes, it's something accessible for me, too. Highly recommended.

Processing is good because it's based on Java, and it runs anywhere Java runs. In fact, you can compile Java code, which is necessary to unlock the powerful features of computer programming. So, that's my recommendation. It's easy to learn, powerful, and compatible with a lot of platforms, especially considering P5.js and other extensions.

If you can only learn one programming language, should it be Processing? Well, no. I mean, there's nothing wrong with learninig Processing. In fact, I believe it can get you far. However, it is not the most powerful language available. The generally accepted powerful language that is quite fast is C++. I happen to disagree. I prefer C language. I don't think you should learn C language as a first language, or the second for that matter. For your second programming language, better learn some scripting language: Perl, Python, or Ruby. Your choice. I prefer Perl. I learned it in a weekend, by reading a book!

But if you can only learn one computer programming language, then Processing is a good choice for general purpose programming. Beyond that, learn PseudoCode. That's Design and Algorithm. You want to hone your design skill. The sad fact is, that computer languages come and go. Sure there are companies that still uses Fortran or Cobol. C, C++, or Objective C. But most people have moved on. Nowadays, it's Java and Python, but don't bet on these to stay forever. Perl and PHP was once everywhere. People kept looking for more features, more power, more speed, until the language morphed into a monster that is no longer suitable for beginners, and so, the language slowly becoming obsolete, to be replaced by better, more streamlined, more promising programming language.

There is only one language that is not obsolete: English. That's PseudoCode. Learn that, and you can code forever. Even if the specific program features has changed, unless it's something weird, such as LISP or Prolog, once extremely promising ways to program your computer, you can probably depend on your design to stay relevant. I include Python as one of the weird one. Python strings are immutable. I understand the reason why that's done is because it's object oriented language, and a great benefit for garbage collection algorithm, but it dooms string processing algorithms to a crawl. Unfortunately, most of my algorithm depends on arrays and strings, so yeah, Python is too slow for me. Rather unfortunate.

In conclusion: Learn Design skills. You don't need to be a coding hero if you have good design skills. Design is always relevant, and works across many platforms. You still need to learn some kind of computer programming language, just to prove that your design is solid, but that's about it. That's all you need. That's the only computer programming "language" you need to learn.


Sunday, October 4, 2020

Learn to code at 50?

Is it too late to Learn to Code when you're past 50 years old? Well, I'd say that it depends on what you want to do. If what you want to do is to work as a coder for somebody else, then I'd say that you're facing an uphill battle. Chances are against you.

If, however, what you want is to build your own tools for your own personal use, then I'd say go for it! Coding really isn't that difficult. If you're dealing with modern computer programming language such as Python, Java, or C++, then you may wonder if coding is easy. However, if you're coding with simple languages such as BASIC, C, or Processing, then you will find that coding isn't that big of a deal. 

In fact, it would be more difficult to fight the perception that those computer languages are obsolete than it is to learn to code them. If you're having trouble finding coding examples in those languages, then, yes, it can be very difficult to learn. But that's where you're suppose to go to the Internet or other communities, whether it is local or on-line, and seek help.

The best language to code? Pseudocode. That's basically English or whatever your native language happens to be. It's very important to be able to design your program properly than to code it properly. Certainly there is a fair share of coders who is arrogant and claim that you need their expertise in doing so, but I disagree. If you design your program well, you can simply hand over your design, in English, to any development house and they'll do it for your, quickly and efficiently. Whereas if you hand them bad or incomplete design, then there'd be a lot of time and money involved, and the project completion is not guaranteed.

You don't need to be a coding hero if you have good design skill.


Friday, October 2, 2020

How fast should your computer be?

 Many people are still talking as if computer needs to be faster. I'm curious as to how fast they want their computer to be. The truth is, I would have been perfectly happy with Raspberry Pi Zero W, if only newer programs do not assume that the computer they run on have access to gigabytes of memory.

As Raspberry Pi community shows, it has been quite usable on retro computing emulator. I have been reading a lot of old magazines lately, and what I saw really surprised me. It turns out that a lot of those old computers, by which I mean having less than 64 kilobytes of memory, had a far more ranging application than today's super computer. 

Naturally, they would do it in little pieces, and slow, and extremely cumbersome. However, the application of their uses is wide ranging, and practical. Perusing Raspberry Pi Foundation blogpost, I see very little that interest me. I suppose those applications are cool enough, but what would I do with robots and stuff? It's like nobody is interested in office application anymore. And yet, those are where computer users can do the most good.

It reminds me of the phrase, "That's cool, but what does it do?" In other words, what do you get out of it, other than games?

I do wonder how we get to become this way. I still remember the old Palm Pilot PDA. Compared to WinCE rival of the day, Palm devices are rather underpowered. Yet, they are very convenient to use. That's because the User Interface took into account the slowness of the CPU and changed the program behavior accordingly. For example, all the searches only search the beginning of the word, unlike other searching routines of the time where you can search text in the middle of the word. 

In so many words: What are you using your computer for? I'd rather have a slow, cheap computer with great UI instead of super computer with bad UI. If you design your programs right, you can create a good workflow, and therefore you don't need some super computer to do simple tasks. Sure, the program will look rather ugly, but if all you can afford is some cheap $10 computer and no software, you can still use it to do your daily task.

I have said this before and I will say it again: " You don't need to be a coding Hero, if you know the principles of good Design." When I design my programs, I always consider the cases where the amount of data overwhelm the program. What happens then? This is something that is missing from today's computer programmers. Partly because not many problems will choke super computers nowadays. Partly because, if they do, there's nothing they can do about it, having built their programs with a collection of third party libraries.

Learning to code is more than just writing a program that works. It is also about having a good design, so that the program will be an absolute joy to use. This needs more learning.