How to start programming

Handruin

Administrator
Joined
Jan 13, 2002
Messages
13,920
Location
USA
Will Rickards WT said:
Handruin said:
I also don't understand the compilers. I take it you use compilers for different OS's and different systems. But what are the advantages from using an MS compiler vs. a Borland? Can you use one or the other, or does it depend on which programming tool you use, such as MS visual C++, or Borland C++.

Let us start with the basics.
There are 'levels' of languages. These are really just levels of abstraction from the machine code they eventually get translated into.
At the lowest level is of course machine code, you know the 1s and 0s. At this level you are platform (processor) specific. A processor family has a given instruction set. These are simple commands like add, compare, and store. You work with the memory on the processor called registers.


Still at the pretty raw level you have assembly languages. They are a bit less cryptic since they are something like english words instead of 1s and 0s. However you are still working with simple instructions and registers. An assembly language program gets sent through an assembler which turns it into machine code. This is almost a 1 to 1 translation.

Then you have languages like C. The syntax is more abstracted but it does essentially get translated into machine code. However at this stage you need a compiler and a linker. A compiler parses your code and turns it into object code. This is like machine code but not in an executable form. To be executable it has to be linked. What linking does is resolve the references found in the object code to the libraries. These libraries can be standard C libraries or user created libraries. Once all the references are in place an executable can be created.

So since compiling/linking still generates machine code. It is specific to an OS and processor family. This is why languages like Java and the concept of a virtual machine were created. You code for a virtual machine and it handles translation to actual machine code.

There are standards for languages like C++. A compiler may not adhear to the standard completely. Thus even though you are programming in C++, some language constructs or standard libraries may not be available to you because of your choice of compilers. This is the difference between MS and Borland compilers. Mainly a difference in compatibility with the standard and optimization techniques.

When programming in windows you generally use some sort of IDE (Integrated Development Environment) as Tannin said. And yes I still have Turbo Pascal disks lying around. Since it is integrated the compiling and linking stage is mostly transparent to you. So your choice of IDE will determine the compiler you use. You could write code in the IDE editor and then compile it using another compiler.

Handruin said:
Now I see the link for something like razorlame and wonder how one or more languages can produce a GUI that fits in like a Windows app. If you aren't using MS C++, how do you create a windows based application and make it "look" like a windows application. Are there GUI based editors that allow you to design how the application looks? Is this something that is done after the code is written?

Windows has a set of libraries. These expose standard functions and definitions. It is generally called the Windows API (application programming interface). Languages can access these APIs directly (function calls to API functions in your code) or indirectly (the compiler translates other statements into calls to those functions).

I don't want to get into how windows makes a window but to answer your question, yes there are GUI editors to design windows. The presence of these editors has been termed visual. Thus Visual C++ has a GUI based window editor. There are many types of windows and they go by different names. Visual Basic for example uses forms and has a forms editor.

These editors generate code that creates the windows. In some you see that code (VC), in others (VB) it is hidden. After this code is created you write the code that handles the different window interactions, like clicking buttons and entering text.

I thank you for the good explanation to satisfy my ignorance in the software world. Some of what you explained wasn’t very clear, but it is now its getting better. I’ve spent the last week learning how to script and understand some more of the basics. Friday night I was proud of myself, I had created my own complicated function with the forethought to allowing me to reuse the code for future tasks. To some people it is probably simple, but I was happy to now understand the concept of passing information in and out of functions.

Today I started to explore arrays a bit more. I’ve been asking help from a guy at work who knows his stuff. He’s been helping me to understand how to extract information out of arrays in a way that I can “search” through it. This now brings me into the “for” and “while” conditions, along with some more if/then/else. I understood how these items worked in the past, but to be able to implement them into something useful is a whole new concept.

Today I asked if I could use the Visual Studio 6.0 (enterprise edition) to learn, so now sitting before me is 5 CD-ROM’s to install on my work laptop. I also have the MSDE for visual studio, macro assembler, and C++ 1.2. I have no idea what I*’m getting myself into, but for now I can tinker with this studio set until I decide what route I want to go.

I also have some tutorial software that bulldog gave me to learn from which has C++ and java in it.

I’m excited to see what I can learn and do with these tools! Thanks for all the help so far, I’m sure I’ll have more questions as time goes by.
 

cas

Learning Storage Performance
Joined
May 14, 2002
Messages
111
Location
Pittsburgh, PA
I have come to this topic a bit late, but here are my 2c.

I started programming in Pascal in the eighties, with Turbo Pascal for CP/M. I bought Delphi 1.0 right after its release, and have used various versions of Delphi for contract work.

Having said that, I strongly recommend you start with C. Learning C will teach you the same concepts you would learn with Pascal, but is far more useful in my opinion. The vast majority of "real" applications and essentially all modern OSes are written in C. Even if you end up using scripting languages, those languages have typically been designed by C programmers, and written in C. C is the lingua franca of the development community.

While I think C makes more sense than Pascal, one could certainly do much worse. I would avoid certain scripting languages such as PHP like the plague, until you have a solid foundation in structured techniques. It's not that PHP isn't a wonderfully productive language; it's just that most people find it easier to move from a strictly typed language to a loosely typed one. Going in the other direction can be pretty tough.

As for classes, only you know how you respond to classroom instruction. As Will has said, desire and practice are far more important than instruction alone. Merc's four year degree wasn't enough to instill the requisite desire, and my almost complete lack of formal education has never held me back.

If you want to write quality code badly enough, eventually you will.
 

Handruin

Administrator
Joined
Jan 13, 2002
Messages
13,920
Location
USA
cas said:
I have come to this topic a bit late, but here are my 2c.

I started programming in Pascal in the eighties, with Turbo Pascal for CP/M. I bought Delphi 1.0 right after its release, and have used various versions of Delphi for contract work.

Having said that, I strongly recommend you start with C. Learning C will teach you the same concepts you would learn with Pascal, but is far more useful in my opinion. The vast majority of "real" applications and essentially all modern OSes are written in C. Even if you end up using scripting languages, those languages have typically been designed by C programmers, and written in C. C is the lingua franca of the development community.

While I think C makes more sense than Pascal, one could certainly do much worse. I would avoid certain scripting languages such as PHP like the plague, until you have a solid foundation in structured techniques. It's not that PHP isn't a wonderfully productive language; it's just that most people find it easier to move from a strictly typed language to a loosely typed one. Going in the other direction can be pretty tough.

As for classes, only you know how you respond to classroom instruction. As Will has said, desire and practice are far more important than instruction alone. Merc's four year degree wasn't enough to instill the requisite desire, and my almost complete lack of formal education has never held me back.

If you want to write quality code badly enough, eventually you will.

Would I be doing more harm then good by starting with the visual studio 6.0 I mentioned?

The very first thing I started scripting with was PHP. I simply went out and bought a book and read though it. To be honest, had I not done this, I feel I would be in worse shape for the scripting I’m doing now.

I don’t claim to know a lot about php…however I can say I took the basic fundamentals of scripting from it, even if they are not as structured as C. I think that right now I don’t have a strong hold of either php or C, so I may be OK.

I don’t do well in lecture classes. I need hands-on experience with help to get better faster. I’m confident I can do this on my own, but it will take some time. I can also try to post questions to the folks here since you all seem to have some prior experience with the programming world.
 

Cliptin

Wannabe Storage Freak
Joined
Jan 22, 2002
Messages
1,206
Location
St. Elmo, TN
Website
www.whstrain.us
For the largest program I ever wrote (some 1000 lines or so) and the most functional I used two different IDEs and another compiler. At the end of the project I only needed to turn in results and source code.

I started off in TurboC. They closed that lab to upgrade that software and I was forced to use another lab this lab had VC++. I thought the color coding was somewhat helpful but I could not for the life of me figure out how to output results to a window that would stay on the screen long enough to read it.

So I finished the project in pico and used gcc to compile it.

PS. Good work Handruin!
 

cas

Learning Storage Performance
Joined
May 14, 2002
Messages
111
Location
Pittsburgh, PA
Actually, I think that starting with Visual C 6.0 is a very good idea. It has an editor that works the way you expect it to, and an easy to use debugger(vs say, emacs/gcc/gdb). Do make sure that you stick to simple console apps until you really know what you are doing. stdio console apps are portable to UNIX, or just about any system.

Although I think your life will be easier if you follow the order I have described, pursuing development in a different order certainly won't 'break' you. As I explained to Sivar, creating a positive feedback loop can be more important than following the 'cleanest' route.

With your interest in web development, progressing to basic cgi-bin might be a nice first transition from stdio C apps. A cgi-bin app is portable, simple to write, and little more than a console app with the output redirected to someone's browser.
 

P5-133XL

Xmas '97
Joined
Jan 15, 2002
Messages
3,173
Location
Salem, Or
Handruin,

I too am coming late to this discussion, however, I feel I have something to say.

Any programming class you take will have a lab component and as a beginner the vast majority of your time will be in the lab not in lecture. I suggest that you take one. It is not that one can not learn programming on your own, it is that the class will teach indirectly a mentallity (a way of structured thinking) that is difficult to gain otherwise. The couse will structure the projects/programs you need to complete so that the mentality must be learned to accomplish the task. The reason you wish that mentality is that if you actually involve yourself in programming for the outside world there are standard accepted practices that aren't likely to be learned by self-taught individuals.

It is not natural for people to program in structured ways. If you learn on your own, the natural way of thinking is to use what is called "speghetti code". You don't wish to form bad habits at the beginning and need to break them later on and that is likely to occur without some "formal training" at the start. Take a structured programming course (any language) and keep with it, even if it takes several courses to finish so that you form good habits. After you have a good foundation then learn on you own with book(s). I truely believe that you will do better in the long run, even if you don't respond well to lectures because the lectures are really not very important in the process.

The real flaw I have with programming course(s) are that they are all dumbed down to the lowest coomon denomometer. You just won't learn as fast as if you did it yourself with proper discipline.
 

Fushigi

Storage Is My Life
Joined
Jan 23, 2002
Messages
2,890
Location
Illinois, USA
Tannin said:
Either way, it was Turbo Pascal that set the programming package world on its ear.

...

And it compiled into a plain, efficient .exe that was small and fast.

TP2 & 3 created .COM files. If your app was >64K compiled, you could create overlays for the extra code.

Another amazing thing was this whole IDE fit, for TP3, in a mere 39K executable.

It also let you at the system. We used it to develop our own text-based menuing system & windowing routines. We also created a psuedo-graphics mode using a text mode that was whacked out through a series of peeks & pokes to give a 160x100 16 color (more if you count blinking...) graphics screen. We wrote all the standard graphics primitives to go along with it.

All of these we included in our college projects to make life easy. We also wrote our own apps as companions for our all-night AD&D sessions.

It ran very fast on my Zenith Z-151 4.77MHz NEC V20 with 320K RAM & dual floppies. Ah, the memories...

- Fushigi
 

Tannin

Storage? I am Storage!
Joined
Jan 15, 2002
Messages
4,448
Location
Huon Valley, Tasmania
Website
www.redhill.net.au
.com. So it was. I have become so used to .exe executables that I had almost forgotten the .com extension. And yet, back in those days, I always found the .exe extension a little weird, as I'd spent years programming in CPM, where everything is a .com. .exe was a weirdo MS-DOS thing.
 

Handruin

Administrator
Joined
Jan 13, 2002
Messages
13,920
Location
USA
Prof.Wizard said:
Really, what are the projects you are thinking of, Handruin?

The only "personal" project I had in mind so far was to create a lap counting system for the R/C track I race at. There are options available, but they cost serious money for the owner of the track. Now I figure, if I could create an application that keeps a list of racers, and allows the user to asign a transponder to their name, the system could keep track of race laps and ultimitely determine the winner.

The hardware for the lapcounting system will be, what I feel as the hardest part. I believe the system connects to a serial port...but I don't know how software interacts with ports, or how this hardware reports that "x" transponder has been detected. (hence, a car has finished a lap because the transponder was recognized)

My next largest hurdle will be to figure out a way to manage users and information. First thing that comes to mind is a flat file database...but I don't know how to implement something like this. I could probably manage with a text file, but I think the expanability of going this route is a bad idea. At least with the database the user can backup their files.

Last goal would be to sell this application once it has been tested thoroughly and race proven. current feature-rich tools such as this one I wish to create have been sold for over $500 US, and people buy them because of lack of options. The cheap option is for a DOS based program, just like my current track uses. Here is the current option called jlap

Does it sound unrealistic for my first program? I need not even sell it, but if it were to ever become good enough, it's an option for me to consider.
 

timwhit

Hairy Aussie
Joined
Jan 23, 2002
Messages
5,278
Location
Chicago, IL
That's pretty ambitious, there are some pretty complex things you are thinking about doing there. You would probably be better off to learn all the basics of programming first and then attempt to write this program. When you find out that you need to read several more books then start doing that, you should be done with your program in about 2005. :mrgrn:
 

time

Storage? I am Storage!
Joined
Jan 18, 2002
Messages
4,932
Location
Brisbane, Oz
Unfortunately, I'm inclined to be pessimistic as well, Doug. Someone like Cas would probably find it a walk in the park, but any time you're trying to talk to exotic hardware is not fun time in my book. It may be simple, or it may be a complete bitch. If you can buy the hardware and set it up at home, that would be ideal.

But on top of that, interpreting the results from the hardware and organizing it as you plan, is non-trivial. You'll probably need guidance if you don't do what Timwhit said.
 

Tannin

Storage? I am Storage!
Joined
Jan 15, 2002
Messages
4,448
Location
Huon Valley, Tasmania
Website
www.redhill.net.au
Ha! That's a funny thing, Doug. A year or so ago, we were called in by one of our "semi-trade" customers because he couldn't sort his client's problem. They were a raceway place. I can't remember if it was model cars or go-karts - doesn't matter, because either way they needed a program to do exactly that. Their business depended on being able to sort and count and compare different people's lap-times, say "you are half a second better than your average last week", stuff like that.

They had a program which worked fine, an old DOS-based thing which was (so they seemed to think) irreplacable. Their problem was that the program doesn't seem to have a way to purge old records. (Or perhaps they wanted to keep the old records for some other reason - sporting records tend to be kept pretty much forever, look at cricketers and baseball players, they are always harking back to the 1932 season, or saying "a left-handed spin bowler hasn't made 50 runs batting at nine since Charlie Dodson did it in 1908".)

Now the program, written in one of the dBase-like things - it might have been Foxpro - coped just fine with the ever-increasing size of the database. Any decrease in its speed was easily swallowed up in the improvements that hardware makes, and it was perfectly usable on a K6-233 (or something about that speed). But the main database file was slowly growing and, eventually it wouldn't fit onto a FAT16 partition!

Easy, you say: run it under Windows 95 or 98 with a FAT 32 partition. Nope: program runs in DOS mode under Win9X but the 2GB maximum file size problem crops up and you are still screwed. Fine, you say, it's still easy: run it in the DOS box under Win NT or Win 2000. Nope: program doesn't run at all under Windows NT or 2000 (neither of which have ever offered particularly good DOS support).

The answer turned out to be OS/2. With an HPFS partition on a 10GB drive, it worked just fine, and I was able to use an old floating-round copy which cost them next to nothing, because they weren't going to be using any of the special features of the latest version anyway.

I guess I'll be seeing them again when the database reaches 9.5GB. That will be about 2015. With luck, I'll be retired by then, so Kristi will have to figure it out. :wink:
 

ihsan

What is this storage?
Joined
Oct 6, 2002
Messages
66
Location
Petaling Jaya, Malaysia
Website
ihsan.synthexp.net
Mr. Doug,

If the hardware in question is available to you through some sort of interface ie: DirectX or a manufacturer provided API (application programming interface), you can ease the transition but probably not by much. I would suggest the later if it's available, since the user community is huge and you can learn the intrinsic details of event-based or stateful programming through DirectInput, which I believe is essential to your kind of implementation. Win32 somehow encapsulates the functionalities through easy to use wrappers but some of it are indeed available through functions like GetAsyncKeyState () and etc.. A little digging of examples is essential if you were to use such functions.

Start your journey with mouse or keyboard -based events and slowly progress towards game controllers. Provided you have the working basics, it should take you less than a week to learn DirectInput. That's how I did it and the exact time I took to learn. DirectX is available for Visual Basic programmers which is a plus.

I'll provide the link to my little demo programs (DirectX-based, 7 total, 5 working) which I learnt during my spare time. It's a hefty download, around 5 MBs. Binaries are provided if you somehow couldn't compile them cleanly and wanted to see them in effect. Just study the source codes; I hope you can understand them, it's commented towards my understanding, probably isn't suitable for someone who just started programming. You'll need a DirectX 8.1 runtime to run and DirectX SDK to compile and link them. The SDK is 100 MBs++ to download, it's huge but within it contains various source codes for the samples, to which I think are of excellent qualities. Hands on qualified as a learning tool.

Binaries and sources (4.6 MBs).
Sources only (3.8 MBs).
 

cas

Learning Storage Performance
Joined
May 14, 2002
Messages
111
Location
Pittsburgh, PA
time said:
Someone like Cas would probably find it a walk in the park
:oops:

Actually, once you have mastered the basics of stdio console apps, this is a reasonable next step. Under win32 (and most systems) reading from a serial port is very similar to reading from any other file (like stdin).

This assumes the device in question emits serial characters. If it does not, and some kind of device driver is required, find something else to do. Also, stay away from DirectX until you know what you are doing.

A few details for other posters:
DOS function Move File Pointer (42h) accepts 16 bits in CX, and another 16 in DX. All DOS programs are therefore limited to 2^32bit files regardless of the environment in which they run.

Both Clipper and FoxBase (later FoxPro) were knock offs of dbase II.
dbase II was derived from Vulcan.
Vulcan was a scaled down IMSAI version of the JPL's JPLDIS
JPLDIS was a knock off of RETRIEVE.
RETREIVE was a Tymshare Corporation (or IBM) product.

The first version of Ashton-Tate/Microsoft SQL Server was licensed from Sybase. Sybase is still in business.

FoxPro and SQL Server were released the same year (1989). Microsoft didn't buy Fox Software until 1992.

Dbase, Clipper, FoxBase/Pro, were all originally ISAM style databases. SQL Server, Sybase, Oracle, and DB2 are fundamentally different from these databases.
 

cas

Learning Storage Performance
Joined
May 14, 2002
Messages
111
Location
Pittsburgh, PA
The above comment applies to random file access (as in a database). Some programs which handle sequential files, may never deal with file lengths directly.
 

Handruin

Administrator
Joined
Jan 13, 2002
Messages
13,920
Location
USA
Well, I'm inclined to write an e-mail to the company which produces the transponder system. The company is called AMB. I see that they endorse one software package which I have tried the demo and did not care for it. They also mention two other software packages, one of which is jlap that I mentioned previously.

Now I wonder if I ask them if they have an API, or some type of documentation regarding the interface, perhaps I could still put together a simple lap counting system. I can't see how it could hurt to ask, the other software companies must have had some guidelines to develop a compatible system.

I would need to gain access to the actual system so that I can test the software, but the owner might let me if he knows there is something in it for him...

I have no doubt this is a very large goal for someone like myself who has no programming experience under the belt. The worst that can happen is I fail...and then try something else. I won't make any promises so not to hurt anyone’s feelings. :)
 

Cliptin

Wannabe Storage Freak
Joined
Jan 22, 2002
Messages
1,206
Location
St. Elmo, TN
Website
www.whstrain.us
You can do it Doug! But you need to start small. I suggest you ignore the telemetry stuff for right now and concentrate on the UI. Either pretend or initially design the program so that the lap marker (when a specific car crosses the line) in initiated by a human pressing a specific key. Say, everytime Car1 passes the line a human presses the 1 key on the keypad and so on for the other cars.

Try to design the program so that this part is modular so that when you start to get into the RF transponders it will be an easier transition. Don't worry about this difficult part of the program. You'll have about 15 other difficult parts to worry about. Except the other 15 have solutions you can grasp today. Just break down the large problem into smaller problems that are easy to solve.

Ignore the nay-sayers, you have a dream. That one day....
 
Top