Dec 6 2010

iOS Development Code Kitchen

I’ll be putting on a workshop on iOS and iPhone development this Saturday from 9AM to 5PM on the Virginia Tech campus. The event is free so if you’re in the area feel free to sign up:

http://www.ltzllc.com/2010/11/ios-development-code-kitchen/

The event will run all day and will be hands-on programming, but all levels of experience are welcome and encouraged to come.


Oct 14 2010

Learn Spanish, or any other language

If you have a library card to the local Blacksburg library, across the street from Rocket Music and the police station, you can access a pretty good online tutor called Mango Languages. Just search for Mango on this page. Both the card and the subscription to Mango Languages are free.

Also, here’s a list of some websites to learn Spanish and other languages. Don’t pay for anything online. They’re all a waste of money. There’s a lot of great content online for free and most people don’t follow through long enough for it to be worth it.

Language Podcasts

Podcasts are also a great, free option. Go to the iTunes store, and search for Spanish or which ever language you want to learn and subscribe to as many teaching podcasts as you can handle. For Spanish, I recommend:

Learn to Speak Spanish with Discover Spanish
Coffee Break Spanish

Some language podcasts are taught by English speakers who have horrible accents, but they’re worth a listen, but don’t put much effort into replicating their pronunciation.

Books

After you go through those for a while, you should get a book if you decide to continue learning it, otherwise I’d stick with the online content until you’re positive you want to learn it. I personally have a good reason to try to learn these languages, but if it’s just for fun you might find yourself getting tired of it.

Books provide a level of intensity and authority that you’ll need, but only after you’re sure you want to get that far into it. Almost any book with an accompanying CD should be good, but make sure to look through the book to see if it matches up with the way you learn. By going through the free content first, you should understand which technique best suites you.


Jul 1 2010

Naming Conventions – Why Your Code Sucks

I’ve seen a lot of poorly written and ugly looking code in my time. That’s not even considering the undocumented and uncommented code. We all know we should comment our code but how many of us do it consistently? I admit, when I’m in a coding frenzy, stopping to write comments just gets in the way of my thought process and can be distracting. I will however write a bunch of comments before I write the code, of the operations I think I need, in order to give me an outline of where I need to get to. For example:

// Get URL string for video file
// Load video file from URL request
// Load video file into video player
// Set up video player
// Play video

I may not know all the APIs to load and play the video just yet, but at least I’ve given myself an outline and as I fill in the code below each comment, I can see exactly what I’m doing and where I need to go.

Why Your Code Sucks

The point of this article is not to talk about comments, but how to avoid writing them in the first place within your functions and still be clear for everyone else, for the most part. This is your code:

newPlPt = crt2pl( nmc.x, nmc.y );

Not even a comment could concisely convey the meaning of that hideous statement. Instead, why not:

newPolarPoint = cartesianToPolar( newMediaContext.x, newMediaContext.y );

Well written code is self documenting. Let me restate that: if you can write code so that someone can jump to any point of that code and understand what’s going on at that point, read it like a sentence, and not have to decipher minute details like what each variable means, then you don’t have to comment most of your code.

There’s no reason you need to shorten the names in your code. Most programmers have never had file size limitations to deal with, so there’s no reason for it. Stop pretending you live in the 1960s and embrace nearly infinite file storage. To save keystrokes perhaps? Please, use a real IDE with code completion and stop doing stupid things like:

public function updateP( p:Player, d:MovieClip, b:MovieClip, t:Textfield);

Function Names

Also, because your functions are essentially actions, they need to reflect that in the name, so put a verb in the beginning of your function such as: getData(), setStatus(), enableWiFi(), hideControls(), handleGraphicException(), launchBall(), etc.

Class Variables

Get rid of the underscores in front of your class variables. For example: _dg; _myNumber;. All class variables should be private anyway, so why do you need that ridiculous convention? It’s a hold over from C where there was no “private” keyword, so you’re using it and you have no idea why.

Also, what’s with the “my” naming convention? You sound stupid when you have those: myInstanceName, myMovieClip, myGraphicsContext. Of course it’s yours, whose would it be, if not yours? If you’re programming with a colleague, do you refer to his variable references as yourInstanceName? Or hisVideoFileURL? Of course not. Don’t be that stupid; you’re reading too many stupid online tutorials by uncreative people who only code because they have nothing else better to do while living in their parent’s basement.

In the very least, be consistent with your naming conventions.

Hungarian vs. Polish notation

Depending on which language you’re coding in,  you may need to use a notation to help you with type casting. Let me rephrase that: if you’re using a loosely typed language, use Hungarian notation. You should probably use this with strongly typed languages anyway because with abstract types, you never know what you could get into and it’s just generally less confusing.

Hungarian Notation: vendorNameTextField or vendorName_txt

Polish Notation: txtVendorName or textFieldVendorName

Why not Polish notation? Not only is it ugly, but why would I sort on variable type instead of the variable name like I can do in Hungarian notation? The notation names come from how the speakers of those languages modify their verbs and nouns. To say: “My ball” in Hungarian is:  ”labdám” where “labda” is the root word and the ‘m’ singifies a first person possessive. Hence the ending of the word shows the crucial information. It’s the opposite in Polish notation where the beginning of the word is modified. In the interest of full disclosure, I love the Polish, but I am Hungarian, but I promise that’s not why I prefer one over the other.

Final Thoughts

In the end, be consistent, be clear and spell out your variable and function names.


May 19 2010

Immigration

This is no way intended to be a guide to immigration through marriage, just an account of the work process and work we did to accomplish this.

Petition for a Family Member

It’s kind of strange to call someone you’re going to be married to a relative, but that’s what it’s referred to. Any legal resident can petition the government to allow immediate family to join them in the United States. This is the case if you’re an immigrant or a citizen. Upon marrying someone, a citizen can request that the government allow the spouse to enter, live and work within the US. The spouse, if already in the US, can update their visa from, in our case, an F1 student visa, to permanent resident status. The law gets really tricky if you enter the US on a non-immigration visa, in other words not intending to immigrate, after having filed a Petition for Alien Relative. And yes, they call them aliens.

The form, I-130, is just a form stating who I am, how I’m legally in this country (through birth), and what my relation is to the person for whom I’m petitioning. Pretty straight forward.

Changing Visa Status

At the same time, we file an Application to Register Permanent Residence or Adjust Status, form I-485. This allows Ana to update her F1 visa to a Permanent Resident visa. After having filed this, she can not leave the country and return on her F1 visa. The reason is, upon entering the US under an F1 student visa, she is stating that by entering on a non-immigration visa, she is not intending to stay in the country, which would be false, since she has filed for permanent residency. It makes sense, but is something people need to be aware of. To get around this, there is another form I-131, Application for Travel Document, that we would need to file until she’s approved for a green card so that she can travel to Colombia or somewhere else on our honeymoon.

Additional Forms

There are a few more forms to file, such as an Application for Employment Authorization, form I-765, biographic information, form G-325A and my favorite, form G-1145, E-Notification of Application/Petition Acceptance, which will send me an email and/or text message when my application has changed status.

The process is pretty straight forward, but we consulted with a lawyer first to know what we were getting ourselves into. The tough part is understanding each form that needs to be filed, how to file it, what you need to file it properly and gathering all the other information and supporting documents that are needed. We can hire a lawyer to do all of this for us after we get married, but we don’t have the money right now. But we’re confidant we can properly do all of this. The trick is just taking a bit at a time and a lot of reading. Each government form has accompanying instructions to follow so it makes the process a lot less daunting.


Apr 10 2010

iPhone Pricing

As with any product or service, the question of pricing is always one of the many challenges of selling a product or service. Many price their products or services low in an attempt to under cut their competition or initially sell a lot and get their name out there. Others charge way more than a person is willing to pay for such a product.

With iPhone development, more often than not, you’re selling a product as opposed to a service, which may be a compliment to your physical or web based service. If your iPhone app is a complimentary product to a service that you already offer and charge for, your iPhone app should probably be free (depending on complexity). Look at it as a value-added feature to put you above your competition and make using your service more convenient and enjoyable. By creating more ways to access your service, you provide more opportunity for your customers to use it more often and really benefit from what you’re trying to offer them.

So what’s the sweet spot for a price for your iPhone app? It obviously depends, but there are some guidelines we came up with.

Be Unique with Your iPhone App

The more unique your application is, the more you can sell it for. By being unique, you have less competition and thus a higher demand.

Complexity of Your iPhone App

If your application can be easily reproduced by a 16 year old kid on a weekend, you either shouldn’t charge for your application, or if you do, don’t charge more than a dollar because that 16 year old kid won’t.

Proprietary

If your application uses proprietary information, software, APIs or other technologies that aren’t easily implemented or obtained, you can charge more for your application. This relates to complexity, but be aware that people will often create equivalent systems if it’s popular enough so proprietary systems and information require a lot of maintenance to keep them relevant.

Usefulness of Your Application

How often will someone use your app? Is it just a novelty or something someone will only use for a certain chore that they rarely do? If so, the demand for the app diminishes and so should your price.

No application should be more than $10 with few exceptions. Remember that you’re developing for a mobile platform and the software is limited and your price should be limited too.

If it’s a game, how is the quality and length of game play? The quality, the game play and the fun factor all play a part in your price. Obviously, people much prefer spending money on entertainment than on a new fancy laundry list application. Games are usually unique (to the App Store at least), are complex and provide a greater satisfaction to buyers, which allows them to enjoy a higher price tag.

Perspective

Having a higher price on the App Store shows more confidence in your application. Giving your app away usually means you don’t think people would be even willing to spend the price of a soda on your application. These applications are fine, but for some of us, we need to make a living.

Making your app a dollar usually means, I want to make some money, but I don’t think people will pay any more for it. But charging a dollar can also be good if your app has a wide appeal. What you lack in big numbers, you make up with bulk sales. So, if it’s a game, you could potentially have a larger market as opposed to a utility application that the user spends 30 seconds on. So you really need to look hard at your application and keep several factors in mind before you price your app. You can always change it later, so one approach is to start low and see how sales go.