Saturday, February 8, 2014

The Case for Adding Scala

Scala is a language that I have been examining for awhile. Early on the library versioning issues really turned me off, but the seem to have been solved. It's also a very large language that requires programmer discipline to not abuse. Twitter has been a big proponent of Scala and the Effective Scala document is a great start on how not to abuse the language features.

This post argues against Scala in large projects or in mixed projects. The points made about tooling and interoperability I think have for the most part been fixed since the post was made in 2010. Intellij works great with Scala and intermingles Scala and Java in the same project without any issue.

One of the big points that is made in the post against adding Scala is that it raises the bar for someone to contribute to a project. While is does raise the bar, is Scala really the straw that breaks the camel's back in this case? Any modern Java project is already going to be loaded with Java, Spring, Hibernate at a minimum. I also wouldn't write any Java without using Guava and the components it provides like immutable collections, predicates and options.  Do those also raise the bar too high for a new contributor?

The post also argues against multi-language projects. Again, every project is already multi-language. Java, SQL, HQL, HTML, JS, SpEL to name the common ones. Scala appears to get singled out because it can be abused. The problem with that line of logic is that any language can be abused. Project standards are key anytime there is more than one developer.

So, after some discussion we are including Scala into our Java projects. I view it as an easy way to evaluate if Scala can work for us. I also think (hope) that in the long run Scala can become our language of choice for working on the JVM.




Sunday, November 18, 2012

Making A Living in the App Store

TL;DR - Starting a business is hard and most fail.

The NYC has posted an interesting article about the app store boom.  The article focuses on a couple that bet everything on developing a business around making apps.  While I agree with the articles premise that making a living on the app store is a  very hard thing to do (see Zynga's collapse), the article failed to mention that any startup is hard.  The majority of startups fail regardless of the industry.

As someone who has been following the app store for many years the gold rush period has long been over.  Flooding the app store with bad apps is no longer a way to make money.  Users expect apps to be much higher quality than in 2009.  High quality takes time and money to develop.

Discoverability it hard.  Even if the app is high quality and solves a genuine problem for the user, it may remain impossible to find.  People complain about the app stores discoverability like this is a problem unique to Apple, but it's not.  Discoverability is hard in any business.  Having a great product is simply not enough.  Potential users must be told about the product.

One positive for the couple in the article is the husband learned how to write apps.  While the app store gold rush may be over, the app store is not going away.  Users increasingly expect every product to have a corresponding mobile app.  Mobile web works for some products, but users expect a quality that is still hard to reach with todays mobile technology.  As Steve Jobs so famously said about DropBox, apps will increasingly become features of a larger product.  Dropbox on the other hand has turned out differently.

Friday, January 13, 2012

Stop SOPA!

This issue is too important to ignore so I've been trying to build a post that explains what SOPA is and why it is not the answer.  Turns out that Tim O'Reilly has recently given an interview about why SOPA isn't needed and should be stopped.  As a publisher who benefits from copyright, he explains in a clear and concise manner why SOPA is not needed.  Read the full interview at GigaOM.

Monday, December 12, 2011

iAutoCalc 1.3.1 Released!

Version 1.3.1 of iAutoCalc was approved by Apple and released this morning.

For the next few days iAutoCalc will be offered at the sale price of 99c.

Change list:

  • Fixed total interest paid calculation bug.
  • iOS 5 tested
  • Code cleanup

Wednesday, December 7, 2011

iAutoCalc Bug and Fix

**Update**
Version 1.3.1 of iAutoCalc has been submitted to the app store for review.  It should be available again in a few days.
****

I want to say thanks to the kind reviewer who suggested I learn how to add.  In fact the bug subtracted the down payment from the price twice so adding isn't really my problem ;-)

I'll make sure to let my QA department know they missed a bug and to work harder next time!

Joking aside, the bug is fixed and a new version will be sent to Apple for review and included into the app store shortly.  I have recently cleaned up some other parts of the code and want to do some additional testing before the next release.

Tuesday, December 6, 2011

Emacs Org-Mode

As a vi and vim user I had never come across emacs org-mode until yesterday.  I've spent the last couple days fitting it into my project and task workflow and must say that I am really impressed.  Traditionally whenever I have tried to use project management or task tracking software it would always get in the way of how I wanted to do things.  This inevitably would lead me back to a text file list on my desktop, a piece of paper with notes, and recently a google doc that looks a lot like my desktop text file.  Org-mode has opened my eyes to how project management should be done.

First off, since I'm not an emacs user yet, some of the key binding issues have slowed me down.  Out of the gate I have set up my projects in a simple, and I think, logical fashion.  I've read about other people maintaining a single .org file with their entire life in it, but that seems a bit too unwieldy to me.  Perhaps that's my lack of emacs skills showing through though.

In my initial setup, I have a .org file for each project.  Projects that are work related are simply named work_.org in addition to a catchall project called work_general.org.  The general project is a place to put quick TODOs that popup out of meetings or conversations that are not really projects.  Overall, it's a nice easy way to keep everything work related together and grouped by project.  Now, this does mean I have to add each .org file to my .emacs to have it show up in my global TODO list, but that's actually a good thing since I want my global TODO list to only show work items.

For my non-work life I have a life.org file.  I keep this file out of the global TODO list and use it stand alone for everything from what needs to be done from things with the house to buying gifts to whatever ("TODO cancel XBOX live subscription" is on there).

Finally, personal projects have their own file, projects.org.

The beauty of org-mode is that it's just text files.  At any point and time while taking notes on a project I can type "TODO" and the line becomes part of the global TODO list.  The list lets me jump right to the TODO line and see the context of the notes that caused the TODO to come about.  Something so simple, yet at the same time completely awesome.

This is the first time in a long time I've been excited about something like project management.  I'm not really surprised that emacs contained org-mode (isn't emacs it's own self hosting OS by now?), but at the same time I never thought to look.  The org-mode website mentions converting vi users to emacs.  I can't say that will happen, but hopefully learning both vi and emacs to a sufficient level will not be like crossing the streams.

Resting and Working

People who write software are using their creativity to solve problems.  I compare it to writing using a very precise language and grammar to express a story to the user.  I came across this video over at the 99%.  In it Tony Schwartz, author of "The Way We're Working Isn't Working", relates athletic performance to creative performance.  One thing athletes have known for years is that the rest between workouts is just as important as the workout itself.  While it seems intuitive that it would work the same way with mental work, many creative professionals skip the rest part in order to squeeze in more work.  This additional work is usually lower quality and eventually the lack of rest becomes detrimental to creativity.
(It's a flash player, so if you have flash block on click the whitespace below to make it load.)

Friday, December 2, 2011

UITextField Format For Currency Revisited

Since my first post on formatting a UITextField with proper currency symbols and separators I think I have learned a lot more about objective-c and more importantly the UI components provided by Apple.  In this article I will revisit how to format a UITextField with the correct currency symbol and grouping separators.

The original goal was to create a text field that would update in real time both with the currency symbol and grouping separators as numbers were typed in.  The first working solution can be found here, but it had some short comings particularly in code complexity.  The main problem was that I was trying to keep the string formatting correct so that I could decode the string to an NSNumber using a currency formatter and then encode the string again to an NSString.  This was needless complicating the code when dealing with inputting characters. The original code:


Instead it was much easier to just strip out the currency symbol and group separators and then use a basic number formatter to turn the string into a NSNumber.  I was able to remove an entire section of code:


Finally, take the newly formed NSNumber and run it through the currency formatter to create the desired output.  The entire new method is below:


First thing to notice is the cleanup of the code between lines 19 and 21. There is no more special case, and thus reduced complexity. Line 32 is what allowed the removal of the special case. Instead of trying to work with symbols and groupings they are now ignored completely and removed before being added back in. The variable clean_string will end up a string with only numbers and will be easily parsed into an NSNumber by a basic NSNumberFormatter.

There are a few class instance variables that need to be set. The init and associated dealloc is below even though they are not necessarily related to the optimizations above.

Formatters is a custom class that contains various class methods to return ready to use formatters. In the next article I will show how it is setup. In the meantime two new NSNumberFormatters could have just been declared inline. See the Apple reference documentation for NSNumberFormatter.
The above improvement cut out some code that was not needed, but most of all made the logic easier to follow.  Instead of having to worry about special cases with currency symbols when inserting new characters, they can now just be ignored.  The formatters do all of the heavy lifting as they should.

Tuesday, November 29, 2011

The Lazy Programmer: Language Selection

When I was in graduate school one of my fellow students was a C++ fanatic.  To him, every software problem was best solved by C++.  To his credit he probably could solve any problem using C++, but was that really the best use of his time?  By assuming C++ as the best language choice for every problem was he being lazy or simply over working himself?

The common adage to describe the scenario above is "when all you have is a hammer, every problem looks like a nail."  Of course you need a hammer because there are a lot of nails in the world, but there are also a lot of other types of problems.  C++ is well suited to a large (and shrinking, depending on who you talk to) problem domain, but is it really best language to use to develop a web site?  How about loading data into a database, parsing text files, or creating CRUD GUI interfaces?

Each of the problems I listed above have programming languages that fit the problem domain better than any other language.  It may take some time up front to learn a new language, but that time spent is well worth the effort of a simpler to develop to solution.

The lazy programmer, instead of letting tools drive solutions, lets the solutions drive the tools.

Monday, November 28, 2011

Hello World Version 2.0

What a crazy year.  So the blog kind of fell off as work got really busy along with life.  Now that I have gotten life back to a normal pace I plan to resume writing both the blog and some new iPhone apps.  I have a few ideas kicking around and will be working on them as I have time.

iAutoCalc is on my list of TODOs that needs to get updated to the iOS 5.  I have ran it under each version of iOS and it appears to be working fine, but the code will not compile on anything past iOS 3 right now.  Thus, some of my older posts on objective-c unable to compile in some instances.  I'm hoping to get it cleaned up soon.