Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Java Programming Part 1 (no actual programming in this one)


Java Programming Part 1 (no actual programming in this one)

By ghostghost | 3585 Reads |
0     0

Java Programming Part 1 (no actual programming in this one) *denotes side notes.

After spending some time on hellboundhackers.org, I came to a conclusion. While my current standing on the site is Active User and it took me just a few days to reach this level, I feel that I shouldn’t be on this site just to get a high score. I should be here to learn. There is much I still need to learn about hacking. For instance I know very little JavaScript so I have not yet done many of the challenges nor do I understand the injections. This will take time for me to learn, and I am a college student so time isn’t really my best friend right now. So, alas, I must take a break from the challenges until I have the time to devote to the challenges that I don’t understand.

Just because I am taking a break from the challenges and this site in general does not mean that I am giving up. I am actually going to do something better. I’m going to start writing tutorials and posting them on this site. This is the first in a series of tutorials I hope to write over the coming year. It covers Java programming. This first article will have little or no programming in it at all. The reason for this is I am going to assume that you are a complete new comer to the world of computers so I will start out with the basics you need to understand before doing any real programming and slowly work my way into the actual act of programming.

So without further ado I will begin to introduce you to the world of computer programming through Java. So let us begin by making a very important distinction between programming and what I will be actually teaching you how to do. I have used the word programming up to this point because you are familiar with it. I will teach you how to write software not to program. Programming is just the technical jargon used to create software, but there is a subtle distinction between that and the act of writing software.

Software has a bit of an art to it as well. You can write some pretty crazy looking programs that will function properly as I will give examples of later but this is not a good way of writing a program. A program should look beautiful so that you can understand it when you come back and make changes to the program and update it over time. If it is an open source program or if you are working on it with other people you will want others to be able to look at the programming and understand what is going on so in order to do that you will need a beautiful layout for your programs which I will delve into in more detail a bit later on in this series.

So now let us start at the beginning. How does that fantastic device you are currently staring at work? Well a computer is generally speaking made-up of two parts hardware and software. Hardware is like the name suggests hard that is you can physically touch it. It is the physical components that make up your computer while the software is the intangible instructions that tell the physical parts of the machine what to do.

We know software is made-up of programs, but what about the hardware? Well, there are four main parts to a computer system. The central processing unit (CPU), input/output devices, main memory, and secondary memory devices are the key components to computers. Understanding how this basic parts function will be invaluable in high level computer skills.

The central processing unit (CPU) is the device that executes the individual commands of a program. The CPU is often referred as the chip examples of this would be the Intel Pentium 4 or Sun ultraSPARC III processors. The main memory is a storage device that is active when the CPU is processing say a program. The input/output devices allow the computer and you to interact with one another in some way. A touch screen, a mouse, the monitor, etc. are all I/O devices. Then there is the secondary memory which is basically ways of storing things on the computer for long periods of time like a flash drive or the hard drive of your computer.

Now that you know what a computer consists of you probably wonder what that thing called the operating system (OS) is and why you actually need to use it. Well, the truth is you don’t need to use an operating system (OS). The computer runs just fine without one and when computers were first invented they didn’t have operating systems. The thing is those computers were very hard to use mostly because computers haven’t changed a whole lot since they were first created. They are dumb plain and simple. They understand only two things on or off (1 or 0). The reason why will be explained a bit later but suffice to say running a computer is very difficult without an operating system (OS).

The OS does the hard work for you by providing you with an interface and allowing you to do more complex things. It manages the CPU and the main memory as well. Some of the more popular operating systems out there today include Linux (there are multiple versions I like red hat), Windows, and Mac. I personally hate the Mac with a passion and will only use it if I have a big graphics project to do or I’m going to be doing a lot of reading because there is a really easy way to flip the screen from white background black font to black background and white font which is much easier on my eyes. At this part there are two other terms you should become familiar with like application and GUI. An application basically comprises all other software other than the OS. A GUI (point and click interfaces) use graphical screen elements to make it even easier on the person doing computing.

Now that you know all of this garbage or at least have picked up a few new things about computers you should probably be asking yourself another question. How does this machine store memory? Well, there are in fact two basic ways to store memory in a device one is analog where information is continuous which takes up a lot of memory or digital where information is broken into really small pieces and stored. Most things are, in fact, digital today because it is much more convenient and easy to store which means information is being lost in the process of storing the data. Your DVD’s and CD’s are not excluded from this which is why if you were to slow them down enough then you could see or hear the missing parts. As it is things are broken apart in such small parts that when played at a normal speed the human ears and eyes cannot see the difference.

Digital information is stored in a computer in binary or a system of numbers which consist of 1 and 0. A single binary digit is called a bit and it can store two values 1 and 0, two bits can store four values, and 3 bits can store 8 values etc. The function 2^n where n equals the number of bits will give the number of values that can be stored in a given number of bits. If you write a paper in word then each word will be first converted into a series of numbers using the ASCII table (www.asciitable.com has the full table). This table has assigns symbols, letters, and special characters into numbers. These numbers can then be converted into binary and stored in a memory device. These pieces of information are stored in sections of 8 bits and since there are 8 bits in 1 byte you will often hear the amount of space in a memory device referred to in bytes. The main memory of a computer is divided into several memory locations known as cells which are the equivalent of 1 byte. Large values will take up multiple consecutive cells when being run by the main memory.

Here is a fun fact you may not know about computers. A kilobyte doesn’t mean 1000 bytes in the world of computers. It is actually equal to 2^10 bytes or 1024 bytes. A megabyte is equal to 2^20 (over a million), a gigabyte is 2^30 (over a billion), and a terabyte is 2^40 (over a trillion). Just thought that was a neat little fact.

Let us take a quick detour from the topic at hand to clarify what exactly the main memory is by comparing it to the secondary memory. Both use the binary system to store data, but the main memory is volatile that is if the computer loses power the information on it will be lost and the secondary memory devices like the hard drive are nonvolatile so information is not lost unless it is deleted. The main memory will usually have a lot less storage space than the secondary memory devices most of the time, exceptions would be things like floppy disks and flash drives which may not store as much as the main memory. The reason for the main memory is speed it has less storage capacity but a lot more speed for reading and writing data than the hard drive.

Two other terms you need to familiarize yourself with are RAM (random access memory) and ROM (read-only memory). Both ROM and RAM are random access devices contrary to what the names lead you to believe, but they have an important distinction between them. The RAM is basically the main memory because the stored information can be easily changes while the ROM is as the name implies is generally speaking not altered at all.

So now that you know how a single computer works, it is easy to see how much can be done using different types of computers. So the next step would be to combine these machines on a network in order to do even more work. A network allows computers to exchange information between each other quickly and efficiently. A point to point connection involves hooking up computers directly to each other using a wire. This works well in small situations but as these connections multiply with each computer the networking slowly becomes a nightmarish tangle of wires. Computers on a network are assigned a network address to distinguish between computers on a network. Sharing a communication line is a cost effective and somewhat simple way of setting up a network but like everything else it has downsides. The major downside of this is networking delays which slow down the file sharing in the network. One way to improve your networking delay problems is to divide the larger messages up into small segments called packets and then send individual packets across the network.

Among networking there are many ways to set up a network some of which are much more secure than others. I won’t go into much detail in this guide because I’m just giving basic information about general computer terms before moving into the act of actual programming. A few other terms you should be familiar with are local-area network (LAN) and wide-area network (WAN). A LAN is designed to span relatively small distances and connect a few computers together while the WAN is used to connect multiple LANs together.

The most popular WAN ever invented was funded by the US government in the 70’s through the ARPA (Advanced Research Projects Agency) and improved upon in the form of the World Wide Web by the wonderful people of CERN. It was known as ARPANET, and I am sure most of you know it better as a little thing called the Internet. This WAN is governed by a protocol, a series of instructions telling things how they are to communicate. There is a set of protocols called TCP/IP that tell the internet how to communicate. The IP (Internet Protocol) software details the formatting of information and how it is transferred from place to place. The TCP (Transmission Control Protocol) software handles problems that occur with transferring information like reordering information if the transfer process were to make things arrive in the wrong order. Every computer that connects to the Internet has an IP address assigned to it which designates exactly where it is located so it can connect to the Internet.

Other things you should perhaps look up and learn more about are TLD (top-level domain, domain name, hypertext, hypermedia, DNS (Domain Name System), and HyperText Markup Language (HTML). In interest of saving time I’ve decided to exclude these things from the basics list.

Stay tuned for the next addition of this series which will actually delve into the details of basic Java programming. This will give you a nice background on computers in general which will be very important later on in the series of computer programming which I am writing because when I say something I would like for everyone to understand exactly what it is that I am talking about. Remember to leave comments. I love to hear back from people so as to improve my own understanding of things, and I am human so I do make mistakes especially typos so if something is off let me know and I’ll see to confirming what you say and correcting it. Oh by the way just for the hell of it I’ll go ahead and say this article is to be considered open source that is to say it is not written with the intention of making money nor is it copy write feel free to take it and copy and paste it elsewhere. I’m writing this using old lecture notes, several websites, and several computer books as resources, and I write it so that people may learn about computers not to make money or even get cited as the author feel free to even take credit for the entire series on another website if that is what you want to do. As long as people can learn something from it do what you will with it.

Comments
Uber0n's avatar
Uber0n 16 years ago

Very good 'basic knowledge' on many comptuter related topics, however the article's title is quite misleading but since it's just the first of (hopefully) many good articles that's ok. PS. Very sexy grammar ;) Awesome!

korg's avatar
korg 16 years ago

I really don't even want to comment on this article because I know I'll get carried away. This should have been titled "How computers work for first graders" Sorry very degrading and low level content.

ghost's avatar
ghost 16 years ago

I have to agree with korg… this is more of a primer for basic computer knowledge than it is an introduction to programming. There's a little bit of a lot, but hardly any of it actually visits on programming. None of it actually refers to Java. And none of it actually goes into any real detail about anything. A good article needs to be planned and structured; also, that article needs to stick strictly to the chosen subject. Your article is a better read than some on here, but it still doesn't do what it says it would.