Kevin's Programming Page & Links

This is a Permi-Construction page.


Index


Introduction

I know the question that is probably on your mind. "Why in the world would someone put up a new page with programming information when there are so many out there?"

My simple answer to that question would be that I think there is some good information out there, but you have to wade through so much crap to get to it that it usually isn't worth the time. I hope to make this one of those pages that people would be looking for, and not the sewage that they have to wade through.

I know that it has been a long time since I have updated this page, and will probably be a very long time until I get it to somewhere near completed, but just stick around and little by little I will try to make this become one of those good resources.
Back to top


Programming Languages

The following sections will be about various programming languages, and will include some examples of how each of them look, and possibly a comparison of the different languages.


Assembly

There is an opinion floating about that assembly is an archaic and useless language. They get that opinion from the fact that it takes a lot of assembly to do the same thing as something written in a high level language. It also comes from the fact that it takes longer to get fully debugged and working code in assembly.

The assembly that will be on this page will all be for the x86 platform. As time permits, and as I learn assembly for other platforms, I will include assembly for those platforms as well.
Back to top


C/C++

C and C++ are great languages if you like flexibility. They allow you to do tons of fun stuff (including pointer arithmetic). No functionality has been removed to allow for 'security' as in Java. With careful programming, you can accomplish just about anything with C/C++.

About the only thing that C++ really needs is some standard graphics libraries. I know there are some libraries out there, but I have no desire to pay someone for their libraries that may or may not be portable.
Back to top


Java

Java is the 'lazy' programmers dream language. It is very much like C/C++ with a few exceptions. It is a very strongly typed language. This means that your variables are exactly what you tell Java they are, and conversions to and from other data types are done much more carefully than those in C or C++. One of the most interesting things about Java is its garbage collection. This is great for lazy or forgetful C/C++ programmers in that you don't have to remember to delete any memory that you are no longer using. Also, you don't have to worry about deleting any memory that is vital to your program.

The most notable difference from C or C++ is the fact that there are no pointers as you are used to in C or C++. Everything that is not a primitive type (ie. basic numerical types) is treated as a pointer. This Java style pointer is automatically dereferenced for any use, and pointer arithmetic is not supported. This is a very difficult thing to understand at first, but becomes second nature after continued use.

Java examples and more information will appear both here (someday).
Back to top


Scheme Programming

Scheme is a derivative of the LISP programming language. It is useful for processing data in lists. The standard programming style of this language is just ugly, and takes a while to be able to read.

Before reading through any of the examples below, there are some things that are important to know about scheme.


Note that I am not doing much programming in scheme anymore, so this section may not be changing very much.

Here is a simple example of some scheme. The '(void)' statement here makes this function return no value.
;start of scheme example 1
(define (loopy val max)
  (display val)             ;display the number
  (newline)                 ;set cursor to new line
  (if (>= val max)          ;check to see if val > max
    (void)                  ;if so, return nothing
    (loopy (+ val 1) max))) ;if not, call loopy with val+1
  
(loopy 0 10)  ;display all the numbers from 0 to (and including) 10
;end of scheme example 1

This is the way that iteration is accomplished in scheme. The interpreter determines when the return value from the function is a call to the same function and removes the recursive call, replacing it with a 'loop' (a process known as 'Tail Recursion Elimination').

That example was really simple, so here is a little more complex one.
;start of scheme example 2
;
;Note here that the following two statements are equivalent.  They both return
;whatever they were passed.
;
;(define function (lambda (x) x))
;
;(define (function x) x)

;A recursive factorial. This will not be able to do tail recursion
;elimination, as the value of num must be saved to do the multiply in the last
;line.
(define fact1
  (lambda (num)
    (if (= num 0)
      1
      (* num (fact1 (- num 1))))))

;A helper function for an iterative factorial.  This will be able to do tail
;recursion elimination, as nothing in the function needs to be saved for when
;the 'recursive' call returns.
(define (fact2_helper product num)
  (if (= num 0)
    product
    (fact2_helper (* product num) (- num 1))))

;call the helper function, with the initial product of 1, and the number
;given.
(define (fact2 num)
  (fact2_helper 1 num))


;A third factorial where the helper function is defined internally.
(define (fact3 num)
  (letrec ((fact3_helper       ;define a local variable, who's name can be used
			       ;to call it recursively.
	   (lambda (product num)
	     (if (= num 0)
	       product
	       (fact3_helper (* product num) (- num 1))))))
    (fact3_helper 1 num)))

;example uses.
(display (fact1 10))    ;display 3628800
(newline)

(display (fact2 10))    ;display 3628800
(newline)

(display (fact3 10))    ;display 3628800
(newline)
;end of scheme example 2

Back to top


Operating Systems, Hardware, and General info

The following sections will discuss programming in different operating systems, for various pieces of hardware, and possibly include some hints for general programming.


DOS Programming

DOS is not dead. It was never alive. Nevertheless, it is still fun to write a program that can do whatever it wants, even if it means clobbering part of an 'undead operating system'. This will contain information about programming under (and over :-) DOS. This programming will be most useful for those that program in C, C++ and x86 assembly.
Back to top


Game Programming

This is fun stuff. I don't have any examples to put here yet, but I will later put some information about programming games, and the examples that I will be working on. The languages used in this section will be a little bit of everything (uh. Maybe not BASIC). If you want some games to play, go back to my main page and download 'Jump and Grow' (written by Craig, Kent and Blaine) or get The Game . Both have the same rules, and were written for the same software engineering class. I didn't have a functional group, so mine is a solo effort.

Please, if you play these, send me mail, I'd like suggestions. Also, if anyone knows where Craig, Kent or Blaine are, I'd like to have somewhere that I could link to them, or at least have more information so that I can properly give them credit.
Back to top


General Programming

Stuff that doesn't fit, or is a combination of the above

I don't know what I am going to put here, but I thought it might be a good idea.
Back to top


Intel Stuff

This is really more of the assembly language stuff for the x86. Again, I don't know what I would put in this section, but I thought it could be a good thing to have.
Back to top


Windows Programming

This will not be a very quickly growing section. Possibly in the future, I might expand this to not only include Windows stuff, but possibly the Abstract Window Toolkit for Java. Ideas would be appreciated.
Back to top


WWW Programming Stuff

I was planning this as a section about CGI and/or PERL, but I don't know either of those, and I don't have any time soon to work on them, I think that this section might, at least for now, only contain Java Applet stuff or Javascript.
Back to top


Other Programming pages that I am working on

The Hello world page.
My Java page for C++ programmers
(not ever going to be complete)
My programming glossary
(This will always be in progress also.)

Back to top


Revision History

?? ??? 1997 Created this page.
25 Mar 1997 updated ??.
27 Oct 1997 updated ??.
28 Mar 1998 Updated. Added a section on scheme. Added this revision history section.
21 Jul 1998 Updated. Added the index, spell checked.

Back to top


Questions? Comments? Mail me!

Go back to my home page This page last updated July 21, 1998. Back to top

Counter hits since 07Dec1999 1