Advertisement
Guest User

On Readable Code: A Thought Experiment

a guest
Apr 11th, 2019
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ```
  2. On Readable Code: A Thought Experiment
  3.  
  4. What if people could leverage their understanding of
  5. books and knowledge to read and think about code?
  6.  
  7. This is an imaginary language designed to be food
  8. for thought.
  9.  
  10. The question I want to ask is:
  11.  
  12. How can we build a programming language that everybody
  13. can read and write?
  14.  
  15. A programming language is "readable" if a human can understand
  16. what a program does by reading its source from the entry point.
  17.  
  18. A programming language A is more readable than a programming
  19. language B if more people can understand the programs written
  20. in A than in B or, if the number of people is equal, if the
  21. average time required to understand a program in A is lower
  22. than the time required for a program in B.
  23. ```
  24.  
  25. KNOWING NaturalNumber,
  26. Addition AS BINARY INFIX '+',
  27. Subtraction AS BINARY INFIX '-',
  28. EqualTo,
  29. GreaterThen
  30. FROM /Mathematics/Arithmetic
  31.  
  32. GIVEN number FROM NaturalNumber
  33. DEFINE FibonacciNumber AS NaturalNumber WHERE
  34. IF number IS EqualTo 0 THEN FibonacciNumber IS 0 DONE
  35. IF number IS EqualTo 1 THEN FibonacciNumber IS 1 DONE
  36. IF number IS GreaterThan 1 THEN FibonacciNumber IS
  37. FibonacciNumber(number - 1) + FibonacciNumber(number - 2)
  38. DONE
  39. DONE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement