Wednesday, March 30, 2011

Source Code vs. Executable Code

Source code and executable code are two terms for different levels of computer code.  They could both mean different things depending on the context they are spoken in.  Source code is generally the code given to a compiler or interpreter to create object code or target code.  In short it is the input code, while object or target code is the output.  Source code is generally a high-level language.  Computer code can go through several transformations before it is turned into machine code that is directly readable by the computer’s processor.  Therefore, the object code or target code of one device could be the source code of another.

Executable code is code that is directly executable by a computer’s processor.  Usually, it is machine code, an array of 1’s and 0’s that a computer can understand depending on the organization of these 1’s and 0’s.  However, in a general sense, executable code can also be a file containing instructions for an interpreter, such as bytecode or scripting language.

An Interpreter is an application that translates a higher-level computer language to a lower one and executes it at the moment the program is run.  Relating this to say a music program, it’s like hitting the space bar on a song you’ve recorded.  You instantly get to hear every track you’ve recorded, along with all the effects, automation, etc.  You can use this to listen to your work in progress and make tweaks to your song (program) in order to make it better and fix any flaws (bugs).

A Complier on the other hand does basically the same thing.  It translates your program from the high level language that you’ve written it into a lower one but it doesn’t do it in real time.  Instead it takes time to interpret your code and outputs object or target code.  Once completed you have your program but transferred to a different computer programming language.  In my mind this relates to a music program as an offline bounce to disk.  This is when you believe you have recorded everything you need to record, made all the edits you need, added all the effects you want, and completed all automation on every track.  When you are done with everything you can do to your song (program), you bounce it to a two track.  You choose the file format you would like your song to be converted into, the program then runs through the song and turns your multi-track project into a two-track stereo version, which can be played by any music player or burnt to a Compact Disc.

Assemblers take assembly language and convert it into machine code a computer’s processor can understand.  Assembly language is unique to each processor in language, but most use the same instruction statements that are used to define program operations.  Assembly language is the closest language to machine code.  Assemblers are used to squeeze the last bit of performance out of a processor by working near machine code level.  Because of this I relate it to the mastering process in music.  Once you have mixed all tracks of your multi-track recording and performed an offline bounce, creating a stereo two-track.  Mastering is the next step in which you make small tweaks to the equalization and compress the two-track to bring out every bit of feeling in your music.  This is similar because it squeezes every last bit of performance out of your two-track.  Also your mixed two-track before mastering is the closest representation of your song before it is finished, just as assembly code is one step away from machine code.

Wednesday, March 23, 2011

NetBeans with BlueJ or Visual Basic


When choosing an IDE (Integrated Development Environment) and GUI (Graphic User Interface) language for developing a small game, there are many different options.  Two of the most prominent Integrated Development Environments for GUI development are the NetBeans IDE BlueJ Plugin and the Visual Basic IDE.

Visual Basic is an object based and event driven programming language.  The Visual Basic language was derived from BASIC and allows programmers to create simple GUI applications and more complex applications.  Programming can be done by visually arranging components and controls. Components and controls are organized on forms using a drag and drop technique.  These components and controls contain default attributes and actions making a simple application easy to produce without writing many lines of code.  To create more complex applications these default attributes and actions can be modified by rewriting the code associated with them.  Visual Basic can create executable files, AxtiveX controls, and DLL files.  There are many small games available for free online written with Visual Basic, from poker games, RPG’s, tetris, minesweeper, etc.

NetBeans is an IDE used for developing with Java, JavaScript, Python, Ruby, C, C++, and other languages.  NetBeans is written in Java and can be used on any operating system with a Java Virtual Machine installed including Windows, Mac OSX, and Linux.  The GUI design tool is a drag and drop based GUI builder.  BlueJ is an IDE for Java and is primarily used for educational purposes but is also suitable for small application development.  BlueJ is now available as a plug-in inside the NetBeans IDE.  It assists BlueJ users in the transition to using NeatBeans, a more versatile and professional IDE.

Both Integrated Development Environments would be good for developing a Graphic User Interface for a small game.  Yet, each has some advantages depending on the circumstances of your project.  If you are proficient in Visual Basic I would stick with that.  Many simple games are written in Visual Basic. They can be easily created, edited, and compiled into an executable file.  The Visual Basic IDE’s user interface allows a developer to create a GUI with little to no actual code writing.

The NetBeans IDE’s BlueJ Plug-in also has its advantages.  NetBeans can be ran on any operating system because it is a Java based application.  Like Visual Basic, NetBeans has a very simple user interface.  The implementation of its drag and drop capabilities make it easy to use with little code writing necessary.  BlueJ allows a developer to see a clear layout of the application being written and its GUI.  Also with NetBeans you can utilize many different programming languages.

As an owner of a MacBook, I would choose to use the NetBeans IDE with the BlueJ plug-in.  My choice is mainly because it works with the OSX operating system, but I also like its ease of use and that it can help me transition to using the rest of the NetBeans IDE for more professional software development.  Visual Basic seems like it would be great for the job at hand (developing a GUI for a small game), but I like that NetBeans is able to create more advanced and professional software as well.

Monday, February 21, 2011

Object-Oriented Programming Languages

The following programming languages are some of the most commonly used object-oriented languages.  They are all similar in some ways and different in others.  Some are derived from the C language, some from Pascal.  Some incorporate Smalltalk, others do not.  Some are multi-paradigm languages.  Each language is different and has its advantages and disadvantages.  The program you are writing and its needs determine which language would best facilitate it.

JAVA
Java derives most of its syntax from C programming language.  Although it shares syntax with C it has a simpler object model and fewer low-level facilities.  Java uses a compiler to transfer Java programming language into Java bytecode, which can be interpreted by any Java Virtual Machine.  This enables Java programming language to be read by any computer regardless of the computer’s architecture.  The Java Virtual Machine acts as an interpreter for your computer and translates the bytecode into machine code readable by your computer.  This enables Java programming to be written once and run anywhere.  Due to its ability to be ran on any computer Java is currently one of the most popular programming languages.  It is used for application software and web applications.

C++
One of the most popular programming languages ever created is the C++ language.  C++ was derived from C with classes added to it.  C++ has many uses including: writing systems software, application software, device drivers, embedded software, high-performance server and client applications, hardware design synthesis, and video game software. 

Python
Python is a multi-paradigm programming language.  It permits the use of object-oriented programming, structured programming, functional programming, aspect-oriented programming, and many other paradigms with the use of extensions.  Languages such as C, C++, and Java are incorporated into Python.  Python is a scripting language that emphasizes code readability, simplicity, and ease of use.  Although C and C based languages are incorporated in Python, Python’s primary language abandons the C language for more readable commands.  Python utilizes dynamic typing and automatic memory management.  Python is a scripting language for web applications that is used by many large organizations including YouTube, Google, Yahoo!, CERN, and NASA.  It also is used for 3D animation packages and 2D imaging programs.

Objective-C
Objective-C is an object oriented programming language used primarily for Macintosh’s OS X and iOS operating systems.  Objective-C is a reflective language meaning that it can observe and modify its own structure and behavior in runtime.  Objective-C adds a Smalltalk style of messaging to the C programming language. Objective-C defers some decisions until runtime that C++ would make at compile time.  These decisions are known as dynamic dispatch, dynamic typing, and dynamic loading.

Delphi
Delphi is an object oriented, visual programming environment.  It is used to develop 32-bit and Microsoft.net applications that can be used on Windows and Linux operating systems as well as on the Internet.  Delphi has many different revisions, most currently Embarcadero Delphi XE, and is still evolving to complement evolving computer technologies.  Delphi allows you to build applications faster with pre-built components and a drag and drop visual design.  Many applications are written in Delphi including Skype and FL Studio (formerly Fruity Loops).

Ruby
Ruby is a general purpose, multi-paradigm, programming language that supports object-oriented, dynamic, functional, imperative, and reflective paradigms.  It utilizes syntax inspired by the Perl programming language with Smalltalk like features.  Ruby also uses a dynamic type system and automatic memory management like Python’s programming language.  Ruby is mainly used to create interactive web pages.

Wednesday, February 16, 2011

Interpreters and Compilers


Compilers and interpreters are programs that translate high-level programming languages or source code such as C++, Java, Pascal, Python, and Objective C into low-level languages such as machine code, and assembly language and vice versa.  While both types of programs do basically the same thing, the way they work is different.  Compilers will translate a whole program at once and create a file from your chosen programming language, which is executable by your operating system.  Interpreters translate your chosen programming language line by line.  It translates each line and runs those instructions before moving on to the next line.  Usually, compilers are used for more advanced programming languages such as C++ and Pascal, while interpreters are used for more basic languages such as JavaScript and Basic.

Compilers turn source code into machine code and save an executable file as the result of this process.  You can then open the executable file and your computer will run your program.  Compilers produce programs that can run quickly and compilers also can spot syntax errors as they are compiling and translating data.  Downsides can be a lengthy compile time and although compilers find errors, it still doesn’t mean your program will be completely free of errors.  A compiler’s complexity depends on the syntax of the language you are compiling.  A C compiler is much simpler than a compiler for C++ or C#.

Interpreters execute source code directly.  They do this by executing written high-level languages line by line.  The plus side to interpreters is that you could run programs without waiting for lengthy compile times to complete.   The problem is that they only store the machine code in memory instead of a separate executable file like a compiler does.  This makes distribution a problem because you would have to distribute your source code along with an interpreter that can convert your source code into machine code.  The original reason interpreters were invented is because compilers were so slow.  Nowadays, compilers are much faster and interpreters are mostly used for running scripted language and for learning purposes.

Interpreters and Compilers for BASIC, PASCAL, C, and C++ can easily be found with a simple Google search.  Simply search, “interpreter or compiler (whichever you are looking for) for a programming language and your operating system.”  There are tons of free interpreters and compilers out there for all of these languages.  For a Mac you get a free program with your operating system called XCode.  Although I haven’t used it yet I believe that it only compiles Objective C language.  To use XCode you need a Mac with an Intel processor, Mac’s Snow Leopard operating system, and you need to be registered as an Apple developer, but this is easy to do.  It’s just an online registration process and it’s free.  You can download XCode from Apple’s website or install it from your operating system install disk.

A few places I found with many compilers and interpreters are:

Once you have your interpreter or compiler, all you need is a text editor to write your code.  When your code is written, open your saved text file of your code and watch it come to life!

Monday, February 7, 2011

Common Programming Paradigms and the Language of the Future

Today there are many different Computer Programming Languages.  These languages are different, but use similar techniques called paradigms.  Deciding which language is best to use when writing your program is incredibly important.  To do this, find out what paradigms you would need to utilize to properly operate your program, and find a language that uses those paradigms.  Also using a commonly used language can be to your advantage.  Following, are four of the most common paradigms that programming languages use, and some advantages and disadvantages of each.

Object-Oriented Programming Languages are programming languages that use objects (independent entities which contain data and can respond to messages).  OOP is widely used, most commonly with the C++ and Java languages.  The advantages to using OOP include:  They are easier to learn, understand, manage, and maintain; objects can be derived from classes (a collection of objects of similar type) making similar objects easier to write; and OOP’s are easier to test and debug.  This is possible because if there is a problem with one or multiple objects, those objects can be independently re-written.  Otherwise a program would have to be re-written as a whole, taking much more time and effort.  OOP also does a good job of modeling the real world.  This is because ideas are organized like the real world with similar items (objects) grouped into categories (classes).

Although Object Oriented Languages are easier to manage and maintain, thus less expensive in the long run, there is a much higher upfront cost.  Thus it is used more for programs that are large and expected to be updated in the future.  OOP’s are best used for programming large applications.  For many small programs OOP gives no advantages over other languages and would require more time to write.  In addition OOP requires more memory to run, so if you are trying to write a small fast running program, OOP languages are the worst choice for your program.

Procedural Programming also known as imperative programming contains a series of steps for a computer to carry out.  Procedural Programming Languages utilize a small amount of memory, are simple in structure, and are easily implemented with compilers and interpreters.  The simplicity of Procedural Programming Languages makes it unusable when writing more complex programs.  It is considered to be less productive than other paradigms.  Procedural Programming carries out one process at a time, so when you are writing programs which require parallelization (two processes being completed at once) Procedural Programming languages are unable to carry this out.

Functional Programming Languages are computer languages that are treated by computers as mathematical functions.  It was derived from lambda calculus, by forming programs designed by the composition of functions.  Functional Programming avoids mutable data (objects that can be modified after it is created).  The earliest functional programming language was LISP, although it does contain non-functional elements.  LISP was pre-eminent in the development of Artificial Intelligence programs.  Advantages of Functional Programming are that programs can be easily understood, functions are reusable, and large programs containing thousands of functions are possible because the functions have no side effects.  Downsides to Functional Programming include efficiency (relating to it’s use of CPU and memory), difficulty doing input-output, and that some aspects of problem solving can’t be performed in a functional manner.

Logical Languages, including PROLOG (the most prominent Logical Programming Language), use predicates and rules of inference to determine an output.  Logical Languages are good at reasoning about programs, have well understand semantics, and can lead to concise solutions to problems.  Although Logical Programming can reason about programs they have trouble understanding and debugging large programs.  They also are slow in their execution and have a limited view of the world (only understands it’s predicates and rules of inference).

Of all the programming languages available today I think Objective C will be used frequently in the future.  It is used mainly for Mac’s OSX and iOS software.  There has been a surge in Objective C’s use in the past few years due to Apple’s iPhone and the high use of it’s apps.  This will only expand now that Verizon has the right to sell iPhones, ending AT&T’s exclusivity rights to the highly popular iPhone.  Python seems to be another language that is on the rise recently.  Many large corporations use Python including Google, Yahoo!, and YouTube.

Sources:

Sunday, January 30, 2011

Wireless Security: Easily Fool Proof, but Hard to Foolproof

After reading the two articles on Wireless security, it’s safe to say that there are many ways to secure a wireless connection to the internet.  Each offers another level of security to prevent others from connecting to your wireless network.  People can easily access your network if none of these security measures are implemented, and can use this connection to access the internet or even access files on any other computer connected to the same wireless network.  Many of these security measures are easy to implement and require no extra devices or software.  Both articles made suggestions as to what you can do to make your wireless network more secure.  One article was focused on wireless security at home while the other focused on wireless security for your business and the possibility of needing to secure many computers as opposed to just a few.

The first thing you should do is to change the default administrator username and passwords for all of your access points.  Doing this stops others from changing options on your access point or router.

Both articles suggest that you enable WEP or Wired Equivalent Privacy, which uses an encryption key to secure access.  WEP can possess either 64 or 128 bit encryption.  One of the articles also mentioned WAP encryption.  WAP or Wi-Fi Protected Access is like the next generation of WEP.  WEP uses a static encryption code which hackers can discover using reverse-engineering.  Using WAP allows you to use a temporary encryption key, which changes with every data packet sent or received.  While WAP is supposedly more secure both systems can be hacked into and are not 100% foolproof.

Both article also mentioned to change the Default SSID of your modem/router.  Your SSID is the name of the wireless signal broadcast to computers within range.  Normally the default SSID is the brand name of your WIFI device.  Most devices broadcasting a default SSID are considered to be poorly configured WIFI networks, especially considering that changing the SSID is one of the easiest things to do.  One of the articles suggested not changing the SSID to your company’s name, address, or any name that would attract attention.  Another option for your SSID mentioned by both articles, is to disable the broadcast of your SSID.  Disabling “Broadcast SSID” will prevent your SSID from appearing as an available network when nearby computers are trying to connect to a network.  You must then know the SSID to connect to your network as opposed to just choosing it from a list of networks.

Enabling MAC address filtering is another security measure mentioned by both articles.  MAC address stands for Media Access Control address.  Every device that can connect to a wireless network has a MAC address. By enabling MAC address filtering on your router, you can effectively limit the MAC addresses that your router allows to connect to it to only your wireless devices.  Similarly each device has an IP address.  DCHP automatically assigns an IP address to devices trying to connect to a network.  By assigning static IP addresses for each computer or device and turning DCHP off on your router and only allowing IP addresses from your devices.

Positioning your router in the middle of your home or office building will not only spread access throughout your building, but also limit the area outside that can access your network.  Try to keep your router away from an outside wall or windows.

Other ways of improving security are by enabling firewalls on your computers and/or routers, turning your network off during extended periods of non-use, and don’t connect to open WIFI networks. 

For large networks connecting many computers (usually a business or corporation) I’d recommend using a VPN to provide the best security out of any of these options.  The downfall to VPN’s are they are expensive to set up.  For a private home network or small business, I’d recommend using a few of the techniques above.  The more you use, the more secure your network is.

Friday, January 28, 2011

The Death of Browsers? I Think Not.

The article from Wired.com Magazine, “The Web is Dead.  Long Live the Internet”, is about the emergence of applications on wireless devices such as iPhones and Android phones as well as on Blu-Ray players and home gaming systems.  The article claims that applications are taking over how we use the Internet.  It says that instead of the traditional way of “surfing the web” using a web browser, people are using applications such as “Facebook”, “Twitter”, “Netflix”, and “The New York Times” to receive information.  Wired.com writers back up their claim with numbers. 

Chris Anderson writes, “Today the content you see in your browser — largely HTML data delivered via the http protocol on port 80 — accounts for less than a quarter of the traffic on the Internet.”  But you could argue against this because the amount of data transferred by NetFlix, YouTube, Pandora, etc. is much greater than what’s transferred when you view a normal webpage.

Michael Wolff backs him with a study comparing the most used websites (which are most likely to have their own applications) to every other website saying, “According to Compete, a Web analytics company, the top 10 Web sites accounted for 31 percent of US page views in 2001, 40 percent in 2006, and about 75 percent in 2010.” 

This trend seems to show that people are leaning towards using applications to get most of their information. As an iPhone user, I can say that if other people are like me I definitely prefer using certain apps for getting content from the internet.  Browsing in Safari on my iPhone can sometimes be cumbersome because most web pages are designed to be viewed on a larger screen.  Although this is a major downfall, there are many things I dislike about applications.  The information you can get from a single app is extremely limited, also the things you can do in these applications are limited.

ReadWriteWeb.com has an article claiming that browsing is not dead just migrating to a different format called Mobile Touch Websites (see http://www.readwriteweb.com/archives/mobile_app_or_browser-based_site.php).  When browsing on your mobile device, if you go to a major corporation’s website, most likely you will be redirected to a mobile version of their site.  This version offers mobile users easier navigation and viewing on their mobile device.  The number of Mobile Touch Websites has skyrocketed in the last two years. Richard MacManus writes, “Taptu estimates that there are 326,000 Mobile Touch Web sites worldwide, which they say compares to 148,000 iPhone apps in the App Store and 24,000 apps in the Android market.  Taptu expects the browser-based mobile web market to grow much faster than the app market.”
Okay I admit I mostly use apps when I’m on the move and need to check my bank account, to watch a video on YouTube,  to stream music from Pandora, or basically anything that I routinely do.  When I’m trying to find information on anything out of the ordinary, whether at home or on the go, I use a browser because it’s the fastest way to get what I’m looking for.  Browsers have been the prevalent way to access information on the Internet since it’s conception.  I doubt they will die as Wired.com’s article suggests.  Rather how browsers are used will likely change to accommodate the boom in users now browsing the internet from their mobile devices.