A new project has been added

Hi everyone,

It’s been a long time since I’ve updated this blog. I wanted to announce that I added a new project to my Projects page. It’s an updater for a TunnelBroker IPv6 Tunnel, written in Python. You’ll see two versions listed. The first version is the original script, while the second version includes a password hashing program.

The requirements are Python 2.7.3 (although it’s a trivial task to convert it to Python 3.x), and you’ll have to fill in your information in the UserInfo.txt file. Try it out, and let me know what you think. And let me know what features you want to see included in it. My next plan for the script is adding some type of file size limitations, so you don’t end up with logs that are wiping out your hard drives. Right now, you have to manually clean the results.log file out (although after a week of running, it’s only at about 5KB).

Have a great day:)
Patrick.

Learning to Program- Two Main Types of Errors

In programming, you’ll encounter a lot of different errors. Syntax errors, functional errors, configuration errors, and more. All of the errors can be classified as two main types though: compiler (or compilation) errors and run-time errors.

Compilation errors are the syntax errors and other problems encountered while creating the program. They are found and fixed before the program is released to the customer (end-user or the public, as the case may be). These won’t impact the customer, because you’ll fix them before you release. Otherwise, your program won’t work.

Run-time errors are errors that involve the logic or function of the program. Some of them will happen before release, and some will happen after. The goal is to make sure most of them happen before release, but nothing is perfect.

One example of a run-time error is in a program that I’ve been developing. Essentially the program is an updater for an IP Address. The error is that once I enable “Automatic updating”, I can’t disable it (or change the time-frame for the updates). It’s a functional error, because while the logic is sound (making sure you can automatically update and set the interval), the way it’s implemented doesn’t work.

If you have run-time errors after the program is released, you’ll be informed via bugs or security notifications (depending on the type of error). Some of the errors are features that don’t work properly, features that people want, security vulnerabilities, or other problems.

The point here is two-fold. First and foremost, you’re going to run into compilation errors and run-time errors. If you don’t, then the program was either fairly simple, or you didn’t write it. Now, let me clarify that occasionally you’ll write a complex program without any errors–but it’s rare.

Secondly, your goal is to minimize all of the errors as much as possible. Your goal is 100% perfect code. Your reality should be somewhere between 92% and 98% perfect code. Don’t release unless your compilation errors are 2% or lower, and your run-time errors are 5% or lower.

And test for every possible scenario that you can think of. Even the ones that are highly improbable. Because, the more people who use the program, the more probable one of those scenarios will happen. And have others test for everything they can think of also. That’s how the “professionals” do it.

Have a great day:)
Patrick.

E-Book on Programming and Logic

I’m planning on writing an e-book about Programming and Logic. Right now, I have a basic Table of Contents set up, and I want to get some feedback from people who are learning to use Pseudocode and Flowcharting.

Some questions that I have for you are these:

1. Which do you think is harder, creating flowcharts or pseudocode?
2. Would you prefer to see a) more flowcharting examples, b) more pseudocode examples, or c) an equal share of each?
3. Which aspects of logic are you struggling with (for example but definitely NOT limited to: variables, arrays, looping, decisions, methods, classes, objects, or data types)?

Please post in the comments section, and I’ll be more than happy to frame the book along the requests. Also if there are other subjects that I haven’t covered in the questions, please post those as well.

At some point, I’ll be posting the table of contents for opinions on things like the chapter names, the order that I’m presenting things, and the structure of the book overall.

Thanks, and have a great weekend. 🙂
Patrick.

An important note to consider in Programming and Development

When you take a course in Programming or Logic, you’re taught a certain way of doing everything. It varies by the language, but you’re taught to indent your code a specific amount of space, use certain namingConventions for variables, put braces and other symbols in a specific way, and other things.

The problem with this is the industry and your future (or current) employers may not follow these conventions. And your instructors (and books) won’t point this out to you. So you have to find out what the current industry (and employer) standards are, and follow those. In short, you need to overcome and adapt to the environment that you’re thrown into.

It really becomes apparent if you’re employed by a company to code, and you also code for other projects on the side. For example if you’re a C/C++ coder, your employer may follow the industry standards (or not). And if you decide to write code for the Linux kernel. The kernel has it’s own set of standards–ranging from how to indent and how far to indent, to when to put the {}’s on the same line or a new line. They don’t necessarily follow the industry standard.

Again, your instructors and books won’t talk about this. Their goal is to show you everything in one easy to learn fashion. The industry expects you to adapt what you’ve learned to their version of “reality”. So if you’re taking programming courses now (or plan to), remember that what you learn is just the foundation for what you’ll do. The foundation will look the same regardless, but what you build on that is up to the needs/wants of whoever you’re building it for.

Have a great day:)
Patrick.

Oracle vs. Google—What does this mean for you?

Yesterday, Oracle filed a lawsuit against Google concerning the use of Java in their Android operating system.  It wasn’t so much that you can use Java in web browsers or even Java applications per se.  It was more along the lines of Google took the syntax from Java and tweaked it a bit, so it wouldn’t compile on Java compilers.  At least this is my interpretation from the little that I’ve read.

So, what does this mean for you?  Well, if you’re a developer for Android (or a user of Android phones) it may mean a lot.  Depending on what the outcome of the lawsuit is, you may not be able to develop in Java anymore for Android.  And if you’re a user, then the applications that you’re running may disappear or change.

What if you’re a developer in general though?  Does this mean that Java is a hands-off language?  No.  You’ll still be able to develop applications that run on the Java Virtual Machine, and use Java Libraries.  What this means is that you can’t create your own Virtual Machine and Libraries that are basically Java wrapped up in another package.

Over the next few days and weeks, I’ll be reading more about this lawsuit. As I learn more about what it’s over, and what the ramifications are in general, I’ll post more about it.

Have a great daySmile
Patrick.

Integrated Development Environments (IDE)—to use them or not to use them…

What do Visual Studio, Eclipse, Netbeans, Notepad, Notepad ++, and vi/emacs all have in common?  They are all used for creating programs.  What are their differences?  Aside from the compiler that they use to build the code into object code (and executable code), the difference is that the first three in the list have the compiler/linker integrated in them, while the last four require you to compile the code separately (technically you may be able to compile the code from inside Notepad ++, but it doesn’t come with a compiler).

So, should you use an IDE or not?  And which one should you use, if you choose to?  These are the questions I’ll answer in this post.

IDE’s.. Easy or Lazy?

Purists may claim that you don’t need the IDE, and that it makes you lazy because it does some of the work for you.  However, the opposite can be said (that it makes you more productive for those same reasons).  The answer may depend on the programming language. 

If you look at a Java program that was created in an IDE compared to one that was created in Notepad or Notepad ++, you’ll find that they are virtually identical.  The main diference would be that some code may have //Automatically Generated next to it.  But, it’s all code that you would have put in yourself in Notepad++.

However, if you look at a Visual Basic program in notepad, there is a lot of extra code that you’re not aware of.  It’s the background code for creating the forms and making the application compile.  But it’s also code that you wouldn’t normally think to type in.  So, as you can see it depends on the programming language, as to whether it helps you or makes you “lazy”.

Which IDE Should You Use?

The simple answer is the right one for the language that you’re coding in.  Although it’s a little more complex than that.  If you’re a Visual Basic or other “Visual” (Microsoft) programmer, then you’ll essentially be limited to Visual Studio.  You may be able to program some of the languages in Eclipse, but Visual Studio is the best suite for the job.  The main problem is that you either have to pay for VIsual Studio (unless you’re a student, in which case you can get it through dreamspark.net) or you have to use the functionally limited “Express Editions” (which can’t be used for commercial purposes).

Now, if you program in most other languages, you can use Eclipse along with their plugins for the specific language.  If you’re programming in Java, you can use Netbeans (which is developed for Java) or Eclipse.  Some of the other languages (such as Pascal or Delphi) also have their own IDE that you can use.  Pascal is an older language, which has been replaced by Delphi (and you’ll have to pay for the Delphi System).

Personally, I prefer the IDE systems myself.  They simplify a lot of the background tasks and make sure that the backbone of the code is correct.  Which leaves me with more time to add the rest of the code, and get the application up and running sooner.  What are your opinions on IDE’s?

Have a great day:)
Patrick.

Object Oriented vs. Procedural Programming

There are essentially two types of programming styles in use.  One is Object Oriented Programming (think Visual) and the other is Procedural based programming.  Depending on which style you learn, the other looks alien or even unorganized.  Some languages have a combination of the two, while others sit on one side of the fence or the other.  And while you can make an attempt at Object Oriented programming in a Procedural language, it’s not the same.

Object Oriented Programming:

An example of OOP is Visual Studio.  You will design a form with controls on it, and depending on what actions the user takes, the controls will execute some code.  This is a really basic interpretation of how an OOP language works.  The thing that makes object-oriented languages run is the object (no doubt).

Objects can be buttons, list boxes, text boxes, classes, or anything really.  Their main distinction is that they have properties (or attributes) and methods which act on those properties (events).  If you’re using Windows, then you use Object Oriented programs every time you do anything.  Any window is an example of Object Oriented Programming.  This also applies to Linux and Mac OS, although they are created in a different language than Windows.

Procedural Programming:

An example of Procedural Programming is COBOL or Pascal.  Since the applications are ran on a server—with no windows per se, they don’t need to have events or objects.  The main difference between an Object Oriented Program and a Procedural Program is the procedural program will start at line 1, and essentially go through to the last line.  It may jump around, but it will always return to it’s jumping point and continue on.  When it reaches the last line, it will end.  You will have to run it again.  An Object Oriented program will continue running until you end it (clicking the “X” or “Exit” button).

If you learn to program in a procedural style, then the first time you run an OOP style program, it looks alien.  You can’t find the starting point, and you can’t follow the flow very easy.  Likewise, if you learn to program in Object Oriented Styles, the Procedural style will throw you.  You’re expecting the user to have to trigger the events, but they happen on their own.  You expect the program to run until you stop it, but it stops on it’s own.

Hybrid Programming Languages:

Some languages are what I would call Hybrids.  They can be either procedural or object oriented.  C++, Java, and Delphi (which is an OOP form of Pascal) are examples of these.  They are hybrids because you can create procedural versions of applications, or you can use a Visual Designer (or code by hand) and create OOP style programs (which require events).  They still look alien to procedural style programmers because they don’t start at line 1 and go to the end.  But they are not completely Object oriented either.

The point of this post is to introduce you to the different programming styles.  Each has a place in the world of computers.  And it’s good to learn both styles, so you can adapt to the requirements.  Also in some cases, you can adapt one style to use some of the characteristics of the other.  This makes you a well-rounded and more essential programmer.

Have a great day:)
Patrick.

Microsoft has released Visual Studio 2010 and Office 2010

This is slightly old news, but Microsoft released Microsoft Visual Studio 2010.  You can get more details on what it includes and the new features at http://www.microsoft.com/visualstudio along with prices.  If you are a student, then you should be able to download it from your college’s MSDNAA site, or you can sign up at http://www.dreamspark.net to download it for free.  You will have to use your campus email address, as they verify that you are a student.

Microsoft also finalized and released to manufacturing, their Office 2010 suite.  For students, they include a special version of the “Professional” version for $99.00.  (This price is per ZDNet, as I haven’t seen the final prices).  If you’re a Technet subscriber, you can download it now.  Otherwise it will be available to the general public in June.  You can also purchase the Office 2007 Ultimate Steal (if you are a college student) right now at http://www.ultimatesteal.com and are eligible for an upgrade to Office 2010 for free when it’s actually available.  Essentially this means that you’ll only have to pay $69.00 or so for Office 2010 Ultimate (or any version that they send you for the upgrade)—which is well worth the money.

Have a great day:)
Patrick.

Learning to Program—Random Thoughts with a Theme

I’m learning how to program in Java, and at the same time I’m tutoring students in Visual Basic.  So, as I learn things, and as I help them to learn things, I plan on posting them here.  I will identify the subject as Java or Visual Basic (or if it’s applicable to both equally, I won’t identify it).

The most important thing to know is that you need to make sure you find out the preferred standards for the language you are learning.  Although I would like to see a standard naming convention, you won’t find a totally standard one yet.  The closest thing is the Berkley style.

Some examples of needing to know how the language prefers things are listed below.

In Visual Basic:

Variable names start with a three letter prefix denoting their data type.  dbl for Double, str for String, cnst for Constant (yes I know it’s four letters), int for integers.   This also applies to objects and classes.  For example, lbl for label, txt for textbox, cls for class, or btn for butons.

You declare variables using a DIM statement.  The syntax is Dim variablename As datatype.  For example, Dim intNewNumber As integer

The variables are required to be declared before the first line of code (in the declarations section).

In Java:

You don’t use prefixes in your variable names.  However, you still use the camelCase and make the variables descriptive.

The declaration is type variable = new type;.  For example, Integer newNumber = new Integer;

The variables should (but are not required to) be declared before the first line of code.  They are required to be declared before you use them the first time.  It’s good practice to declare them at the top, so you don’t have them scattered throughout the application (especially if it’s a long application).

Visual Basic is typically taught as a GUI (Goo-ey) type of application.  This is because it’s designed to resemble Windows applications.  There are some non-GUI apps (such as asp.net webpages), and it does use behind the scenes stuff.

Java is originally a console type of application (read command prompt).  It does have the GUI capability, but you don’t see that very often.  The most common use for Java is “Server side” applications, which are presented in a web browser.  Hopefully as more people discover the functionality of the GUI in Java, we will see more apps created for it.  This is especially beneficial, since Java runs on virtually any platform—where Visual Basic mainly runs on Windows-based platforms (not withstanding mono or other attempts to port it to Linux or other platforms).

It should be noted that I use Visual Studio 2008 for Visual Basic, and Netbeans 6.7 or 6.8 for Java.  You can get these from http://www.microsoft.com/visualstudio or http://www.netbeans.org respectively.

Have a great day:)
Patrick.

Learn to Program – Stage 7 (Maintenance)

Stage 7 is probably the strangest stage.  Why do I say this?  Because maintenance means a lot of things.  If the program is decently coded and no bugs are found, then the maintenance stage basically means leaving it sit.  However, if bugs are found, then you will be going back through Stages 5 and 6 to correct them.  And if more (or new) features are requested, then you may have to go back through all of the stages to complete the task.

At some point, maintenance actually becomes a whole new concept with it’s 7 stages.  Although most of the hard work will be done already, so it won’t be as involved as the original coding process.  One thing that you can do to ensure the ease of maintenance is to plan for the future of the program when you are designing it. 

The concept of looking three steps ahead applies in chess and coding.  As you’re designing the program in the early stages, consider the other things that you would throw into the program (if you could).  Design the code so you can incorporate them into the program—if someone requests it. 

But don’t go overboard with this.  You don’t need (or want) to create empty classes for these items.  But you want to code the program in such a way that you can add classes (and interfaces to those classes) with minimal rewriting.  As you are creating your classes, decide if any of them could be easily tweaked to add features.  If so, then design them in such a way that you can add those features.

Even now, when the idea of code optimization isn’t the “in thing” (because of large amounts of memory and CPU power), you should code in such a way that future versions will not increase the footprint dramatically.  I would suggest coding for optimization anyhow.

Coding for optimization is similar to how people coded in the 80’s and 90’s.  There was very little memory available to them, and the CPU’s weren’t as powerful (or capable) as they are now.  So, the programmer optimized the code in such a way that it accomplished a lot without requiring a lot to do it.  In short, it means that if you can code something to use 1MB of memory, why would you code it in such a way that it uses 3MB?

Have a great day:)
Patrick.