Google+ Badge

Monday, July 14, 2014

When do you learn a new library?

When do you take the time to learn a new library? I decided now was as good a time as any since I was at a new job and working on a new application. In the past I have used straight JSON parsing and hand written HTTP code. This time I decide to see what RestKit had to offer for both areas and I am happy I did that.

It can be very hard to retrofit a new library into old code. The design most likely does not follow the new pattern. No one wants to start from scratch when an existing product is already working. Kind of a shame because a lot of the time doing that can really make things work a lot better and make it easier to catch odd exceptions.

Per usual I got the Android side up and running pretty quickly. I did use the GSON library, which I have used in the past, but I used it in a deeper way. I set up the objects with the correct annotations and I let the library create my objects from the HTML body of the response. Worked like a champ. I implemented loaders to pull in the data and images for everything to happen on a background thread.

Next up was the iOS version. I found a lot of RestKit information on the web so I figured I would give it a shot. Not only does it handle the HTML / JSON request / responses but it also deals with JSON to object mapping. It took a bit more work to get that going though. You have to return object mappings instead of doing simple annotations. Once I had it figured out it worked very well. Some trial and error as I made the request over and over to the server to see what else I screwed up in the mapping. The JSON objects I am parsing go 6 levels deep. I did not write the server side so I am not in control of that aspect.

The image side was a different story at least when it comes to requesting a lot of images via queue in a background thread. There is a lot of documentation about the older .10 version of RestKit but less for the newer .20 code base. I fumbled around with things for a bit then found the SDWebImage library which did exactly what I needed in very few lines of code.

I am using CocoaPods for all my iOS work along with AppCode for the IDE. Yes, I have to switch back to Xcode from time to time as I can't find ways of doing things such as adding a Font to the project. This is not a super straight forward thing in Xcode either. I really want AppCode to do everything. I have been doing my Storyboard work in AppCode. Took a little bit of time to figure out where to drag from to get the IBOutlet connections to work. Xcode is confusing in this area too, nothing leads you down the path, you need to know to hold down the right keys and drag things and drop them on the right area. They improved this with Xcode 5 where you drop directly in the code but boy does the screen get cluttered when you try and have an iPad Storyboard open with code too.

Working with iPad Storyboards is a pain in both products. The screens are big and even though I am running the IDE on a 24" monitor there still is not enough space. I guess I need to have the IDE span both of my monitors as anytime you need to set up a segue between two screens you just don't have the space to do it. Even running the simulator on a 24" monitor for an iPad Retina at 50% leaves scrollbars in place. This outright sucks. I use GenyMotion for my Android work and I am able to easily scale that window to fit on screen.

Tuesday, June 10, 2014

Back to mobile dev

While my stint doing AngularJS work was interesting I am back into full time mobile work. Man I missed it and I am happy to be back into it.

Of course you are always surprised about how much you forget when you spend time away from something. I get to do both iOS and Android again. I started on the Android side first as I have always been more comfortable in Java than Objective C. I have the main login, logout and initial REST calls working under Android. Today I was working from home on the MacBook so I started to tackle the iOS side of things.

First I wanted to make sure I did autolayout from the start. Apple is pushing it and there are signs that Apple will release a different sized phone and maybe side by side program running on iPads. This means your code should be able to run as resolution independent as possible. Something you do almost by default on Android.

Autolayout is a bit weird but I got the login screen to work without any code for both portrait and landscape in the iPad storyboard. I started experimenting with AppCode 3.0 but ran into issues just getting my images into the xcassets area so I switched back to Xcode for this round of fun. I will switch back to AppCode once the UI is in place and I am doing gut level coding.

I had to create the various icons and launch screen images. I had large sized assets so I used Seashore for simple scaling. It annoys me that Mac OS does not bring an app to the front when you hover over it like Windows does. I wanted to DnD the images from Finder to Xcode. Luckily I am running a dual screen setup so I just moved Finder to the other screen and did it that way.

I copied over some other code and utility files I use and got the basics of the login screen in place. Now I get to decide which JSON library to use. I might just go with NSJSONSerialization this round. I have used YAJL in the past but I did that because I needed to stream things as the data was too big to hold in memory multiple times. Right now I do have that issue. I did not need to stream on the Android side, I am using GSON over there. I do like GSON parsing right into my natural object format where NSJSONSerialization just does a generic dictionary. Makes method name traversal impossible. The objects are rather deep for the JSON I am getting back so I need to find a decent way to get to the info I need. All the REST calls are done via C# and IIS so none of it is really optimized for Java or Objective C consumption but it is JSON which I find easier to deal with than XML.

I will need to all pull to refresh and navigation menu support too. Guess I need to get my head back into Objective C and review the list of CocoaPods I used in the past.

Since all the news about Swift as been in the news as of late I have started to sniff around. To me it looks like a nice step in new direction. I like they syntax having never been a big fan of [ ] []]]]]] [[[][][]]] all over in Objective C. Swift looks JavaScript like. Don't think I care for the .. vs. ... for the loop construct where on does inclusive start / end index and the other does start / end - 1. I would rather have a more distinct syntax between the two.

Sadly I don't have current access to Xcode 6 so I am not playing with that. From what I have read neither Swift nor Xcode 6 is ready for primetime meaning it is best for me to concentrate on the old Objective C via Xcode 5 and AppCode for now. Documentation is also sparse. I hope they hammer out the issues quickly as I would like to move away from Objective C sooner than later.

I have picked up a lot of info on the Android side again too. I have done JSON work there before but again I forgot a bunch of it having not messed with it in nearly a year. Good thing Google works most days. 

Wednesday, April 30, 2014

Living in AngularJS for a few months

What is it like for a Java / Objective C / Mobile guy to live in Angular for a few months? It has been an interesting ride for sure.

The mobile work, which I dearly miss, is at a stand still while marketing decides on various issues such as it being free or having a price. This means I need to help out in other coding areas and for right now. They decided to toss me into AngularJS.

It takes some time to get your head wrapped around Angular. What is a service, controller, directive or manager? How does this magical binding work? Where is the GET call for the REST service?

I was using the 30 day trial of WebStorm as that seemed to be the tool of choice for every video I watched doing a demo of Angular code. I like the IntelliJ product line. I use AppCode for iOS work and Android Studio for by Android projects. We get a multiple user site license of IntelliJ which includes the WebStorm plug-ins so I switched to that. WebStorm 8.0 EAP has better Angular integration which will be merged into IntelliJ at some point. For my personal use I am waiting on the next IntelliJ sale to pick up a copy for home use.

Using IntelliJ allows me to run our Java based application server too. That code is a Maven project making it easy to import as an IntelliJ project. Nice having one IDE for both of those projects and I especially like the Dracula theme. I run a dark theme in Eclipse but it has some minor UI issues.

IntelliJ ties in to our JSHint settings as well. The Jenkins integrated build system will kick out the project as failing to build if you don't follow our JSHint settings. Having the IDE show them to you as errors before you run the GRUNT process is very nice.

Using GRUNT SERVE allows me to start the web process and then have any changes I make to the HTML, CSS, SCSS or JS files automatically built and pushed out to the web. I am using Chrome which also integrates with IntelliJ for JavaScript debugging. I also use the integrated Chrome web developer tools but the IntelliJ debugger is more feature rich to track down the harder issues.

I run GRUNT before I set up a STASH pull request. That runs JSHint, Unit Tests, Minification and all the other fun which is the same process Jenkins runs. I try to always check in clean code.

How is Angular? It appears to be a really solid API with a lot of helpful features. The live data binding is one of them. You set up {{ variable_name }} in the HTML and if that variable is defined in the controller the HTML will automatically update when you change the variable value in your JavaScript. There is also all sorts of boolean logic you can apply to show and hide HTML elements using ng-??? tags.

Angular is like Android in a number of ways. You need to understand 3 or 4 objects before any one thing works. In Android you would need to know the Activity houses a Fragment and they are both using a layout defined in XML that pulls data from strings.xml and the List in the Fragment is using another java class that uses one or more other XML layouts to display the data. Very confusing at first. Angular has a similar tie in of controllers, HTML layouts, CSS styles, etc.

I did not write the initial version of the Angular app. I got to wade into the deep end with a list of bugs and feature requests to see how much damage I could do. Took a few weeks to start knowing where to look and the initial project did not follow the best file naming conventions, which has since been cleaned up.

Now I have a pretty good idea of what is possible, what bootstrap widgets are available, how to look up and use underscore.js helper methods, available moment.js methods and how to get around the other 3rd party code bits we pull in via BOWER.

Of course general programming knowledge always applies. There are loops and IF statements and all that fun. It was basically learning a new framework. The fun comes in when you get to test in various browsers. So far the Angular side has not caused any issues but HTML and CSS play a different ballgame. I am on a Mac as I do iOS programming. Things were working fine in Chrome, where I spend most of my time. The UXD staff uses FireFox and ran into various minor issues that I was able to quickly fix. I also test in Safari and have not had to do anything special in there yet.

The real fun begins in Internet Explorer. I have a VM set up with Windows 7. Things were not looking so good in there. Turns out we have some bad HTML which the other browsers ignored. Specifically an extra end tag of
. IE gave me a non-helpful error message deep in the bowls of Angular for that. The other browsers just blew it off. Simple fix. The other changes were setting some bonus CSS styles for the modals - commonly called dialogs in other frameworks. All the changes I made did not affect the other browsers so I was not required to put IF statements around them just for IE.
I went ahead and set up a pretty full environment in the Windows VM which included GIT, GRUNT, Ruby, BOWER, NPM, Node.JS and Sublime text editor. I did not set up IntelliJ on that side as I would have to kill it on the Mac side and start it on the PC side each time. I am generally making small changes for IE so that has not been a big deal.

The web tools in IE are not as full featured as FireFox or Chrome but are servicable. I was able to change CSS styles live and see the effects which is very happy. CSS seems to be a lot of trial and error to get things right. Not a big fan of that mode of development. When I see something out of place in my Android layout XML I generally know why it is messed up and I can quickly fix it. With CSS the whole team plays the "throw stuff at it until it works" approach. Try setting margin, now set DIV to overflow = auto; or toss in a float: left. When it works I am happy but I always want to know why that made it work. Plus the CSS has a lot of inheritance which is not obvious when the styles are defined in multiple CSS or SCSS files. At least the web tools in the browsers will show you where various things came from and what overrides what.

We plan on turning most of the HTML and CSS manipulation over to the CSS team. I believe they will do a better job laying things out in the CSS files getting more object reuse there and they can keep track of how changes will affect various areas on different screens. They won't touch the binding areas or the i18n areas.

Like most of the projects I have worked on we have done the i18n work and have had the project localized into Spanish and Korean. A member of the sales staff plans on doing a French localization for us when the code is closer to complete. I always put strings into separate resources just in case someone wants to localize the product.

For QA to test this we generally hijack a rarely used locale and do a simple reverse English version of our test. That way QA can quickly see on any screen if the text is not reversed then we have not pulling it from the resource but they can still read everything on screen. Reading backwards is tricky but sure is a lot easier than guessing at a language you don't know at all.

I wrote a small Java utility to reverse the strings for this file. Big deal right? Reverse a string, grade school 101 that task. The issue is you don't want to reverse macro replacement text. The string "You have {{carrot_count}} carrots\nBuy more!" is reversed to "!erom yuB\nstorrac {{carrot_count}} evah uoY".  Don't want \n to be n\ and the variable name cannot change.

In the end I am not minding my time in Angular but would really like to get back into mobile. Anytime you learn a new framework it opens your toolbox even if it to steal ideas on how to do things differently in your "old language and framework". The Angular app is not large but it looks good and is very functional. It beats the heck out of the previous JQuery app I helped out on.

What don't I care for? JavaScript is not statically typed so a number of programming errors don't appear until you run the project in a browser. IntelliJ does its best to keep you honest but it can't catch everything. Misspelling a variable in HTML that is bound to a JSON field will burn you more than once. Dynamic variables of this type, that type, array or not at different times will also burn you. It also causes havoc with the intellisense / autocomplete features of the IDE. You end up keeping multiple files open just so you can reference variable names. Refactoring is a lot tougher too.

The worst part is browser differences. Sure, in Android land you deal with different SDK versions and screen sizes. Under iOS you have a couple of different screen sizes and some hardware differences. Here I sit on a single computer and I have to test in 4 browsers minimum. It appears IE is the pickiest of the bunch so I should start in there but it has the least useful web tools and I would be working in the Windows VM all day long which does not add to the fun factor.

Like every new program language and framework it has been an experience. Some good, some bad, some fascinating. I will steal as many ideas as possible from this experience when I get back into mobile land.

Thursday, March 20, 2014

Is it fast enough - the lost art of building fast programs

When I was writing programs for the stock market speed and memory usage were huge issues. You dare not leak any memory because 100,000 headlines coming your way in a 24 hour period with a memory leak was a sure way to crash a program.

Speed was also very important. In the news business being first, and maybe only, source to get a headline out was critical. It needed to be on the screen right away. Turns out accuracy from the source was of less importance, they could always correct things in the story body later.

After the stock market company outsourced everything to India I work on tamer programs that did not use real-time data. Of course you still don't want to leak memory and you want things to be fast but the thrill and stress of that waned considerably.

Writing mobile apps brought a lot of that back. Not only do you want to avoid memory leaks you want to have as small a footprint as possible. The CPU / GPU combination on a mobile device is much slower than the desktop you are developing on. Speed is again a big factor. No one wants taps and swipes to feel like molasses. You have much less screen space to deal with and you need to use it wisely. Everything was about speed, space and time again. The thrill was in the air. I never stopped coding like size and speed mattered but the importance bubbled to the top again and I loved it.

Right now I am helping out with a web application using JavaScript and AngularJS. I have used JavaScript with JQuery in the past and I find AngularJS to be big step in the right direction. The app really just needs to be fast enough to be usable. Simple request / reply / show it on the screen operations. Speed is in no way critical and really is just an afterthought if considered at all. We are also using a number of JavaScript libraries including Underscore.js.

As I use various methods in these libraries I wonder about their speed and efficiency. You do seem some mention of that when you query about Underscore array methods on Stack Overflow. I don't feel enough attention is focused here and I try to find and use the most efficient method for my code. Sure, it is not bad to make a new copy of an array to add or remove a few elements but if that array grows tenfold what happens?

It is so easy to look at code and think each line of code takes the exact same amount of time to execute. Here is this wonderful AngularJS controller and it is only 20 lines of code! Dang it must be fast because when we did something similar in JQuery it was 100 lines. Sadly reality does not work that way. Each of those 20 lines can be running all sorts of framework code. That one call to an Underscore method might be 50 lines in itself. Dynamic injection is happening. DOM changes are occurring. Watch methods are being called. Other controllers are receiving messages and running lines and lines of code.

It is wonderful when the framework takes care of the busy work. I want to focus on the business logic at hand. I love it when a few lines of code updates four separate areas of the screen. I have written multithreaded framework code to perform those types of actions. Set a variable to false and have everything that cares disable - the menu item, the toolbar button the right button menu option, etc. If the user of my framework put the call to toggle the setting between true and false in a loop it looked innocent but man a lot of stuff was happening in the background.

I still want to know what is going on behind the scenes. When I called that line what was the ripple effect? If I add an item to that collection does it create a whole new collection and return it to me or just add it? Did it walk the entire collection to add it to the end or is the push operation fairly native? Does it scale well or do I need to use a different object or collection or framework to do this job? Will the client have 10 of those or 1,000 of them?

Speed is hard to add but easy to lose. Optimizing early can be a waste of time. Not thinking about optimizing at all can kill a project. Right now I am trying to learn so many new things in the JavaScript arena it is hard to know if I am doing it correctly. As I write the code I try to look for the optimal way to do it. Luckily code reviews help point out when I missed a better way. Taking time out to find web references is also needed. I try to scan over all the available methods in a library even if I don't need them now just in case I need them later. I may not remember the exact name but if I remember there was a method I can go back and find it and give in the in depth evaluation pass to decide if it is usable.

Tuesday, March 11, 2014

Let's have some IDE fun

During any given day I might be in 6 different IDEs. Eclipse, IntelliJ, Android Studio, Xcode, AppCode, and Aptana. Generally I have an instance of Sublime text editor running too. I use them for the following things:

Eclipse - Java server side work (our REST services)
IntelliJ - Java one off utility work
Android Studio - Java Android mobile development
Xcode and AppCode - Objective C iOS mobile development (some Mac work too)
Aptana - JavaScript with AngularJS, bootstrap and other libs
Sublime - taking notes, small file edits including .gitignore and other system type files

At times it can drive you crazy. I use a Mac at work due to my iOS needs and depending on the IDE I might use CMD+S to save or Ctrl+S. Since I have a PC background and I switch to Ctrl+S at home in any IDE I am in when there. I screw up the keystrokes at times but generally have a feel for which IDE I am in at any given moment.

Eclipse is the old standby I have use for years. There are a ton of plugins for it to do nearly anything but you can't always get them to work as expected or even together. We just switched from SVN to GIT at work. Probably need to throw out the SVN plugins as I will not be using them and no real need for them to load up each time. Also the menu system gets a bit cluttered. Heck it might be a good time to start with a fresh Eclipse install as I also have the Android plug-ins running and I have switched to Android Studio for that work. Code completion works ok but is not spectacular. Refactoring works and has not crashed on me. The editor is fast and has a ton of features.

IntelliJ has a great Dracula dark theme built right in. I run a dark theme in Eclipse too but it does not theme everything perfectly. I handle one off programming in IntelliJ. Testing code bits, working on small stand alone utilities. I could do some of that in Eclipse too but I tend to have the server stuff open there and switching workspaces in Eclipse is slow as it is a full reload of the IDE. I could use workspaces in Eclipse and I do at times but our server stuff is rather large so I prefer to leave it sit by itself.

Android Studio is an IDE I like a lot as it is IntelliJ based. There have been some growing pains with the constant updating to the newest version of gradle but in general the IDE is superior to Eclipse. It has better code completion, a better preview window for your XML based layouts, shows the colors and icons in the gutter, makes it easier to convert string into the string table, shows the replacement string in code instead of the string ID and a bunch of other smaller bits of "thanks for doing that" areas. I would say that Eclipse is faster at building and getting the code on a device but I am willing to forgo that speed for all the other features Android Studio offers. It works well with Genymotion, the device emulator I use.

Xcode is my least favorite IDE of the bunch. I have to use it for iOS development but it is behind the times in areas like refactoring and its code completion tends to not be as helpful as other IDEs. Sure, you get a full list of what is possible but it does not move the most commonly used ones to the top of the list. It also crashes on me more than any of the other IDEs especially when it comes to refactoring. I have had it crash when refactoring a variable that only appears twice in a 20 line method. It makes you scared to use it. It was also terrible when it comes to using SVN. GIT is much better. I wish it would offer to automatically include needed H files instead of my manually moving to the top of the file to type them in.

AppCode is also from IntelliJ. I use it when I am doing heavy Objective C coding when I already have the UI in place. So far its refactoring has worked every time crash free. It has more intelligent code suggestions, if you add a reference to an object it will prompt to add the proper H file, it handles CocoaPods nicely. There are so so many areas where it is coder friendly. Sadly it does not have an Interface Builder replacement so you end up back over in Xcode to handle those chores. They sync together without a hitch and both use the same project files making moving between them relatively painless.

Aptana has some nice code completion aspects for CSS and HTML along with a solid JSHint tie in. Since our server build does not allow JSHint errors to pass it makes it so much easier to catch them before you push to master. It is Eclipse based but focused on JavaScript which means I could end up cluttering it with plugins but so far I have kept it down to the minimum I need for JS programming. I have used this IDE flavor for the least amount of time of those listed but with my heavier involvement in JavaScript I have been very happy with it.

Sublime is my go to editor. I leave multiple tabs open with "To Do" lists for each of the projects I have going at any time. This allows me to type in quick notes so I don't forget something because people tend to drift in and out of my office with suggestions the mobile app, to share some tidbit of useful information about the server, a GIT command or something else helpful. I have a file for general work info, one for Android and one for iOS info open all the time and then I open and close other files as needed. The color coding support in Sublime for a multitude of file formats is awesome. I also use it to pretty print XML and JSON when I copy / paste server responses out of the Chrome web tools window. 

It can fry your mind to shift in and out of so many programming languages and IDEs in any given day. Of course I try to keep it to a minimum but that is not always in my control. My preference would be to stick in the world of mobile doing Android and iOS development. Right now that is on hold so I am helping out on the JavaScript team. Lots of time on Stack Overflow and doing web searches as my brain does not have a solid cache of JavaScript programming idioms and patterns. Looks like Aptana it is for the next few months.

Thursday, January 16, 2014

Demoing with Netgear PTV3000 a projector and a Note II

I needed to demo the Android application I had written at a company all hands meeting. I came up with a couple of potential solutions as I only had a few days to figure this out.

1) Run in the Android emulator


Uses same laptop as you use for the PowerPoint.


People might consider this to be a cheating slideshow as you are not on a "real" device.
You have to manually rotate the emulator
Emulator can show crappy gradients and other visual effects

2) Use Google android screencast


Simple JAR file to run on laptop that is already showing PowerPoint.


Rotation not supported.
Only runs at 4 fps or so.
Scales output and it is not pretty
Can look like a cheat and not a real device

3) Use Micro USB to HDMI cable


Not very expensive
Shows you are actually using a device
Can charge phone at same time as sending video


Was not able to find one locally, would have to overnight
Tends to not be generic, different cables for different device manufactures
Can't walk around with phone as you are tethered to the display device

4) Netgear PTV3000 wireless HDMI 


Wireless, you can walk around with your phone during the demo
Auto rotates to match your device
Fast - I was able to watch a video on my TV
Works with a large set of Android and Windows devices
Proves the code is actually running on a device


Most expensive option but at $60 it was not a bank breaker
Does not work with iOS devices
Usage of HDMI to other adapters might not work

I went with the Netgear PTV3000 as a local Best Buy had it in stock. Setup up was simple, plug it in, plug in an HDMI cable and ask my phone to screencast. Worked the first time, worked every time. I tested it at home on my TV using my Note II, wife's S III and my Google Nexus 7 (2013 edition) without a hitch. Only one device is connected at a time. I was able to play games and watch YouTube videos. There is a small lag between your phone display and the TV display. The display on the TV is auto rotated as you rotate the device and both portrait and landscape appeared as expected. Landscape is the better use of screen space on a TV.

Since I have a Note II I was able to pull out the stylus and see the "hover circle" on screen as I held the stylus just above the screen surface. This is very handy in a demo as you can point out / circle where you are about to tap or point out interesting areas on the screen. Other times I have had to use a laser pointer to achieve something similar.

We wanted the output to show on both projectors at the venue. They had an odd setup and were not able to split the HDMI. We tried an HDMI to DVI adapter but the Netgear did not want to play that game. HDMI is a bit picky about copy protection stuff so I was not too surprised. A direct connect with an HDMI cable to the projector worked fine.

This is a wireless connection but it is a direct wireless connection. I was not using the hotels wireless connection at all which is how Apple Airplay works. This means we did not have to pay overpriced hotel wireless fees and I had the full WiFi N bandwidth between my device and this tiny unit.

I was able to stay connected from the back of the room which was a pretty good distance. No hiccups during the presentation. It can suck down your battery on your phone though as it is constantly sending its screen out into the air to be picked up. The Note II has a sizeable battery so that did not come into play and I had it charged up before I started the demo.

Very impressed with this small and cost effective device. The demo went smoothly. The connection between my phone and the device worked like a charm. Splitting the video was an issue we did not solve. The Note II with stylus was an excellent device for pairing and the stylus came in handy for a new purpose. I love the auto rotation matching as parts of the demo needed to be in portrait and some in landscape. I wish Apple would support the Miracast format.

We will be getting more use out of this device in the future. The kids thought it was pretty cool when I brought it home for testing. Seeing their Android games on the big screen was pretty fun for them.

The Netgear already had the latest firmware on it. I did not need to update anything. I did kick it into web server mode so I could look a the firmware version and other settings. I could have forced it into "press button to accept connections mode" but did not. I figured no one in the room would randomly connect to the device. The hotel staff took a picture of the device. They may buy one and rent it out for $75 a use and make their money back the first time a sucker, I mean client, needs it.

Thursday, December 12, 2013

How do you respond to "Who cares? It's going away soon anyway."

I am hearing this more and more "Who cares? It's going away soon, just hack in a solution!" Guess what? Nothing goes away soon. Unless the replacement is fully written and ready to ship and the users have no choice but to upgrade then it is going to be around.

What is your response when this dilemma is posed to you?

I try my best to avoid hacks. I want to use the best possible coding practices when possible. So, when are they not possible? Let's say one of your apps has been internationalized and localized. You are working on an second company app that has not been. It might drive you crazy to add yet another hard coded string to that app but doing it right and starting the whole internationalization / localization process is not going to pay off in this situation.

Maybe you are on an app that has styles mixed in to the HMTL instead of being in CSS files. Not hard to create a CSS file right? Nope but it might create large changes to the build / distribution process thus doing that towards the end of a release cycle might not be the best idea.

Maybe you end up in some Java code that only uses Vectors where is should be using List and ArrayList with generics. If the collections are localized then I would probably fix them.

I find it depressing when the development staff has given up and goes into hack mode because everything is about to be replaced with a new design. I know code outlives your every expectation.

I was working at a company three years ago that was converting from Java via WebStart in the browser to C# with WPF. For some reason the CEO hated Java even though it was half their income with the other half being the C++ version of the product. Java ran on Windows, Mac and Linux. I worked on the C# product too and left for other reasons than the switch. I don't mind C# although I did not feel it was the best solution here. They pretty much only wanted hack fixes to the Java stuff.

Three years later and guess what? Yep, the Java code is still running in the field. It is taking much longer to replace than originally thought. They have moved it to Java 7 to keep up with Oracle and bug fixes.

I have seen this happen way too often. With the web it is easier to kill something. If you replace all the JavaScript on your server the next time the user hits your web page they get the new code. They don't get the choice to continue to use the old stuff. Mobile is close. Most folks update their apps unless you toss in some new crazy permissions like read all my contacts when you are a simple game. Desktop is a bit harder. Using WebStart allowed us to force the upgrade. On the Mac you get update notifications which is nice. On the PC you pretty much get patch notifications from Microsoft and then it is up to the vendor to write their own. Adobe likes to patch stuff.

As a professional programmer I like to treat all my code the same, like it will live for a long time. I don't want to fall into the hack in in trap. Design it, write it, test it then check it in. I refactor things when method and variable names are getting confusing or no longer reflect what they do. I move things into new objects when the line count in current objects gets out of hand or where a new object or base class just makes sense.