Archive for November 2014 - Page 1

Ad

    Dev Topic: Hungarian Notation

    I have spent the last few weeks thinking about programming, specifically variables, and how to name them. There are many different approaches to naming variables. One of the ones that is bandied about, and question quite often, is the Hungarian Notation. Hungarian Notation is the idea of putting the type in the name of the variable. An example of this might be "str" for string, or "int" for integer, or "bln" for boolean.

    Conversely, there are those who never put the type within a variable name. Examples of these variables names might be "firstName", "zipCode", or "countryCode". These three examples are somewhat basic and most people can infer what type of information is going to be stored in these variables. However, there are times when it may become less obvious. For example, the variable "userID". What type of data is stored in this variable? It could be an integer, to tie a user to a database row, or it could represent a username, like "bob123".

    The debate between the naming conventions used leads to this question "When is it appropriate to use each type of naming convention?" Well that depends on many factors. For me, the biggest is which programming language am I using. When I am using Objective-C, the type of variable must be declared.

    Objective-C

    NSString *firstName; NSString *lastName; NSInteger *userID; BOOL isReady;

    With the three variable names above, it would be quite obvious what type the variables represent. However, when I use PHP or Javascript, it may become less obvious. In PHP, you can specify what type, but by default all variables are just that, variable. No keyword or type information is assigned. They can contain any information and be of any type. See the code below.

    PHP

    $firstName = ""; $lastName = ""; $userID = ""; $isReady = "";

    As a person looking at the code, you cannot explicitly know what type of information is expected. You can infer but you do not know with certainty. If you assign the wrong type of data to the wrong variable, it can completely break an application. The same is for Javascript, where the only way to declare a variable is using the keyword of "var".

    Javascript

    var firstName; var lastName; var userID; var isReady;

    With PHP, and Javascript, Hungarian Notation becomes quite handy. When using Hungarian Notation, your code may look like this:

    $strFirstName = ""; $strLastName = ""; $intUserID = ""; $blnIsReady = "";

    Javascript

    var strFirstName; var strLastName; var intUserID; var isReady;

    As you can see, you can more readily discern what type of information is being expected. Now that one situation when to use each type of notation is answered, the next question becomes, "Why have different naming conventions?"

    The answer to this one is quite simple, readability. With the proliferation of open source projects, there are many individuals who try to understand how an application or program actually functions. To make it easier on them, it is best to use some sort of convention, when it is appropriate. Besides the benefit of other individuals, as a developer it also makes it easier for you to read your own code later on.

    As an example, my largest web, which has about 175 database tables, has a total of 107525 lines of code, between PHP, HTML, CSS, and Javascript files and all of this spans almost 1500 files. A good chunk of this code was written almost six years ago now. If I were to look back at some of the original code and did not use Hungarian Notation, then I would most likely have to look back at certain things and re-construct what I had written. While this almost certain to happen regardless of how long ago a piece of code was written. Nonetheless, it does take away from current productivity and forward momentum.

    I am not advocating that everybody use Hungarian Notation, but merely to think and plan ahead for when you have to come back and look at code. Additionally, if you are looking to open source your code, be sure that it is readable to your audience. This means, somebody besides yourself. Also, do not forget comments, even if they are basic so that everybody can get some idea of what is the intention of a certain bit of code is meant to accomplish.

    Tags:

    iPad Air 2 Review

    image

    I have been using the iPad Air 2 for about three weeks now. I thought I would give my thoughts on the device, as compared to my last iPad.

    Unlike the iPhone, I have not purchased each version of the iPad. Instead, the ones I have owned have been the original iPad, the iPad 2, and the iPad 3rd Generation; and now the iPad Air 2. I skipped the 4th Generation iPad because it was released a mere 6 months after the 3rd Generation iPad. Beginning with the iPad 2, I chose to always get the optional cellular option. While it is more expensive, $130 to be exact, the ability to use an iPad anywhere, including places that do not have wireless, is always a nice feature to have in reserve in case it is needed.

    Size

    iPad.Air.2.side.view

    The first thing I noticed about the iPad Air 2 as compared to the iPad 3rd Generation is that the physical size of the device. The iPad Air 2 is much smaller than the previous iPads. While the screen remains at 9.7 inches (more on the screen in a bit), the bezel around the screen is significantly reduced. The exact specifications of the iPad Air 2 are 9.4 inches by 6.6 inches by 0.24 inches. Compare this to the iPad 3rd Generation which measured 9.5 inches by 7.31 inches by 0.37 inches. This is an overall reduction of 42%, from a volume of 25.7 cubic inches to 14.9 cubic inches. This is a significant reduction.

    The second thing one notices is the weight. The iPad 3rd Generation weighs in at 1.46 pounds. Despite the weight not being a lot, when one is using it for a long time, it can put some additional strain on the arms. The iPad Air 2, coming in at 0.98 pounds is 32.8% lighter, and it is completely noticeable. Using the iPad Air 2 for an extended period of time is less of a strain. I have spent the last couple of days going back through Plants vs. Zombies HD. When using the 3rd Generation iPad, I would notice fatigue after about 30 minutes of playing. This just is not the case with the iPad Air 2. I can easily play an hour without any feeling any strain or fatigue. It is a

    Screen

    When the iPhone 6 Plus was unveiled it was announced that Apple created a new Retina HD screen. The iPad Air 2 did not receive the same screen, yet, it has received an upgraded screen. The iPad Air 2 now has a laminated screen. A laminated screen provides two primary functions. The first is that the LCD screen, glass, and touch surface are all one single piece. While you cannot physically see that this is the case, the screen does appear as though you can physically touch the icons on the screen.

    Speed

    The iPad Air 2 has an A8X chip inside of it. The A8X is an off-shoot of the A8 that is in the iPhone 6 and iPhone 6 Plus. The differences with the A8X are that the A8X has 3 Billion transistors, which is 33% more than the A8. This makes complete sense because the iPad Air 2 has a triple-core processor. Yes, it has 3 cores, instead of two cores. Along with the three cores, comes 2GB of memory.

    The increased specs provide some great GeekBench results for the iPad, compared to previous generations. Here are some comparisons between the 3rd Generation iPad and the iPad Air 2.

     iPad 3rd GenerationiPad Air 2
    GeekBench Single-Core2671811
    GeekBench Multi-Core5034513

    As you can see from the single-core comparison, the iPad Air 2 is 6.78 times better in computation. In terms of multi-core, the iPad Air 2 is 8.97 times better. A better comparison would be that the iPad Air 2 completed the tests in about 30 - 45 seconds. While, the iPad 3rd Generation took upwards of 3 minutes to complete the same tests. It is quite clear to see which one is better.

    The speed is definitely noticeable particularly when doing pretty much anything on the iPad Air 2. Anything from switching apps, to launching resource intensive games, or even using applications like Epic Zen Garden. The speed is really incredible.

    Apple SIM

    Apple.Sim

    One of the largely unrecognized aspects to the iPad Air 2 is the inclusion of an Apple SIM. The way the Apple SIM works is that it allows you to choose one of three carriers (in the US). The choices are AT&T, T-Mobile and Sprint. The idea behind the Apple SIM is that at some point in the future you will be able to switch seamlessly and without swapping the SIM card. We are not at that point yet, but this is a definite move in the right direction.

    One of the things to be cognizant of is that once you choose AT&T, the Apple SIM will be locked to AT&T. This is not the case when you choose T-mobile or Sprint. Additionally, if you choose T-mobile or Sprint, you will not be able to choose AT&T as an option. This is likely just a transitionary state until Apple can work out deals with all of the carriers.

    Once all of the issues are resolved, the idea of requiring a SIM may become completely unneeded. While it may begin with the iPad, it is conceivable that the Apple SIM will eventually make its way to the iPhone line of products as well as the iPad.

    Storage

    The iPad Air 2 has followed the same storage tiers as the iPhone 6 and iPhone 6 Plus. These are 16GB, 64GB, and 128GB. The size of 64GB and 128GB makes complete sense. However, the 16GB makes no sense at all. In order to perform updates, a user needs around 5GB just to install an iOS 8, on the device itself, without connecting to iTunes. Given the number of people who do not connect their iOS devices to a computer, it is astonishing that Apple would continue to offer 16GB as an option.

    It is completely possible to see the marketing aspect. A sales person can easily make an argument that "...for $100 more, you get four times the amount of storage space". It would not take too much effort to convince somebody of the benefit of spending the extra money. The more iPads that Apple can sell that have higher storage capacities, will ultimately lead to a higher price-per-device, which will make Apple even more money and satisfy the share holders.

    While it may have affected margins, starting with 32GB would have been a logical progression and would mean that users would be even more satisfied, thereby increasing "customer sat", which can be touted on earnings calls, at share holder meetings, and at keynote events. Even though a 32GB option is not available, the 64GB and 128GB models did become $100 cheaper, down from $699 and $799 to $599 and $699 respectively. This is an overall win for consumers.

    Touch ID

    As mentioned above, I have not owned every iPad. I have owned the original iPad, the iPad 2, iPad with Retina (3rd generation), and now the iPad Air 2. I did not purchase the 4th Generation iPad because it was released a mere six months after the 3rd generation. I also opted to not upgrade to the iPad Air because I wanted an iPad with Touch ID on it. I had become quite accustom to the ability to unlock an iOS device with just a fingerprint after I got my iPhone 5s. I knew upgrading to an iPad without Touch ID would become problematic.

    The iPad Air 2, as well as the iPad Mini 3, both received Touch ID. Touch ID does a few things on the iPad Air 2. First off, it will allow you to unlock the devices. This means that you no longer have to type in your passcode every time that you want to unlock your device. The second feature is the ability to use Touch ID to purchase items from the iTunes store, including In-App purchases, as well as using Apple Pay within applications. If you have an iPhone 5s or later, and you have become accustom to using Touch ID, this will be a natural fit.

    Design

    I have already spoken about the size and weight of the iPad Air 2. Right now let us look at some of the changes made with the iPaid Air 2, to the design. The first item to notice is that there is no longer a hardware switch on the side. In the previous iPads, as well as in the iPad Mini 3, the switch can be used in one of two ways. You can either configure it to be used as a mute switch or as a rotation lock switch. This option is available within the settings. While there has never been an official reason given as to why it was removed; there is really only one possible reason. The most likely reason that there was no physical room within the iPad Air 2 to accommodate the switch.

    Much like previous iPads, the on/off switch remains on the top of the iPad Air 2. For someone who has an iPhone 6 or an iPhone 6 Plus, this can be confusing because you may become accustom to having the switch on the side. The position of the switch is definitely not a make-or-break item, but it is something to be cognizant about, because it can be a bit disorienting.

    Wireless and Bluetooth

    When the first iPad was introduced, it included 802.11A/B/G/N, running on both 2.4GHz and 5GHz. The iPad Air 2 keeps the same configuration, however the iPad Air 2 now includes 802.11AC as well as utilizing Multiple-In Multiple-Out (MIMO), just like the iPad Air did. MIMO works by having more than one antenna to transmit and receive wireless signals. The use MIMO will allow even faster speeds. Here is a snapshot of a connection from my iPad Air 2 to a 6th Generation Airport Extreme.

    Screen Shot 2014-11-11 at 7.18.00 PMScreen Shot 2014-11-11 at 7.17.52 PM

    As you can see, it does connect at 400 Megabits per second (Mbps). The faster connection speed would make streaming anything off of the network that much faster, as well as being able to transfer information in a much faster fashion. The speed of the iPhone 6 Plus is only 200Mbps, and this is because the iPhone 6 Plus does not have MIMO capabilities.

    Starting with the 3rd Generation iPad, the iPad line included Bluetooth 4.0, also known as Bluetooth Low Energy (LE). This is still the case with the iPad Air 2. Bluetooth 4.0 is required to be able to use a new feature of iOS 8, Handoff.

    Final Thoughts

    Overall, the iPad Air 2 is a great upgrade. If you have not previously owned an iPad and you have been thinking of getting one, you cannot go wrong with the iPad Air 2. If you own any iPad, other than the iPad Air, this is most definitely a worthwhile upgrade; this is especially the case if you own an iPad 2 or a 3rd Generation iPad.

    The upgrades provided in the iPad Air 2 are significant. The inclusion of 2GB of memory, a triple-core processor, and 802.11AC with MIMO, will make everything seem that much faster and provides a great experience. The inclusion of the Apple SIM which can, in theory, allow a user to choose which cellular carrier that they want to use.

    Tags: