Basics of BASIC

From iGeek
Revision as of 18:10, 29 April 2018 by Ari (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
BASIC.png

Because I was a programmer, many people ask me, "How do I get started programming?" There are many choices, and it really depends on what you are trying to do. There is programming Applications, scripting, Web Programming, and so on. The bad news is that each of those choices will alter which language or tools you should choose -- and most people don't know this in advance. The good news is that when you get the concepts, many of them can follow from language to language and tool to tool. So the most important thing is to just show no fear, dive in, and start learning; some knowledge will be throw-away, but most you'll carry with you for years to come.

Getting Started

Programming is not hard. If you can do basic algebra, you can program a computer; and everyone gets the concept of 25 = X + 20 solve for X. The basics of programming aren't much harder than that. The complexity is laying out a bazillion simple steps in a logical and maintainable way, and thinking how to decompose problems into those simple steps. So the complexity is in the scope or analysis of the problem, and the complexity is not in the concepts and the actual coding itself.

Now one very common language to start learning on is called BASIC. This is especially good if you want to do basic Application programming (making your own Apps), or just learning concepts. This article is going to discuss BASIC, but there are many other good choices. If you want do file scripting or workflow automation, then application scripting with AppleScript or shell scripting (anything but perl) is a good place to start, and for Web Development, I'd recommend PHP. If you really want to learn higher end commercial application development, and have no fear at all, then C++, ObjC, or Java and an Application Framework like Cocoa (and tutorial book) is very manageable; but I generally recommend that people walk a little before they run, and start with the basics (pun intended). The important thing is just that you have fun and learn.

History

BASIC was originally an instructional language, done at Dartmouth in the 60s for their timeshare system (a single computer that was shared amongst many users). BASIC borrowed heavily in design (in a simplified form) from the John Backus's popular computer language create a few years earlier, known as FORTRAN. FORTRAN was sort of an abbreviation (meaning FOR-mula TRAN-slation). BASIC really just stood for Basic - but many other languages of the era were Acronyms, so BASIC had to have an acronym created for it as well; the popular construct was, Beginner's All-purpose Symbolic Instruction Code.

BASIC has a bit of a bad rap. BASIC was not originally a structured language (a popular computer language concept for writing larger pieces of code in the 70s and early 80s), and most versions were interpreted and not compiled; which made it faster to learn and easier to use, but it ran slower and so was "beneath" some people. Many college instructors or programming purists absolutely despised BASIC -- accusing programmers who'd learned on it of being "ruined for programming for life". The language was way to pragmatic for purists. And that bias also extended (to a point) to FORTRAN as well. Even the "preferred" languages of that era (Pascal and C), are considered less than complete by today's standards, because they are not Object Oriented Languages (though there are new derivations of all of them that are).

The BASIC Language itself wasn't nearly as bad as the reputation - it was just that it was easy enough for people to pick up on their own, without College Instructors, and often without a deeper understanding of computers or how to write good code. So many wrote really bad code with it, and developed bad habits. This wasn't the fault of the language, and many learned better habits and techniques as they went along, and many can thank BASIC for learning how to program at all.

There is a big difference between being able to write some smaller programs, and being fully versed in good software design and creating large systems -- the "snubbing" of BASIC, seemed to be more based on the arrogance of the Software Engineers, looking down (and keeping in their place) those people who could just barely "program". There was this whole, "Real programmers didn't use BASIC" attitude. Of course there was another attitude about "Real programmers don't use high level languages, and code in machine code" as well. The structured programmers tried to belittle the higher level programmers (BASIC) and ignore the arguments of the lower level ones (Machine or Assembler coders or Systems programmers). Yet the truth is that BASIC programmers have written many powerful solutions in basements or garages, and that lowly language gets an unfair rap.

NOTE: Lower and higher level in computers means the opposite of what you might think; lower level being closer to the iron, and programming assembler language and the like, while higher level is more abstract and less intimate with the hardware).


Bill Gates and BASIC

Contrary to urban myth, Bill Gates did not create BASIC - he didn't get involved in BASIC until it had been around for 10+ years. Microsoft sold copies of BASIC on many platforms. Bill Gates personal contribution was to borrow a public domain copy, and port it to some early Microcomputers, making the language more proprietary and buggy as he went; they called that "feature rich". Rich was the right word, and it worked out well for Microsoft; since you couldn't as easily use a Microsoft BASIC program with other BASIC's, so more and more computers had to get versions of Microsoft BASIC in order to use all the code that was out there. Good for Bill Gates, bad for the industry and the compatibility of BASIC.

Apple (via Don Denman) contributed to the evolution of BASIC with MacBASIC, by adding some data-structures and some Object Oriented concepts for using BASIC on computers with a GUI. Microsoft had been successful at choking out most other BASICs from the market, and they weren't going to tolerate competition, or these improvements. Using muscle and threats (of pulling other licenses and so on), Microsoft intimidated Apple into killing MacBASIC.

Ironically this back-lashed and drove the creation of HyperCard -- which was even easier than BASIC in some ways, but didn't use the same commands (language). HyperCard and MacBASIC concepts put together, were basically the inspiration behind creating a new "Visual" BASIC. This type of BASIC could tie screen elements to BASIC routines in a more visual and Object Oriented manner - similar to both MacBASIC and HyperCard. After a third party did this for the PC's, Microsoft bought the technology and "VisualBASIC" was born.

Sadly, while these were very nice improvements, VisualBASIC seems to have also helped "taint" the reputation of BASIC. VisualBASIC was first popularized on Windows 3.1. Windows had many problems with its design, many revolving around how many (or few) resources it could handle -- and VisualBASIC was married to that. Smaller projects worked fine with VisualBASIC, but inevitably companies would try to do too much with it, and Windows just couldn't handle it. Many blamed VisualBASIC, when the problem was not only with the language, but often with the programmers and most often the Operating Systems bad design and resource limitations.

Modern VisualBASIC, and REALbasic, don't really have the restrictions that gave VisualBASIC a bad name -- but the problem is that many people got burned in the past, and that reputation sticks around. (REALbasic is a cross platform visual type BASIC that is not created by Microsoft, that is beloved by many devoted fans).

Recent History

BASIC was originally popular because it was "interpreted". The computer just read each BASIC command (instruction) as it got to them, and interpreted them (into lower level machine code). This makes it easy to write code with BASIC, because the code just runs. You write a little, and test a little, and you can run any line of code on it's own to see what it will do. The disadvantage is that this "interpretation" takes time, and programs run a little slower than if they were "compiled" (translated once into lower level assembler), instead of being interpreted line by line. Back in the 60s and 70s, speed was important because computer time was so expensive.

BASIC has evolved a lot since the 60s. In the 80s it got data-structures and even became Object Oriented. BASIC got compilers in the late 80s, but many people still think that BASIC as the older interpreted language. So BASIC had a reputation of being slow, because on 1970s or 1980s era machines, and running interpreted, it wasn't as fast as other computer languages. Now days, I've got a super-computer on my lap, and most BASIC runs faster today than the best compiled languages did on mainframes 10 years ago, let alone 20 or 30 years ago when this anachronistic attitude was started. Ironically, many languages of today (that don't have the reputation of being slow) are slower than most modern BASICs. Proof that old bias dies hard.

Today on a PC, VB (VisualBASIC) is a popular choice, and on the Macintosh REALbasic, now called Xojo is an excellent VB-like choice. I installed and played wiht REAL, and it was a fun walk down memory lane for me - with a few new surprises on the way. I, and many programmers of my era (the 70s and 80s), started programming on BASIC. It was popular and common on many Microcomputers from the 60's -- because it was the easiest way to get computer to do what you wanted them to do (or at least what you asked them to do). With the absence of many commercial programs, in order to use a computer early on you could program the computer yourself in either Assembly Languages (and/or Machine code) or BASIC. Assembly languages (one for each processor variant) was very specific low level languages that manipulated registers and used hexadecimal (base-16), octal (base-8) or binary (base-2) numbering systems -- while people could pick up the much easier (and higher level) language known as BASIC in far less time (but programs ran slower). Most people preferred the latter, at least as a starting point, and many computers were converted from techno-toys into useful business solutions because of BASIC or programs written in BASIC.

BASIC and Programmers

Today's BASICs are very viable languages, that are quick, powerful and relatively easy to learn on. BASIC is a structured and often an Object Oriented Language. I would definitely recommend it for many people to start programming with, and create many real business or commercial solutions on. In fact, these tools are so powerful and easy to use, that they make programmers far more powerful and productive than they are with many other "professional" solutions -- and so many solutions are created with them that just would have cost too much to create with traditional C++ development tools.

The worst problem with BASICs have to do with the history, legacy, market and programmers. Often companies that are using BASIC internally, are not as large as big organizations with their own IS departments and their internal engineering staff -- so they are not as wise on how to set realistic expectations, or how to manage programming projects (and the ramifications of what they are asking for). This increases risk on these projects to begin with. This is not the fault of the language, but facts are that many more BASIC projects will fail, and something has to be blamed (and it usually isn't bad management).

The resource side of the equation can be worse -- BASIC is often used a stepping stone to other languages, so the programmers you find doing BASIC are often the least experienced ones. This inexperience contributes to more mistakes made on BASIC projects as well; and because of the "real programmers don't use BASIC" reputation, many programmers try to get "beyond" BASIC as quick as possible, to do more glamorous jobs and use more glamorous programming languages. So even when you create great systems with BASIC, and even if it did cost you less money, it can be hard keeping good people because many might see it as a stepping stone (and not a career goal).

BASIC languages and the tools are not nearly as bad as their "professional" reputation might imply. Most of the issues are human ones. You can write good programs with BASIC, and you can find good people who work in BASIC. The productivity of the tools can make many solutions more cost effective than in other languages -- and programmers can learn a lot with these systems. But you can't fight the hype and misinformation of 1,000 magazines ranting about Java this or C++ that. So in smaller companies, individual projects, and for simpler solutions, with more Junior people -- I'd consider a BASIC project. For a serious project in a large corporation, most couldn't recommend it, not because of the economic or technological reasons, but just because of bias and misperceptions.

Conclusion

BasicsOfBASIC.jpeg

Using BASIC again, took me on a trek back to my teenaged years, remembering all the discovery of the joy of making a computer do what I asked it to do. BASIC allowed me to learn what I wanted to do, which was computer programming. I would seriously recommend BASIC for who want to get started programming.

There are other ways to learn programming besides BASIC -- a few are probably an easier start than even BASIC, and help introduce people to programming concepts without learning a complete language. Learning an application scripting language for people who need to just get a business process done. FileMaker or Foxpro Scripting is a great solution if you want to create a simple database application (I much prefer the former). Use Excel scripting if you need some complicated calculations or something that should start with a spreadsheet or some tabular data manipulation. And if you need a few programs to work together in some process, AppleScript or VBA (Visual Basic for Applications) can be a neat way to automate processes, and teach you some programming concepts in the process.

In a few ways scripting can be more complex than learning a formal language, and in a few ways less -- but often the problems you will try to solve will be smaller, and so scripting is a good stepping stone to programming. If you can do some scripting, and I believe that anyone can, then you can do BASIC programming. So once you're past creating some neat Application scripts, BASIC is a natural next step.

People are unnecessarily afraid of computers or programming; they hear how "hard" something is, or how complicated, and they shy away. Certainly some things can be that complicated, but most things are not nearly as hard as people hear. Just try it -- the worst thing that happen is you waste some time and learn some stuff on the way. Many people become so empowered by what they do, and find it so easy, that they don't know what all the fuss is about and make a whole career shift.

Life is too short to worry about what might be too "hard". There is a ton to know about programming -- I've been doing it for 25 years and don't know it all, but you don't need to know it all to get started. BASIC isn't the perfect tool for everything, but no tool is perfect for all things -- yet most of the concepts you learn will have some value if you choose to go on. If you like programming BASIC there are a ton of things you can do with it. So if you have a curiosity about computers and programming, and you want to learn more, then get out there and try some scripting at least, or get a BASIC and just do it.

Tech | Programming : Anti-aliasingBig or Little EndianBinary, OCTal, HEXadecimalCommand Line InterfaceDatabasesDigitized SoundEnterprise ToolsFUDForward CompatibilityFree FeaturesHack, Crack or PhreakHiring ProgrammersHistory of Visual BasicHow does compression work?MHz or GHzRISC or CISCRaster ImagesSoftware ConsultantsSoftware Development Live CycleSynthesized SoundUNIXWhat is MP3?What is a WebApp?Why is software so buggy?

2000.09.20