Monday, 15 September 2008

Beginning Programming By Greg Perry - Final Part

Last week back i started reading Beginning Programming Book By Greg Perry.

I wanted to share few important quotations i found from the rest of the book.


1) All Java programs are actually objects themselves. The entire Java program you write is an object. There exists a special highest-level object called the java.lang.Object. Your program is a derivation from that object. When you derive one object from another, or inherit an object from another, the derived object takes on all the properties of its parent object, the higher-level object.

Here is the line that derived from this special Java application object in this hour’s earlier programs:

public class Main_1 extends java.lang.Object {

In other words, you created a Java application, an object, from the java.lang.Object object. More specifically, you created a new class by inheriting from the java.lang.Object class. You extended a new object from an existing one that represented a generic Java application.

2) Java is known as a call-by-value language because a called method can never change the calling method’s argument data. The called method can use and modify the arguments within the called method’s statements,
but when control returns to the calling code, the variables sent as arguments to the methods are unmodified in the calling method.

3) C is highly efficient and C’s developers required that efficiency because until C, programmers used assembly language, a language just above the machine language level, to write operating systems. Only assembly language had the efficiency needed for systems programs. C brought the advantage of a higher-level language to the table when developers used C for operating systems. Along with the efficiency of a low-level language, C has the high-level-language advantage of being more maintainable and programmers were more easily able to update the operating system and produce accurate code. Assembly language doesn’t lend itself very well to proper program maintenance

4) What You Need for C and C++ Programming

To program in C, you need a C compiler. Today, when you obtain a C compiler, you almost always get a C++ compiler as well. Therefore, you get two languages for one,although C++ is really just an extension of the C language. One of the most popular C compilers sold today is the Windows-based Visual C++. Fortunately, Visual C++’s interface
is virtually identical to that of Visual Basic’s interface, so you’ll already feel at home using the Visual C++ environment after the previous hour.

Creating a Windows application in C (or C++) is not as simple as creating one in Visual Basic. Remember that developers created Visual Basic from the beginning to be a Windows programming system. C, on the other hand, began in the world of text-based computers. Therefore, nothing is embedded in the C or C++ programming languages to support a graphical interface

5) The printf() Output Function

The most common I/O function is the printf() function. printf() outputs data to the screen in most cases (although the programmer can route the output to other devices, if needed, through operating system options). Here is the format for printf():

printf(controlString [, data]);

6) Object Terminology

• Abstraction—The internals of an object do not always have to be known by the programmer to use an object.

• Class—The definition of a related group of objects.

• Inheritance—The ability to create a new class of objects from an existing class. By inheriting a new class of objects, you can create new objects with new behaviors and characteristics based on existing objects and classes.

• Message—A command that acts on specific objects as opposed to the other language commands that are not tied to specific objects.

• Object—A collection of characteristics and behaviors, perhaps even two or more variables treated as a single unit, that appears in OOP programs.

• Polymorphism—A name given to the ability of different objects to respond differently to the same commands (called messages).

• Reuse—The ability of the language to utilize objects defined in other programs.

7) The Common Language Runtime

.NET will support a Common Language Runtime (CLR), whereby the .NET-compatible operating system on any device will be able to execute any program written in a .NET supported language that compiles into the CLR’s special code. CLR might sound difficult to understand at first, but it’s simple. A .NET-compatible language such as Visual Basic, Visual C++, or C# will not compile to a specific machine, as is historically the case for computer languages, but rather will compile to a common machine language. Every .NET-based operating system will emulate this common language.So, in theory, a single program written in C++ could run, unaltered, on a PC, a
palm device, and on WebTV, assuming those three devices were designed to support the .NET framework.

By the way, expect .NET-based versions of Microsoft’s languages to be given new names. Visual Basic will probably become VB.NET, Visual C++ will probably become Visual C++ .Net and so on. C#, however, looks to still be called C#. (As you’ll see in a later section, C# is a language designed specifically for .NET applications.) All of these languages will compile into CLR code that will operate in any .NET-enabled operating environment.

About the Author

Greg Perry has personally taught thousands of people how to program in the classroom and lectures, as well as impacted the computer world through the sale of more than two million computer books sold internationally.

He has been a programmer and trainer for the past 20 years. He received an undergraduate degree in computer science, followed by a master's degree in corporate finance. After working as a supervisor of financial systems for a Fortune 500 company, he turned to teaching at the college level, where he remained until he began to write full-time and lecture at programming conferences.

Some of his other book titles include Sams Teach Yourself Visual Basic 6 in 21 Days, C by Example, and several books in the 24 Hours series, including Sams Teach Yourself PCs in 24 Hours, Sams Teach Yourself Office in 24 Hours, and Sams Teach Yourself Windows Millennium in 24 Hours. He has also written articles for several magazines, including PC World and Data Training. He is fluent in several computer languages and speaks a little Italian as well.

No comments: