Wednesday, May 29, 2013

Back as solo mobile developer - not easy

Being the solo mobile developer at a job is not easy. I had just gotten used to having a couple of developers around me at my previous contract position. Everyone had bits and pieces of experience in different areas so you would quickly get answers to questions without doing a Google search. They might have some sample code laying about from another project or just know how to do it.

Sure the big boss here wrote the initial iOS code that I have been cleaning up and adding features against but I rarely get to speak with him and he has no Android background. I have been working on the Android port this week getting stuck on silly things that the guy I worked with at the last place would have handled with ease as he had a lot of background in those areas. Now that the core networking is in place I can start moving forward at a pretty good clip.

A real feeling of isolation when you have developers all around you but they either don't know the language (Objective C) or the framework (Android SDK) thus you can't really bounce any ideas off of them. Sure I can hit them up for general business knowledge or Java questions but not for the meat of the development cycle.

For my Android work I have been using Android Studio. I know it is a 0.1 release but that is really just the Android plug-in side of things. The over all IDE is at version 12 and I have enjoyed using IntelliJ in the past. I like the dracula theme as far as colors go.

The ability to edit layout XML and see the results side by side in the preview window is super handy. I have gotten that to generate crash reports from time to time but they did not kill the IDE or lose any of my work.

What I miss from Eclipse is the new class wizard. It asks for the base class and interfaces and lets you quickly build things out. I have asked about this on the IntelliJ forms and they basically stated you can do all of that via a number of steps. I want a Wizard. I also want the auto add of the Activity to the manifest. I should not have to do all that work manually every time I add a new activity to the project. Since this is a new project that has been happening a lot.

The Log Cat filter seems pretty iffy too. I turn it on to filter out things but it forgets about that between program runs so I have to go back to "No Filters" then back to my filter again. It is silly how much junk the emulator kicks out into Log Cat. Since I am using the HAX high speed emulator I get a ton of extra stuff.

I was happy to get the upgrade to 0.11 this morning. Good to know there is active work on Android Studio and I am sure it will continue to improve. I have been using it at home on my Win7 64 bit PC and my Macbook Pro at work. Both seems to run equally well.

Wednesday, May 22, 2013

Core Data stinks for bulk inserts - direct SQLLite is much faster

I was handed an iOS app that was using the basic JSON handlers and keeping everything in memory. This was slow and running out of memory for large requests.

I converted the project to use stream based JSON parsing stored to a Core Data database backed by SQLLite. This solved the memory issues allowing all requests to work. There are 5 tables involved with a total of 239,000 records if you requested all the data from the server.

The problem - that request took 5 minutes and 43 seconds to process on an iPad 2. It took 33 seconds on the simulator. Let's state this again - Always test on a device. That kind of time is totally unacceptable.

After sniffing around the net and attempting to speed up Core Data I determined that Core Data sucks at doing bulk inserts. Core Data is really nice at hiding the gut level fun of SQLLite but for large inserts it is not the way to go.

I converted everything to use SQLLite directly and saw a massive speed increase. I can now process the same record set in 1 minute and 23 seconds. That cuts a whopping 4 minutes and 20 seconds off the time. The simulator went form 33 seconds to 12 seconds.

A typical user would rarely if ever request all the records but testing worst case scenario is really the best way to go. The speed improvement is seen across the board in the app with similar percentages of improvement. I am very happy with the results even though it took a couple of days to get it all sorted out.

As for the code there are areas that are more involved than the Core Data version and there are areas that are actually a lot cleaner. Everything is a trade off and there is no clear winner.

I had never used Core Data before. It was a really good learning experience to set it all up using the GUI editor in Xcode and finding out what it took to add the Core Data library and support code to an iOS project that was created without it originally. I found a lot of Core Data really straight forward and easy to use. I will not shy away from it on other projects unless they involve bulk inserts.

Having used SQLLite in the past I had a basic object set to start with and I knew my way around FMDatabase. My previous experience did bulk insert processing and I wrote both iOS and Android versions so I stuck with SQLLite to make it easier to convert code back and forth. I wanted to learn something new this time around so I went with Core Data. Good thing I could quickly fall back on my direct SQLLite experience to solve the speed issues that arose.

Tuesday, May 21, 2013

Mobile app usage and development - do you just have to magically know what to do?

The more mobile development I do the more I am finding you are just expected to know things magically. There are very few help screens, tips of the day or on screen tutorials. There are so many potential gestures in any app that you need to magically discover. What can we do to make this situation better?

A lot of apps allow swipes to perform an action. Swipe left to call, swipe right to text. Long presses may do something or bring up a menu. Some actions are instant and others prompt you but you are never really sure what will happen. Delete should prompt. Add a new item most likely does not need to unless it will cost money i.e. send a message or use your data plan or will take a long time to perform.

Some will answer the mobile device is so small and we all want to save on code size and people never use help or only use it once so skip it. The original apps were very small and had few features so that worked. News apps have a ton of features. We basically have computers in our pockets and we do a lot of work on them.

Do we need a standard "Cool Features" button showing quick help? Maybe it should show a standardized overlay on the screen to explain the swipes and long presses so people can get more out of our apps.

The other side of this is developer tools. They have a boat load of features too and a lot of their power is there but hidden from the coder. I know Xcode drives me crazy with its lack of right mouse button menus. I expect to be able to perform most actions a context sensitive menu. In general the menus are very terse. Want to add a view controller to a story board? Right click on the story board and you get zooming only options. You have to know to drag a view controller for the Utilities panel. But first the Utilities panel has to be visible. That is the only way to perform this operation. That is not friendly.

Speaking of the Utilities panel it has 6 tabs on it and I seem never to go to the correct one to do what I need. Do do nearly anything you shift between 2 or 3 of the tabs. Somehow I would like the most common settings on a single tab that I could define.

Right click on a segue control and you get zoom options but nothing associated to the segue. Click on the Scene Name in the left hand panel and nothing at all happens. I excepted the editor to scroll to that Scene. You have to click on a view of the scene for that to happen. Oh and it changes your zoom factor when you do that. Just scroll there! If I was zoomed out I want to stay zoomed out!

Is the layout of your windows wrong? Can you right click on something and fix it? No, you have to go to View -> Assistant Editor and pick the layout you want. I did not even know the window I was looking at was called Assistant Editor as nothing on screen indicates that. You can mouse hover over the toolbar button to find that out. Those same buttons are inconsistent. The first three toggle between modes of a view and only one can be pressed at any time. The next three toggle the visibility of views and any or none of them can be pressed but the two sets visually they look identical.

Highlight a word in the editor and hit Cmd+F most editors will automatically put the highlighted word in the search box but not Xcode. I get to copy / paste it up there. Heck I can highlight a word in Eclipse and just hit Ctrl+K to find the next occurrence skipping the Find prompt altogether.

Add files to a project and guess what? They are not flagged as needed to be added to version control. Why? Right click on them to add them and that menu is not there. I have to fire up SourceTree to add them to GIT for this to work. Xcode version control integration is crappy at best.

Tuesday, May 7, 2013

Windows Update error 800B0100 - I finally just gave up

I have been battling Windows Update Error 800B0100 for over a week. I searched the web over and over and tried pretty much every solution presented. I don't know how many times I ran the Windows Readiness Tool, update fixer, fixer fixer, Mr. FixIt, delete this, delete that, uninstall all of these, manually install those, etc.

Nothing made it work. I finally just blew away the VM - this was Windows 7 Professional on my Mac, and did a reinstall from DVD. After many updates it all appears to be working. I have never run into this sort of issue in the past where Windows got so messed up that I had to give up.

Another odd thing, I needed .NET 4.0 so I download that. Right away I have to download 16 patches. This means MS does not keep the installer updated. Must be the original install then you have to download all the patches. Seems a waste of bandwidth to me. I should get a pretty recent version of the .NET 4.0 installer when I download it. I don't expect to download Chrome, 7Zip, Sublime Text or others just to turn around and have its updater run and get more stuff. To me it makes MS appear lazy.

At least it is up and running now. I needed to install IIS but with the update issue that was not possible as the windows features list just came up empty. Now it fills in and I could install IIS. Turns out that was for naught because the final piece of 3rd party software was holding all its errors and only showing me one at a time. It complained about IIS but once that was installed it turned around and told me my OS was not supported. Gee, seems that is a much more important error message. You really should from the worst situation forward or show a list of issues instead of just the first one you find.

Now we have to find and configure a Win Server 2008 to get this all rolling. Guess I will go back to some iOS clean up coding while I wait for that to happen.