Monday, November 29, 2010

Becoming a MacBook Pro Ninja

mac book proI have always been the PC guy in those funny Mac
commercials. I knew very little about Macs a month ago. In fact, I had to consult the owners manual to find the seamlessly integrated power button on the shiny new Mac Book Pro! I didn't feel too bad, I challenged another PC guy to find it and they failed too:) Being a novice at anything can be extremely frustrating. As a novice I set a simple goal. Learn everything about this all-aluminum, uni body machine. After reading MacBook Pro Portable Genius, a few magazines, and many online tips I finally feel very comfortable in the drivers seat. Here is a very brief recap of what I discovered on my journey.

Favorite Features

  1. Trackpad gestures:
    The trackpad is unquestionably the most powerful feature you will find on any laptop and it is exclusive to MacBooks. Who needs a mouse? I am more efficient with the trackpad! Enable "tap to click" for even greater efficiency gains.
  2. Expose:
    Expose is also totally unique to Macs and offers a convenient layout for switching between open windows. Additionally, Application Switcher and Spaces (also unique) each offer efficient capabilities for navigating your workspace. These features will definitely make you more efficient while multitasking.
  3. Security:
    The security settings are powerful and simple to setup. The settings include: account management, password enforcement, data encryption, firewall protection, secure notes, SSO capabilities, and parental controls. Each can be configured within Settings or Key Chain.

Top Four Things To Customize When Setting Up

  1. Enable Firewall:
    If you access public WIFI, setting up your firewall is a must. WIFI is the most vulnerable network you can access. Configure your settings to be most restrictive (block all incoming connections) and adjust as necessary if you need to allow network or web sharing.
  2. Require Passwords:
    Most users disable passwords on personal devices for convenience. I will always opt for security.
  3. Enable File Vault Encryption:
    This encrypts the entire home directory. I searched for benchmark studies and they only revealed minor performance degradation. If my laptop ends up in the wrong hands at least the malicious user won't be able to login or physically read my hard drive.
  4. Adjust Energy Savings:
    Dim the backlit keyboard, reduce screen brightness, and adjust the energy saver settings to preserve battery life.

Most Frustrating Features

  • Speech recognition:
    This is an interesting feature that is hit or miss. A few commands work well ("open my browser") while others rarely work ("tell me a joke"). In the end, the trackpad reigns supreme.
  • No trackpad gesture for Spaces:
    Looks like the only alternative is to use a hot corner or keyboard shortcut.

Features With Potential That I May Never Use

  • Dashboard:
    I have setup several active widgets for weather and iTunes but I can access these features outside of dashboard too. The availability of useful widgets will drive my usage of this feature.
  • Text-to-speech:
    This is a nice feature but I only see myself using it while reading an online book.
  • MobileMe:
    I can not justify the yearly cost for Apple's cloud storage when a simple flash drive does the job at a lower cost.

Mac Book Resources

Tuesday, September 14, 2010

Cleaner Code with One Simple Technique


Clean code bookWhat is the simplest technique you can apply to write cleaner code? Clean Code by Robert C. Martin is a very good book that focuses exclusively on writing cleaner code. I read this book several months ago and at a recent code review I was again reminded of the value of this simple technique. The simplest technique to apply for writing cleaner code is to keep functions small!



Advantages of Small Functions

  • Functions perform one specific responsibility (single responsibility principle)
  • Functions become very readable
  • Functions are more likely to descend only one level of abstraction (tip G34 from Bob's book)
  • Small functions promote reusability and help eliminate duplication
  • Your favorite IDE makes extract method so simple
  • Small functions adhere to these valuable coding principles by design


Ideal Function Size

"Continue to extract methods until you can not extract methods anymore. Extract until you drop!" This is Bob's recommendation from his online presentation of Bad Code and Craftsmanship. Personally, I couldn't agree more. For the past three months I have been following this practice and this simple technique has a high return on investment.



Additional Clean Code Tips

Looking for additional clean code tips? Chapter 17 (Smells and Heuristics) in Bob's book is a very quick read and covers sixty-six valuable coding practices. Alternatively, Bob discusses many clean code practices in his online presentation. In fact, he leads off the discussion by focusing on the importance of small functions!

Tuesday, August 31, 2010

Objective-C for Java Developers

objective c book

I actually won Learn Objective-C for Java Developers at the last Twin Cities Java User group meeting. The only stipulation for winning a free book is the expectation that we publish a review of the book online. This is a small task for a free book. Learning Objective-C has been on my todo list for several months anyway. Winning this book simply moved it higher on my priority list.


Review:

4 star rating

Pros:

  • Many of the Objective-C examples were also shown with their Java counterpart. This added value in two regards. First, it clarified what the example was really doing. I could simply reference the Java version and quickly understand the Objective-C code. Secondly, it allowed me to compare and contrast the two languages. In many cases (but not all) the Objective-C examples contained fewer lines of code.

  • In addition to the Java and Objective-C examples, the book also had many table-based comparisons for common features (data types, methods). For example, one page listed the Java data types and their Objective-C alternative including their size and range restrictions. Again this helped simplify the learning curve. The table-based charts were also used for common method declarations too. For example, the common String utility methods were shown side-by-side. One column showing Java's String utility method declarations and the other column showing the Objective-C alternative.

  • Most code examples were a page or less. This helped simplify the learning process by allowing me to focus on more isolated code fragments.

Cons:

  • Many books that teach a new programming language typically include exercises at the end of each chapter that the reader can take away and complete. This book did not have any. This is a minor complaint. I can definitely think of sample programs to write...

  • The index does not always serve as a good reference for finding things quickly. For example, I wanted to find more information about logging and "logging" or "NSLog" were not in the index. Need to find the for loop quickly? You will not find it in the index. It is actually found in the index under "Collections, iterating through". The index could have been structured slightly better for quick search keywords.

  • An Objective-C quick reference guide would have been helpful. This did not bother me too much because about the time I started reading this book DZone released a new Objective-C reference guide. I highly recommend it! In my previous "con" I mentioned that it can be painful to find certain topics (logging, data types, loops) quickly within the index. The DZone refcard provides quick access to those topics and more!

Summary

Overall this book is a very valuable resource for Java developers that want to learn the Objective-C language. The author greatly simplifies the Objective-C learning curve by contrasting many features and examples to its Java equivalent.

Saturday, July 31, 2010

Mobile Web Toolkit



mobile phoneMobile Web development requires a more abundant set of developer tools than its desktop counterpart. XHTML MP, Wireless CSS, and Mobile JavaScript are all more refined subsets compared to their desktop predecessors. In addition, the Mobile Web offers many new challenges. In particular, device fragmentation and browser inconsistencies will always wreak havoc within this ecosystem. Great tools can help overcome these challenges. Here are a few:


Validating Mobile Sites

How valid is your Mobile Web Site? Find out with these awesome validators. These validators will grade and offer best practice solutions to achieve a more compliant Mobile site. These are also valuable tools for a code review!

Mobile Web Best Practices

Both validators above evaluate mobile sites based upon standards and best practices. Their best practice and standards documentation can be found here:

Device Databases

Device databases simplify device detection. This helps facilitate content adaptation for specific device groupings (smartphones, featurephones, screen size, OS, JavaScript/AJAX support, is wireless, is touchscreen, etc.). For example, Bank of America and Amazon tailor content based on several of these groupings.

XHTML Mobile Profile

XHTML MP is the standard markup language for the Mobile Web. Unlike HTML and XHTML, XHTML-MP is featurephone compatible, it is less likely to be transcoded for optimization, and it supports the mobile-optimized Wireless CSS and Mobile JavaScript features. For additional XHTML MP 1.2 features refer to OMA's specification document.


Firefox Add-ons

The following Firefox add-ons are very powerful tools for testing and developing:

Device Testing Solutions

The ideal testing solution is to test on the physical device. Two virtual device testing solutions exist:

JavaScript & AJAX Compatibility

When device testing is not always feasible, the compatibility tables generated by Peter-Paul Koch are a good alternative. If you need assistance identifying JavaScript compatibility across browsers or devices these tables can definitely help:


CSS Compatibility

If you need assistance identifying CSS compatibility across browsers or devices these tables exit too:

Web Widgets

Web Widgets will allow Mobile Web developers to take advantage of native phone features. The subset is limited but it is a start: Device APIs and Policy Working Group


Book Resources