Phosphor - Updates
I've updated the Phosphor interface again. There are a few additions that make things a little easier to use:
- Cut,Copy,and Paste support
- Reload and Go To Origin hot key commands
- A basic object inventory
- Revised Help documentation and copyright info
- Non-two-finger scrolling
The object inventory support is currently very primitive, and will eventually be replaced with a server based storage system. Storage of some objects currently just freeze Safari, since it is incapable of breaking some types of circular references. But overall, it is suitable for storing very simple data structures for later use.
A Book on Programming
For the past year, I've been working on a book on programming. The intended audience is the 'self-taught' and non-programmer markets. Rather than writing a book for computer scientists, I'm writing a book for all those who would like to use their computer as a tool. My hope is that by breaking down some of the walls that prevent "ordinary" people from learning to do basic programming tasks, it will make computers more useful and less intimidating.
A large part of the problem with modern computing is the belief that it requires expert knowledge to do anything useful. As with much of our society over-specialization has created the seemingly insurmountable complexity in the system, that novices often are overwhelmed the appearance of irreducible complexity. And while these appearances serve the experts well, the reality is that many people can learn to do basic computing tasks for themselves. Excel and Word macros are a primary example of how ordinary people can learn to program and automate basic tasks, much to the dismay of professional programmers.
Barriers to Entry
If you look at a typical web programming environment there are a number of barriers to entry:
- Development tools are distinct from the browser, and require learning new idioms
- Web servers are non-local, and behave differently from locally hosted content
- Web content is debuggable with in browser development tools, but changes require external editing
- Cross-browser programming requires knowing a large number of poorly documented quirks and properties
- Programming APIs are often written from the browser developer's point of view, and not the content developer's
- Due to historical baggage, many flaws in implementation have been retained for backwards compatibility
Attempting to teach a novice programmer to write code for existing browser technology is consequently an exercise in futility. These hurdles exist because they make life easier for professional developers, who already have a large amount of time and energy invested in the status quo. But assuming your audience has no prior experience or any vested interest, these "features" only become a hinderance to learning the environment.
The Phosphor API
The Phosphor programming environment attempts to simulate a computing environment, and does not attempt to be a "web programming" toolkit. It has a small number of objects, which build upon each other like Lego bricks, that define a simple state machine for 2D graphics programming. It also effectively hides the browser's interface to resources, allowing the programmer to focus on simply supplying URLs, and not have to worry about connection state. The core objects of the system are as follows:
- The Box is conceptually a container in 2D (or eventually 3D) space, and provides a uniform interface to positioning and scaling objects
- The Widget forms the basis for all scriptable elements, and provides the interface for objects which receive event notifications.
- The Display is a widget that handles the scrolling and background drawing for the interface.
- The Screen is a 2D vector graphics state machine based on the HTML5 canvas, it has a very basic 2D api for drawing lines, arcs, rectangles, rounded frames, text, and images.
- The Event is a message object that is dispatched to widgets for both user driven and autonomous system events. The methods associated with each event type are:
- The Device is the base for all objects which can dispatch events. It forms the basis of Keyboard,Mouse, and App
- The Keyboard device handles dispatching pressed events and keeping track of modifier key states
- The Mouse device handles dispatching up,down,move, and scroll events
- The App device handles dispatching tick and draw events, and maintaining the delay between frames
- The Resource object forms the basis for loading of all HTML resources, images, sounds and movies
- The Sound resource controls the playing and pausing of audio resources
- The Image widget handles the display of image resources
- The Movie widget handles the display, playing, and pausing of HTML video resources. It currently displays in an overlay div.