Ask HN: Which coordinate system is better for a beginners programming language?
This is a programming language reduced to the basics with built-in graphics commands. It includes an interactive course to learn programming.
There are now two versions. One with the coordinate system origin at the top left, one with the origin at the bottom left. I am interested in the reasons why one or the other version is "better" for a teaching and learning programming language.
Arguments for "top left": this is common in 2D computer graphics; it is easier to deal with a grid of rows and columns
Top left origin tutorial: https://easylang.online/apps/tut_learn.html
Arguments for "bottom left": the y-value corresponds to the height; that's how it's taught in math class
Bottom left origin tutorial: https://tiki.li/apps/tut_learn.html
These tutorials are also built into the Web ID. It is all open source.
46 comments
[ 6.1 ms ] story [ 92.2 ms ] threadComplicate everyone else's life: Allow the origin to be set by the user, too.
It makes some things so much easier and clearer, especially drawing static symmetric designs, where you can just specify both positive and negative of the same values to get symmetric points.
On the other hand, you often want to stick things at, or relative to, the center of the screen. If you want an edge, it's random which one you'll want, and addressing them consistently makes sense (windowHeight/2, -windowHeight/2, etc.)
manim does the same thing. It's super-intuitive to work with relative to anything else. manim also has shorthand macros like LEFT (which is a vector of (-1,0)), RIGHT, etc. which actually make for very readable code.
If your audience consists mostly of programmers, use top-left they are familiar with.
If your audience is familiar with primary school math, choose their coordinate system: bottom-left.
It is just convention that is consistently kept within the certain community. I would advise against any convention that is unused in your community.
Some libraries like to use top left coordinates because they are conceptually easier for stuff such as displaying rows of text and we are used to top to bottom ordering of things.
Natural fit with algebra.
Someone else in the thread pointed out that Scratch does the same.
b) Can this actually help younglings understand negative numbers more readily?
Do note that subtraction and negative numbers are not the same.
Obviously I jest, but boy would it have made things a lot easier if we did them that way! To your point, I feel like we do a lot of the things we do because that's the way we've always done it. Every now and then we need to step back and ask whether that still makes the most sense.
If this is intro to coding 1 of N. Then go top left. They will have to learn the map is not the territory at some point why not with this easy example. It will also help when they try to take what they learned beyond the course.
Very often the suggestion comes with 0/0 in the center like Scratch. I haven't thought about that yet, because the necessary negative numbers scared me off.
> Arguments for "bottom left": the y-value corresponds to the height; that's how it's taught in math class
Not quite, in math class (0,0) is the center and you can go positive and negative on both axes. You would be taking the coordinate system from math class and limiting everything to the first quadrant which doesn't seem natural at all (in computer graphics or in math).
Maybe advanced graphics, e.g. rotation matrix, will be more confusing later, but at this point you’re not a beginner and can always incorporate a mirroring matrix into your stack.
Note also that almost all editors and guis also use top=0 (except AppKit, where it is configurable non-default).
Also... if they're ever going to do any trig... like "move laser to 30 degree angle", it'll be a big boon to keep it exactly in line with what they've learned in school.
I especially like the answers which relate one coordinate system to another system, either in mathematics or other computer software.
I wonder if there are any hardware solutions choosing one coordinate system over another…reminds me of photography in a darkroom. A corner is cut off of the film so you can orient the film emulsion in the dark. In that case it’s useful to choose a system, though any orientation would suffice.
This discussion gives me the idea that if your curriculum crosses over to require different coordinate systems, then a new lesson might emerge about how different models are used in different contexts. Like choosing Imperial or Metric, it’s part convention and part utility.