|NS BASIC vs. NTK Comparison||
Read the responses
to this article
NTK is a very good product: in fact, NS BASIC was developed using it. It's a great tool for professional, full time developers. NS BASIC is great tool for the rest of the world: people who have a single application to write, people who quickly want to model an application, people who already know how to program in BASIC, people who are learning how to program, people who don't have time to learn a whole new environment.
Here is more information on specific points:
1. Learning Curve
NTK creates software for the NewtonScript programming language. It is a language specifically designed for use on Newton devices, and is based in part on the experimental language Self. It is object oriented with full parent and proto inheritance. While the language itself is nice and clean, there are over a thousand functions, and the documentation is several thousand pages long. The environment that the programs need to run in is sophisticated and complex.
Experienced programmers generally need an intensive month with it before they are comfortable, but report they're still learning significant things about it after a year of full time use. Less experienced programmers are often baffled and frustrated.
NS BASIC is based on the BASIC programming language. Because of its ease use, it is often taught as a first programming language in High Schools. With its power, it's also used by more professional programmers than all other programming languages combined. (BASIC: 58%, C++ 24% C++, 6 % Java - source: Microsoft).
Programmers who already know BASIC find NS BASIC very easy to come up to speed on: many report getting their first program working within a day of receiving the product. Beginning and inexperienced programmers also like the product: they've actually got a chance of figuring it out.
NTK compiles NewtonScipt code into a project, which is a file composed of threaded P-Code. The Newton OS then executes the code.
NS BASIC compiles BASIC code into the same threaded P-Code, as you type in your lines of code. There is no separate compile step or further interpretation at runtime. However, since NS BASIC keeps its lines of code separate for easy debugging (see "Debugging"), there is additional overhead during execution and it runs more slowly.
This usually does not cause problems during execution. The slowest operations on Newton devices are those which involve updating the screen or reading and writing data to the card or internal memory. These operations are executed the same way in NewtonScript and NS BASIC, so there's no difference in execution speed. However, since they are so much slower to execute than other instructions, and appear so frequently in most applications that they become the overall bottleneck in performance. To give an idea of the speed, NS BASIC can execute up to 800 statements per second on an MP 2000; writes to a card can be as slow as 4 per second.
NS BASIC also provides you with the opportunity of using inline NewtonScript code by using the FUNCTION statement. Such code runs at the same speed as code developed using NTK. While NewtonScript not as easy to code as NS BASIC, it allows you to run speed critical code at the highest possible speed.
NTK runs on Mac OS and Windows 95 machines. You edit the code on the desktop, then compile and download it each time to run it on your Newton. For most projects, this takes a minute or two each time.
NS BASIC runs directly on the Newton. Since each statement is compiled as it is entered (it takes no noticeable time), there is no compile step; and of course, no download is needed as the code is already on the Newton.
Both packages have a layout editor that lets you see windows as you create them: NTK simulates them as best it can on the desktop, while NS BASIC shows them as they will actually appear on the Newton.
NS BASIC can be programmed using the on screen keyboard, using the Newton keyboard or the built in keyboard on the eMate. Using the serial cable, you can also plug your Newton into your desktop and use its keyboard and screen via terminal emulator such as Zterm or HyperTerminal.
NTK uses a tool called the Inspector to help with debugging. Memory slots can be examined and tracing can be turned on. With some knowledge of the Newton environment, it's even possible sometimes to patch code without having to go through the whole compile/download sequence again. If you have a runaway program, it can only be stopped using the reset button.
NS BASIC is a fully interactive development environment. Programs can be stopped at any point and variables examined and modified. Code can be changed and execution continued. A TRACE statement allows you to examine the flow of your program. With STOP enabled, a runaway program can be stopped at any time by tapping the on screen Stop sign. Code and variables can then be examined and modified, and execution continued.
NTK's filing system is based on the concept of a soup, probably named that to signify that data can includes sounds, pictures and other objects, as well as data. There are a large number of functions to understand - even experienced programmers will have trouble explaining whether to use entryChangeXmit(), entryFlushXmit(), entryReplaceXmit() or flush() to write out your data. If you need your indexes to be unique, this must be specially programmed.
To simplify this, NTK provides a number of protos call NewtApp. It can make setting up file systems easier, so long as you're planning to use just one file.
NS BASIC provides a simplified interface. The complete list of file I/O statements is CREATE, OPEN, GET, PUT, and DEL. All records are indexed by a unique string index up to 38 characters long. One program can open any number of files. Programs can open files created by NS BASIC programs; it can also access files created by any other Newton application.
Here's some sample code to read in the first record in the Names file:
0010 open ch,"Names"
0020 get ch,name
0030 print name
As always, the NewtonScript soup I/O functions can also be used from NS BASIC.
NTK comes with its own manual on communications, "Newton Programmer's Guide - Communications". It's perhaps the most complex and mind baffling area in the Newton environment. To implement even the simplest serial protocol is a difficult and humbling experience even for people who already know NewtonScript.
NS BASIC makes this much easier. Standard BASIC INPUT and PRINT statements are used for data to be communicated. The following program outputs "Hello World" to the serial port:
0010 ENVIRON IO="EXTR "
0030 PRINT "Hello World "
0050 ENVIRON IO="SCRE "
Once again, there's a complex and difficult document on the Newton Internet Enabler (NIE). To send an email message takes several pages of code and option settings.
In NS BASIC, the same is accomplished in less than a dozen lines of code.
NTK allows you to create large and complex projects, with numerous build options and conditional code inclusion. There are also auto parts, store parts, units, etc. Once you learn all this, you can do some powerful stuff.
While NS BASIC doesn't have all the options, it's still pretty good at handling large programs. There is no performance hit on larger programs: memory usage is pretty much constant, regardless of the size of the program. Up to 10,000 lines of code can be put in a single program: with the CHAIN statement, multiple programs can be linked together.
Newton, Inc. has announced that it is discontinuing paid for support for developers and will provide best efforts support through the comp.sys.newton.programmer newsgroup.
NS BASIC provides support for its product by email at support© nsbasic.com and fax at 416 264 5888. It also maintains a BBS on its web site where users can post questions and answers are usually provided within 24 hours. It is located at http://www.nsbasic.com/wwwboard/wwwboard.html.
The documentation for NTK is available at http://www.newton-inc.com/dev/docs.html. The download is about 13 megs. There are also a couple of books available from AP Professional, one of them titled Programming for the Newton, as well as Newton Programmer's Guide : For Newton 2.0 from Addison-Wesley Pub Co.
NS BASIC comes with a 260 page, MessagePad - sized Handbook. It contains all the statements, functions and widgets, with sample code showing how they're used. Other publications about NS BASIC include:
Learning NS BASIC with Visual Designer. Vincent Lo. (1997) For students. Approx 200 pages. $19.95
NS BASIC Teacher's Handbook. Terence Prezens. (1997) For Teachers. Approx 160 pages. Companion to Learning NS BASIC. Includes overheads, answers and quizzes. $29.95
BASIC for the Newton. Schettino and O'Hara. (1995) Published by AP Professional. 404 pages. Good introductory book. $34.95
In most cases, it will be faster to develop in NS BASIC than using NTK. Factors include learning curve, compile and download time and debugging.
NTK is aimed at professional programmers developing commercial products. It was not designed to be used in teaching programming.
High school teachers had actual input into the design of NS BASIC. There are also publications from NS BASIC Corporation that specifically address using NS BASIC for education.
BASIC has always been a good language for teaching. According to studies done at Idaho State University, more students complete the course work when it's taught using BASIC as a opposed to Pascal or C++. The reason is that BASIC gives the beginning programmer immediate, positive feedback from the moment they start BASIC, type PRINT "HELLO WORLD" and it works. Other languages seem generate their incomprehensible messages to beginning users, which turns them off computers.
Distribution of software
Both products allow you to create and distribute royalty free standalone applications.
Is there any point to using both?
Yes. NS BASIC can be a welcome addition to NTK users:
Prototyping: Since it's much faster to develop an application in NS BASIC, you can use it to put together a sample of how the final version will work to show to a user quite quicky - and make modifications immediately instead of waiting to get back to your development machine. (Sometimes the NS BASIC prototypes end up being the final version, too!)
Additional Functionality: Since NS BASIC is layered on top of NewtonScript, nearly all the functions described in the NewtonScript docs work from NS BASIC. The NS BASIC Handbook documents all the functions a BASIC programmer would be used to from other BASIC environments: the NewtonScript docs add a lot of additional features.
Portability: NS BASIC lets you program directly on your Newton, where ever you are: on the bus, away from the office, on that 12 hour plane ride to Singapore. (Ever notice how time flies when you're programming? A Newton and NS BASIC may be the best way to make those flights seem short!)
External routines: NS BASIC programs can call subroutines that are within packages you've created using NS BASIC.
Comments or questions? Email them to info© nsbasic.com!
|Responses:||Back to TOP|