NS BASIC vs. NTK Comparison Read the responses
to this article

"You should put 'customer support' in the first line of your NSBasic vs NTK page!"
- Anton Gutscher, Austria

Recently, Newton Inc. has put the Newton Tool Kit (NTK) up on its web site for anyone to download. With NTK being essentially free, why buy NS BASIC?

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.

Performance

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.

Development environment

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.

Debugging

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.

File I/O

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.

Communications

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 "
0020 WAIT
0030 PRINT "Hello World "
0040 WAIT
0050 ENVIRON IO="SCRE "

Internet

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.

Large Projects

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.

Support

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.

Documentation

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

Development speed

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.

Education

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


After we put the NTK vs. NS BASIC Comparison document on our web site, there was some interesting discussion on the newsgroups:


"I have to be honest now. I started downloading all the NTK ref manuals. After every 100 pages I though that the next batch would give me some info on how to start programming with NTK. Finally I ended up with at least 2000 pages or more documentations and no idea how to program with NTK. Then there was NSBASIC. Within one week I had a "windows' like program that communicates with Leverage Database working. Now I am only using the NTK docs to find specific Newton Script functions. Conclusions: NSBASIC makes programming on the newton effective, efficient and not the least: Fun.
P.S. Programmers should also use a tool like Newton Tools or equivalent."
 — Jitse Schaafsma, Holland


I absolutely agree with what George said. I had the experience using both NTK and NSBasic. Obviously NSBasic wins out. I spent one to two months studying NTK and reading through McKeehan's book. Then I found you need to take care so many tedious commands to make simple things to work. For example, NewtApp doesn't handle two soups in one application and McKeehan's book just said "applications that display entries from multiple soups simutaneously are not good candidates for NewtApp." Well, you might say you can use standard applicaion instead of NewtApp in NTK to do it or read the soupdrink sample code. However, NTK makes soup/data access much more difficult than any other language. In my point of view, it makes simple thing DIFFICULT. Why? I don't know.

Later on, I found NSBasic. I spend one week to learn it and finish my project within two months. If I stick on NTK, I don't know when I can make my project. At least, NSBasic keeps simple things SIMPLE and can almost do what NTK can do by using Visual designer.

Rich Tsui, Ph.D.
Center for Biomedical Informatics
University of Pittsburgh


Yes yes and more yes... NSBASIC is a breeze to use.. I wrote a custom serial app with a killer GUI that saves data to notes for collecting data at work and it only took me 1 day.. and I have never written a window or event driven project before, let alone worked with soups! NTK and Newtonscript are INCREDIBLE, but as far sheer joy of programming NS BASIC takes the cake... especially cool is developing RIGHT on your Newton.. Really zaps that layer of abstraction you have to keep in your brain when using NTK... George Henne may not be a god (I'm not sure) but he's at least a successful prophet! Buy NS BASIC, even if you have learned to use NTK... it's only a few bucks and it's SO worth it.

Matt (lightyear© uiuc.edu)


You're quite right,

basic is an interesting and easy language, NS is much harder to understand but is more flexible and powerful. All you need is just that your tools meet your needs. If you want to write something easy and write it quickly, use basic (if you're familiar with it), if you need a really sophisticated project, use NS.

(By the way, as for me, I don't like development on the Newton. Because I write not so fast as I type.)

-- Dmitry V. Girenko
KAMI-NT Newton Developers Division


you can use a keyboard on MP2K (or built-in to eMate) to write code faster/more accurately.

btw, don't forget about NewtDevEnv for mobile NewtonScript prototyping.

Steve
weyer© kagi.com


Very True, Steve.. I have been very impressed with NewtDev, too. But for serial comms... NSBASIC anytime baby.

and yes, using the keyboard is a must for developing on the Newton, although in NSBASIC a lot of the functions are availiable in a popup menu where you just have to fill in the blanks with your variables/constants/values

Matt (lightyear© uiuc.edu)