Image for post
Image for post

Let That Be Your Last Battlefield

Okay, I stole the title from a Star Trek episode. So sue me.

For the past three years, Medium has been my battlefield for waging a campaign to promote the Smalltalk programming language. It has served me well but I’m tired of blogging, so I shall retire from this.

I shall, however, continue to answer questions on Quora, especially those that relate to programming languages and Smalltalk. This article will show highlights from Quora where I’ve left indelible marks.

The first question contains my stock answer for all beginners who ask how to learn programming:

Quora: What’s the best programming language to start with?

Answer: First, start with a good teaching language. It is folly to start with an industrial language like Java, Python, JavaScript, C, Swift, etc. Industrial languages carry a lot of baggage that can distract a beginner who should be focussed on learning basic programming concepts, NOT on their starting language’s quirks and oddities.

Second, for your chosen teaching language, follow a language tutorial or two in order to get warmed up. You may also take a look at the language reference to familiarize yourself with the language, a bird’s eye view.

Third, do a number of programming exercises, things like sorting routines, search algorithms, computing Fibonacci numbers, etc.

Fourth, start writing small programs to do simple tasks. Work your way up to larger software projects. Remember, the key to learning programming is practice. Lots and lots of practice writing software.

To be honest, there aren’t very many good teaching languages. I can only think of Basic, Logo, Pascal, Scheme, and Smalltalk. Of these, I most highly recommend Smalltalk.

For one thing, Smalltalk was designed by Alan Kay and his team at Xerox PARC for teaching programming to children. That’s a fine pedigree.

For another, the language is supremely simple and easy to learn. It only has six reserved words! The complete syntax can fit on a post card.

Image for post
Image for post

And yet, Smalltalk is unbelievably powerful. Read Why Pharo Might be the Future of Software Development.

After you’ve learned Smalltalk programming, picking up subsequent languages like Java, Python and JavaScript is a breeze. That’s because you now have a solid foundation.

Here are some great resources:

This book (not free) is my favourite for learning how to use Smalltalk for object-oriented programming: Smalltalk, Objects, and Design, by Chamond Liu.

I myself have published a whole bunch of Smalltalk tutorials. The latest ones are:

Good luck.

Quora: Why did Smalltalk become popular in the 1980′s and the 1990′s and Lisp never did?

Question details: Both are ancient languages, Smalltalk coming out in 1972 and Lisp in 1958. In the 1980s, Smalltalk emerged as a prominent OO language and its popularity peaked in the 1990s. Lisp, on the other hand, was relegated to AI development and was subsequently ignored in the “AI winter.” Only in recent years has Lisp returned in the guise of Clojure, but Clojure is nowhere close to being mainstream. What gives?

Answer: It’s quite simple, really. Which would you rather read, this:

Integer extend [
millerRabinTest: kl [ |k| k := kl.
self <= 3
ifTrue: [ ^true ]
ifFalse: [
self even
ifTrue: [ ^false ]
ifFalse: [ |d s|
d := self - 1.
s := 0.
[ (d rem: 2) == 0 ]
whileTrue: [
d := d / 2.
s := s + 1.
[ k := k - 1. k >= 0 ]
whileTrue: [ |a x|
a := Random between: 2 and: (self - 2).
x := (a raisedTo: d) rem: self.
x = 1
ifFalse: [ |r|
r := -1.
[ r := r + 1. (r < s) & (x ~= (self - 1)) ]
whileTrue: [
x := (x raisedTo: 2) rem: self
x ~= (self - 1) ifTrue: [ ^false ]

1 to: 1000 do: [ :n |
(n millerRabinTest: 10) ifTrue: [ n printNl ]

Or this:

(defun factor-out (number divisor)
"Return two values R and E such that NUMBER = DIVISOR^E * R,
and R is not divisible by DIVISOR."
(do ((e 0 (1+ e))
(r number (/ r divisor)))
((/= (mod r divisor) 0) (values r e))))

(defun mult-mod (x y modulus) (mod (* x y) modulus))

(defun expt-mod (base exponent modulus)
"Fast modular exponentiation by repeated squaring."
(labels ((expt-mod-iter (b e p)
(cond ((= e 0) p)
((evenp e)
(expt-mod-iter (mult-mod b b modulus)
(/ e 2)
(expt-mod-iter b
(1- e)
(mult-mod b p modulus))))))
(expt-mod-iter base exponent 1)))

(defun random-in-range (lower upper)
"Return a random integer from the range [lower..upper]."
(+ lower (random (+ (- upper lower) 1))))

(defun miller-rabin-test (n k)
"Test N for primality by performing the Miller-Rabin test K times.
Return NIL if N is composite, and T if N is probably prime."
(cond ((= n 1) nil)
((< n 4) t)
((evenp n) nil)
(multiple-value-bind (d s) (factor-out (- n 1) 2)
(labels ((strong-liar? (a)
(let ((x (expt-mod a d n)))
(or (= x 1)
(loop repeat s
for y = x then (mult-mod y y n)
thereis (= y (- n 1)))))))
(loop repeat k
always (strong-liar? (random-in-range 2 (- n 2)))))))))

CL-USER> (last (loop for i from 1 to 1000
when (miller-rabin-test i 10)
collect i)

It comes down to syntax and readability. Lisp advocates insist that Lisp isn’t hard to read if you do this and if you do that, but they’re just making excuses. In point of fact, most people dislike Lisp syntax and there’s really very little we can do about it.

Also, when Smalltalk emerged, object-oriented programming (OOP) captured the imagination of the programming community in a way that Lisp and functional programming never could. OOP promised a better way to manage program complexity, and to help make code more maintainable and more scalable. What did Lisp promise? Homoiconicity and powerful macros. That’s not very catchy.

In other words, Lisp was, and still is, a hard sell.

Interesting factoid: in the 1990s, Smalltalk became the most popular OO language after C++. Here are the OO language market shares from a 1995 IDC report:

  1. C++ — 71.3%

Not too shabby! There’s no reason why Smalltalk can’t be yet again popular, especially with the release of Pharo, a Smalltalk modernized for the Twenty-First Century. Read Behold Pharo: The Modern Smalltalk.

Quora: Will the Nim and Crystal programming languages replace Java, Golang, and C# in the future (next decade)?

Answer: That’s what fans of these languages are hoping, of course. But hope is not predictive. Hope does not determine the course of history.

Hard work does. Advocacy and promotion do. Building up a healthy ecosystem does. Creating “killer” applications, if possible, would as well.

Note that Nim and Crystal are hardly alone in this dilemma. There are any number of language upstarts vying for public attention and support, for example:

  • Pharo (see Why Pharo Might be the Future of Software Development)

The odds against Nim and Crystal are enormous. Would you care to place a bet with your Las Vegas bookie?

Quora: As senior web developers, what is one thing you wish you had known when you were starting out?

Answer: If I had known 10 years ago when I started web development what a huge clusterfuck it would become today, I wouldn’t have continued in this field.

Ten years ago, JavaScript was still a bit player in web development, largely ignored or reviled. Then Node came along in 2009 and JavaScript took off. Thereafter, a slew of front-end web frameworks broke out…Backbone (2010), Knockout (2010), AngularJS (2010), Ember (2011), Meteor (2012), React (2013), etc.

Today, there are dozens of JS web frameworks vying for top spot. It’s like the bloody Hunger Games of web development! It’s ridiculous. Everybody is suffering from “framework fatigue” and “choice paralysis.”

And now Vue is trying to unseat React. These frameworks have the lifespan of a fruit fly!

As for JavaScript itself, instead of fixing its numerous WATs and WTFs that have made the language the butt of jokes for years, ECMA TC39 have chosen to pile on feature after feature like there’s no tomorrow. ES8.0, for example, has a language spec of over 885 pages! I kid you not.

In a desperate bid to avoid JavaScript, tons of transpiled languages have emerged, starting with CoffeeScript in 2009. There are many excellent choices such as ClojureScript, Dart, Elm, Haxe, JSweet (Java), Opal (Ruby), PharoJS, Scala.js, Transcrypt (Python).

There are countless thousands of npm packages, most of which are pure, unadulterated garbage. It’s really hard to separate the wheat from the chaff. Moreover, with their intricate interdependencies, the web is like a house of cards that can collapse at any moment with a single errant package. The most infamous example is the “left-pad” debacle.

I’ve tried to stay sane by sticking to one backend language (Pharo) and one web framework (Teapot) and one frontend language (PharoJS, no framework required!). I’ve tried to avoid using JavaScript as much as I can.

Yes, I wish I had known all this 10 years ago.

Image for post
Image for post

Quora: Why has C (programming language) been in use for 35 years, yet it’s fresh as a daisy?

Answer: “Fresh as a daisy,” it is not. C is an archaic language. Who does manual memory management anymore??? The vast majority of programming languages today have gone to garbage collection.

Who uses header files and preprocessor anymore? These are ancient and crude techniques that few languages care to adopt.

C is a purely procedural programming language. There is absolutely no support for functional and object-oriented programming.

However, there’s no question that C remains a fairly small, light and agile language. Free of high-level encumbrances, C is essentially a portable assembler. At the same time, this language will not coddle you. It won’t do anything to protect you from buffer overruns, segmentation faults, and memory leaks.

It’s like programming with stone knives and bearskins:

Look, I love C. It practically paid for my early retirement as a software engineer (writing device drivers). I owe it a whole shitload of gratitude.

But “fresh as a daisy?” Let’s not go overboard. It remains a very useful language today, and that’s high praise, indeed.

In fact, I count on C when I do Smalltalk programming because Smalltalk by itself provides no low-level or OS access to the host platform. A good example can be found in my programming tutorial: Learn How To Program. If C programming is using stone knives and bearskins, then Smalltalk programming is driving a Bentley Continental GT across the devastated landscape of Scotland:

Quora: Why are people still trying to make breakthroughs in standard code when AI is the way of the future?

Answer: There are several reasons. First, AI that is truly capable of autonomous software creation is still a long ways off. We don’t know how far off. It could be decades, or it could be more than a century. In the meantime, we still have lots of shit to do and we’re not doing it very efficiently.

But make no mistake: programming automation is inevitable. It’s only a matter of time. People who make the oft-repeated criticism that AI has been the future for more than 40 years are overlooking several important points:

  1. Past failures do not predict future failures. If that were the case, we wouldn’t have any progress at all.

Second, it is unlikely that AI will solve ALL of our programming problems. It seems to me that there will always be a need for specialized programming at the frontiers of computing. We may also wish to make room for human creativity in programming.

Quora: What would happen if Smalltalk gain the fame Javascript has?

Answer: Probably a lot of people would crawl out of the woodwork to criticize Smalltalk. Popularity always breeds contempt.

The productivity of software development, on average, would double or triple throughout the entire IT industry. The overall quality of software would likely increase dramatically, as well.

That’s because Smalltalk programmers are happy programmers, and happy programmers produce better outcomes. Smalltalk programmers are happy because their tool is so easy and fun to use, what with the absurdly simple syntax and virtually nonexistent cognitive load.

Image for post
Image for post

Moreover, the tool’s live coding IDE makes them hugely productive. Friction-free programming, I call it.

The ability for Smalltalk to comfortably manage the complexity of large software systems is unmatched by any other language. Java and C++ are massive headaches, by comparison.

Consider this case: one of the biggest Smalltalk success stories is when the U.S. joint military used Smalltalk to write a million-line battle simulation program called JWARS, which incidentally outperformed a similar simulation called STORM written in C++ by the U.S. Air Force. An amazing testament to the capabilities of this language.

Image for post
Image for post

JPMorgan used Smalltalk to write a massive risk management program called Kapital. Orient Overseas Container Lines used Smalltalk to write a global tracking system called IRIS-2.

Finally, programming would be fun again for everyone. They wouldn’t have to use a shit language like JavaScript. They wouldn’t have to wade through the verbosity of Java, or the complexity of C++, or the sloppiness of PHP, or the painful learning curve of Haskell. Smalltalk is easy-peasy, and that’s a Good Thing.

Quora: What’s your favorite obscure programming language?

Answer: Well, it’s not exactly obscure, but it is quite far from mainstream: Smalltalk/Pharo.

It’s my favourite language because:

  1. It’s supremely simple and elegant. It has all of six reserved words! The complete syntax fits on a post card.
Image for post
Image for post

Smalltalk/Pharo is pure programming fun!

Quora: Is Python’s lack of type safety a serious problem for large projects?

Answer: Robert C. Martin (aka “Uncle Bob”) would disagree with the premise that dynamic typing prevents scalability: read Clean Coder Blog. The key is TDD (or Test-Driven Development).

Robert Smallshire demonstrates that static typing makes very little difference to the number of software defects in real-world software projects: watch

Here’s an inconvenient truth: software projects that employ static typing can also fail miserably. But you don’t blame the programming tools, you blame the failure of project management.

It all comes down to project management. Does management know what they’re doing?

Smalltalk, another dynamically typed language, has been used successfully for several decades to write enormous enterprise-scale software with high quality and reliability. Some of the higher profile users include JPMorgan, Desjardins, UBS, Florida Power & Light, Texas Instruments, Telecom Argentina, Orient Overseas Container Lines, Siemens AG, etc.

In my home country, Smalltalk is used by Communications Security Establishment (CSE), Canada’s national cryptologic agency.

In the early 2000s, the U.S. joint military used Smalltalk to write a million-line battle simulation program called JWARS. It actually outperformed a similar simulation called STORM written in C++ by the U.S. Air Force. That by itself is an astonishing testament to the capabilities of the language.

Smalltalk and dynamic typing were so problematic that in the early 1990s, IBM chose Smalltalk as the centrepiece of their VisualAge enterprise initiative to replace COBOL. They could’ve chosen C++. They could’ve chosen Object Pascal. They could’ve chosen Eiffel. They didn’t seem particularly concerned about scalability with respect to Smalltalk.

Image for post
Image for post

There is a great deal of misconception and misinformation swirling around this entire dynamic typing issue. It’s bogus. There is nothing wrong with using Python and Smalltalk for large applications, if you know what you are doing. If you have good project managers who know what they are doing.

Quora: How smart must you be to become a front-end developer?

Answer: Apparently, not that smart, as everybody and their dog is now learning front-end web development.

That’s why there are soooo many crappy JS devs. So many people, blinded by the hype over web development and the promise of jobs, flock to online courses and coding bootcamps hoping to cash in on the web craze.

JS evangelist Eric Elliott has said (and I’m paraphrasing) that 99% of JS devs don’t know what the f*ck they’re doing. He’s being generous.

The fact is, most front-end web developers shouldn’t even be in this profession. If they were to switch to another field of programming entirely, they likely wouldn’t pass muster.

The bar for becoming a front-end dev is too low. We’re not filtering out mediocre minds. Anybody who picks up HTML, CSS, and some JS can call themselves a front-end dev and get an entry-level position somewhere. God help us.

Quora: What information am I missing to understand programming? I am trying to learn programming and nothing seems to make sense and I’m not sure. Why?

Answer: Why? There are several possible reasons:

  1. You have a poor instructor or a poorly-designed course.

Without examining your situation in more detail, it is impossible to say which one it is.

Learning programming means to develop your analytical, logical and creative skills in solving technical problems. You start with small, simple programming exercises such as compute Fibonacci numbers, implement bubble sort, determine if a sentence is a pangram, compute Pascal’s Triangle, etc. Websites like provide plenty of exercises.

Eventually, you work your way up to writing simple programs. This may involve creating a user interface, updating a database, or producing graphical output like a chart or picture. The key to learning programming is practice. You must practice writing programs. The more you practice, the better you’ll become.

Initially, you will struggle as your mind adapts to a new skill. This is true when learning any new skill such as playing piano. Why should programming be an exception?

But if you persist and work hard, you will eventually get it. Not many people can persist.

I can’t give you any tips except for #3. If you’re not using a good teaching language, now may be the time to switch. Honestly, languages like Java, Python, JavaScript, C, and Swift make learning harder than it has to be. Here’s my tip: What’s the best programming language to start with?

Quora: Why does everyone and their momma want to work as a software engineer?

Answer: Because there is a general perception by the public that:

  1. Programming is the key to a lucrative career. There are tons and tons of programming jobs. They’re practically falling off the tree.

It is this kind of hype promulgated by the media and press that leads people to believe this nonsense.

First of all, while there is substantial demand for programming skills, this demand is not typically met by new programming grads with zero experience. There may be tons and tons of programming jobs but most of them are not entry-level positions.

Second, the cold hard fact of life is that there are unemployed programmers. Employment is not guaranteed in ANY profession.

Also, employment depends a great deal on geographical location, the health of the local economy, the amount of competition for jobs, and so on.

Third, programming is not easy. Anyone who says this is an idiot. Whether someone can learn to program depends a great deal on individual aptitude, motivation, persistence and willingness to work hard. To achieve any measure of programming competence requires endless practice writing software. Thousands and thousands of practice hours. This could take years.

Fourth, the possibility of becoming a Silicon Valley billionaire is much like the possibility of winning the lottery. It’s fun to dream but let’s come back down to earth. You are more likely to die in a car accident or gun shooting (U.S. only).

And finally, the programming profession faces serious threats in the future. One is globalization. Many jobs are going overseas because there aren’t enough competent programmers in domestic job markets and because labour is CHEAP. (Even overseas, there are unemployed programmers.)

Another is automation. Work is furiously afoot in the area of data science and machine learning to automate many programming tasks. In time, this will reduce demand for programming skills as end-users will be able to create their own applications easily and without programming skills. Lower demand will mean greater unemployment for programmers.

I know that many people in this profession have their heads buried in the sand (or stuck up their asses) refusing to believe that automation is coming. Fine, believe what they will. It doesn’t change the reality.

It’s hard to make predictions but I’d say programming automation is going to hit us hard in about 10–20 years.

Quora: Are JavaScript and Java 2 different languages? And what are the differences?

Question comment from me: The name JavaScript has the same relationship to the name Java as the word “carpet” has to the word “car.” Don’t let the names confuse you.

Answer: Yes, they are completely different languages. Sure, they share a slight resemblance with C-like syntax but that’s purely cosmetic. What counts are the following:

  1. Java is statically typed; JavaScript is dynamically typed.

Also, Java was a carefully designed language. JavaScript was designed in only 10 days by Brendan Eich with very little thought put into it. That’s why it’s such a demented programming language.

Quora: Why do most programmers write in object-oriented languages, but for persistence, use relational database systems, and not object-oriented database systems? Isn’t that counterintuitive?

Answer: The main reason is that enterprises have long standardized on relational databases. The result is that relational databases and relational database programming have become highly optimized and efficient. There are tons of legacy databases that use relational. You don’t throw away such vast investments.

Contrary to what some may believe, however, relational databases are not necessarily superior to object-oriented databases. They both have their pros and cons. It’s just that relational databases have had so much more time and effort into making them highly efficient. There’s no reason why, in principle, object-oriented databases couldn’t enjoy similar effort.

Nevertheless, object-oriented databases can be very effective for enterprise computing. The canonical example is GemStone/S, a Smalltalk-based product that provides high-availability, high-performance, scalable, multi-tier application support for robust, mission-critical needs in finance, insurance, transportation, telecommunications, and utilities. I would put GemStone/S up against any relational database (Oracle, SQL Server, etc.), as long as you’re willing to program in Smalltalk.

Quora: Is programming made more difficult than it has to be?

Answer: In fact, yes, it is. The current state of the art in programming is firmly mired in ancient techniques using textual programming languages, and based on reams of source code stored in files and folders, and relying on the standard edit-compile-test-debug cycle. This is like programming using stone knives and bearskins:

Bret Victor gave a great talk about how programming could be so much easier and more efficient:

Right now, the closest thing we have to a programming environment that can live up to Bret Victor’s vision is Smalltalk. It doesn’t provide quite the same kind of immediacy and connection that he talks about, but it’s not too far off, either.

Smalltalk’s use of convenient and easy live coding nearly eliminates the edit-compile-test-debug cycle. Smalltalk’s image-based environment supplants the conventional file-based approach that has been with us since the 1960s.

Visual programming has been around for many years, but it has largely been limited to vertical applications and narrow niches. The continuing evolution of visual programming may open up greater opportunities in the future. We can only hope.

Quora: Given the complexity of frameworks and languages, is the web overengineered?

Answer: Garry Taylor nailed it completely with his answer. The web isn’t over-engineered. It’s a basket of crazy shit.

The DOM is the stupidest software abstraction in history. JavaScript is a crazy-ass language for manipulating the DOM. Brendan Eich “designed” the language in only 10 days with hardly any thought put into it. As a result, it acquired a vast array of WATs and WTFs that have made JavaScript the butt of jokes for years.

As if that wasn’t bad enough, instead of fixing these flaws (which would break the web), ECMA TC39 kept piling on features like there was no tomorrow, through ES5.1, ES6, ES7, and ES8. This last one has a language spec of over 885 pages!!! I. Shit. You. Not.

And they’re not done yet! ES9 and ES10 are coming.

Not only is JavaScript itself getting crazy complicated, so is the landscape of JavaScript web frameworks. Angular 1, Angular 2+, React, Ember, Meteor, Backbone, Aurelia, Vue, etc. It goes on and on and on.

React is the current “hotness” but front-end developers frequently complain about how complicated it is to learn. That’s why Vue is rapidly picking up steam, hoping to simplify the mess.

Read this wonderful satire: How it feels to learn JavaScript in 2016. If you don’t laugh so hard that you suffer an aneurysm, then you have no sense of humour.

In an attempt to bring some sanity to web development, a cottage industry in transpiled languages has grown up around JavaScript. There are literally dozens of choices.

Most recently, WebAssembly has finally arrived, promising to give us real choice in the web browser. It’s like the web Messiah rising to free us from the Beelzebub of JavaScript.

I ask you, what other area of IT has so much drama?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store