Skip to main content
added 368 characters in body
Source Link
Caridorc
  • 28.2k
  • 7
  • 55
  • 138

Weird factorial

From a user-interface point of view, the factorial is very weird. All the others buttons just add the symbol to the display, but factorial actually evaluates the whole expression. The principle of last suprise states that if 9 buttons do a thing, the 10-th should either:

  1. Behave similarly to them
  2. Have a special mark on it to signify speciality. (On a side note making the AC, <- and = red really improves user experience in my opinion.)

Constants

If you use the same value many times, you should give it a name, so that modifying it is faster.

You use ("Calibri", 12) 22 times in your code! What a boring day if you decide to make the font bigger!

Instead use:

FONT = ("Calibri", 12)

And then replace ("Calibri", 12) with FONT to allow for very fast code upgrades.

Weird factorial

From a user-interface point of view, the factorial is very weird. All the others buttons just add the symbol to the display, but factorial actually evaluates the whole expression. The principle of last suprise states that if 9 buttons do a thing, the 10-th should either:

  1. Behave similarly to them
  2. Have a special mark on it to signify speciality. (On a side note making the AC, <- and = red really improves user experience in my opinion.)

Weird factorial

From a user-interface point of view, the factorial is very weird. All the others buttons just add the symbol to the display, but factorial actually evaluates the whole expression. The principle of last suprise states that if 9 buttons do a thing, the 10-th should either:

  1. Behave similarly to them
  2. Have a special mark on it to signify speciality. (On a side note making the AC, <- and = red really improves user experience in my opinion.)

Constants

If you use the same value many times, you should give it a name, so that modifying it is faster.

You use ("Calibri", 12) 22 times in your code! What a boring day if you decide to make the font bigger!

Instead use:

FONT = ("Calibri", 12)

And then replace ("Calibri", 12) with FONT to allow for very fast code upgrades.

Source Link
Caridorc
  • 28.2k
  • 7
  • 55
  • 138

Weird factorial

From a user-interface point of view, the factorial is very weird. All the others buttons just add the symbol to the display, but factorial actually evaluates the whole expression. The principle of last suprise states that if 9 buttons do a thing, the 10-th should either:

  1. Behave similarly to them
  2. Have a special mark on it to signify speciality. (On a side note making the AC, <- and = red really improves user experience in my opinion.)