Saturday, October 22, 2016

Salaries and Job Offerings Categorized by Programming Language

The Paysa Blog recently featured a post Silicon Valley’s Most Valuable Skills in which they looked at the most valuable software development skills in the United States in terms of average salary and in terms of job openings listing the skill. Of particular interest to me was the portion of the post on programming languages and how average salaries and number of opportunities correlate to each of the listed programming languages. I briefly summarize some of the observations I found interesting in this post and refer interested parties to the original post for further details on the methodology and results. For anyone wanting a slideshow providing a high-level summary of this post that highlights nine programming languages associated with numerous job listings and with salaries over $120,000 (US) in the United States, see 9 tech skills that pay over $120,000 and are in demand.

Perhaps the best way to highlight what I found most interesting in the post Silicon Valley’s Most Valuable Skills is to look at one of the charts featured in the post.

Provided by Paysa and used by permission (see "Fair Use" on source post)

The blog post summarizes a key observation from the collected data depicted in the chart above: "We found that skills considered to be less common often resulted in a higher salary." As an example, the post describes how the increasingly less commonly requested skill of Objective C (because of the ascent of Swift) is one of the most highly compensated and the most highly requested programming language skill on the chart (SQL) is associated with one of the lowest average salaries.

Another emphasized observation in this post is, "Almost 20 percent of the jobs we saw indicated a need or understanding of SQL." This is more evidence that it benefits software developers to avoid contracting SQLphobia.

There is coverage of regional salary and available positions related to programming languages in this post, but I would have loved to see the salary and job openings mapped to individual metropolitan areas in the United States in a chart or charts because the "same salary" can actually quite different from a "supported lifestyle" point of view between areas. Speaking of regions, this information is obviously less useful to developers residing and/or working for employers outside of the United States, but I still think these observations can provide interesting perspective for those developers. It was a bit surprising to me that Paysa found that "San Francisco companies are looking for applicants who specialize in Java" and that "Boulder, Colorado, proved to be the city where JavaScript skills are most in demand."

Software development opportunities are about more than monetary compensation. Many of the best software developers I know want interesting challenges, the ability to learn new things, and other non-monetary compensation from their work. Even compensation is often tricky to compare as benefits packages and perks can differ significantly. Another factor that complicates things is the use of "average salaries" because these averages can be significantly affected by region and may not represent large ranges in compensation for certain programming language skills. However, after acknowledging these caveats, I still find it interesting to see which programming languages have, according to Paysa's collected data, the highest average associated salaries and the most available job openings in the United States.

Monday, October 17, 2016

The Value in Project Valhalla

I have been interested in the progress of Project Valhalla for quite a while, but Brian Goetz's recent message "Project Valhalla: Goals" has raised my level of interest. I have frequently enjoyed Goetz's writing because he combines two characteristics I want most in a technical author: he knows the subjects he writes about much more deeply than what he is writing about, but is also able to present these concepts at a level approachable to the rest of us who lack his his depth of knowledge in that area. The mail message "Project Valhalla: Goals" is significant in several ways and is highly approachable; it should be read directly by anyone interested in why Project Valhalla is so exciting. Although I recommend reading the original, approachable message, I collect some of my observations from reading this message in this post.

During my software developer career, regardless of the programming language I am using, I have typically found that most software development consists of a series of trade-offs. It is very common to run into areas where the best performing code is less readable than slower code. This trade-off is, in fact, what leads to premature optimization. The danger of premature optimization is that it is "premature" because it the performance gain achieved by the less readable code is actually not needed and so one is effectively exchanging "more dangerous" or "more expensive" code for an unneeded performance benefit.

In Java, a common trade-off of this type is when using objects. Objects can often be easier to use and are required for use with the highly used standard Java collections, but the overhead of objects can be costly in terms of memory and overhead. Goetz points out in "Project Valhalla: Goals" that Project Valhalla has the potential to be one of those relatively rare situations in which performance can be achieved along with "safety, abstraction, encapsulation, expressiveness, [and] maintainability."

Goetz provides a concise summary of the costs associated with objects and maintaining object identity. From this brief explanation of the drawbacks of maintaining object identity in cases in which it is not needed, Goetz moves to the now expected description of how values types for Java could address this issue. In addition to briefly describing advantages of value types, Goetz also provides some alternate names and phrases for value types that might help to understand them better:

  • "Aggregates, like Java classes, that renounce their identity"
  • "Codes like a class, works like an int"
  • "Faster Objects"
  • "Programmable Primitives"
  • "Cheaper objects"
  • "Richer primitives"

Regarding value types, Goetz writes, "We need not force users to choose between abstraction/encapsulation/safety and performance. We can have both." It's not everyday that we can have our cake and eat it too.

In "Project Valhalla: Goals", Goetz also discusses the goal of "extend[ing] generics to allow abstraction over all types, including primitives, values, and even void." He uses examples of the JDK needing to supply multiple methods in its APIs to cover items that are not reference types but must be supported by the APIs because "generics are currently limited to abstracting only over reference types." Goetz points out that even when autoboxing allows a primitive to be used in the API expecting the reference type corresponding to the primitive (such as an int argument being autoboxed to an Integer reference), this boxing comes at a performance cost. With these explanations of the issues in place, Goetz summarizes, "Everyone would be better off if we could write a generic class or method once -- and abstract over all the possible data types, not just reference types." He adds, "Being able to write things once ... means simpler, more expressive, more regular, more testable, more composable libraries without giving up performance when dealing with primitives and values, as boxing does today."

Goetz concludes "Project Valhalla: Goals" with the statement, "Valhalla may be motivated by performance considerations, but a better way to view it as enhancing abstraction, encapsulation, safety, expressiveness, and maintainability -- 'without' giving up performance." I really like Project Valhalla from this perspective: we can get many of the benefits of using objects and reference types while not giving up the performance benefits of using primitives.

Project Valhalla: Goals provides much to think about in a concise and approachable manner. Reading this has increased my interest in Project Valhalla's future and I hope we can see it manifest in the JDK.

Wednesday, October 12, 2016

Unintentionally Obfuscated: Dealing with Challenging Legacy Code

I recently had to deal with some legacy code with significant performance issues. It was more challenging than I thought it should have been to fix the issues and I was reminded throughout the process of how relatively simple good practices could have made the code easier to fix and might have even helped avoid the troublesome code from being written in the first place. I collect some of those reminders and reaffirming observations in this post.

I was having difficulty following what the code was doing and realized that some of the difficulty was due to the naming of the methods and parameters. Several methods had names that implied the method had a single major responsibility when it actually had multiple responsibilities. There are advantages to a method having only a single responsibility, but even methods with multiple responsibilities are more readable and understandable when their name appropriately communicates the multiple responsibilities. As I changed the method names to reflect their multiple responsibilities, I was able to more clearly understand all the things they were doing and, in some cases, break the methods up into separate methods that each had a single responsibility and together implemented the multiple responsibilities of a single method.

Another issue that reduced readability of the code and added to confusion was out-of-date comments. These comments were likely correct at one point, but had become obsolete or incorrect and often described something quite different than what the code was actually doing. As I removed some of these comments and corrected and updated others, the code was easier to read because the code and comments were in harmony. I tried to only leave comments that are necessary because the code itself does not provide an easy way to express the behaviors.

Another common characteristic of this challenging piece of legacy code was the use of several overloaded methods. The types of the parameters in some cases were exactly the same, just in different orders to allow the methods to be overloaded. The methods were far clearer in terms of intent and in terms of differentiation between them when I broke the "clever" use of overloaded methods and named the methods more appropriately for what they were doing. Part of this was changing the method names to reflect the entire reason for the particular ordering of the parameters in the first place. For example (these are conceptual illustrations rather than the methods I worked on), if the methods were to covert an instance of ClassA to an instance of ClassB and vice versa, I changed the method names and signatures from convert(A, B) and convert(B, A) to convertAToB(A, B) and convertBToA(B, A). This made the calling code much more readable because one did not need to know that the local variables passed to these respective methods were of type A or of type B to know which method was being called.

The following summarizes the relatively small issues that together made this a difficult piece of code to understand and fix:

  • Methods doing too many things (too many responsibilities)
  • Poorly named methods, arguments, and local variables that insufficiently described the constructs or even incorrectly described them
    • Overloaded methods with same arguments but very different functionality added to confusion.
    • A colleague remarked that it would have been better if the methods and variables had been named something nonsensical like "fred" and "bob" than to have their incorrect names that seemed explanatory but ended up being misleading.
  • Obsolete and outdated comments that were now misleading or blatantly incorrect

Each of these issues by itself was a small thing. When combined in the same area of code, however, they compounded the negative effect of each other and together made the code difficult to understand and therefore difficult to change or fix. Even with a powerful IDE and unit tests, this code was difficult to work with. Making the code more readable was a more effective tool in diagnosing the issue and fixing it than even the powerful IDE and unit tests. More importantly, had this code been written in a more readable fashion in the first place, it would more likely have been implemented correctly and not required a fix later.

Thursday, October 6, 2016

JavaOne 2016 Observations by Proxy

I was not able to attend JavaOne 2016 and so am happy to see numerous resources online that allow me to make observations based on JavaOne 2016 content. I reference and briefly describe some of these JavaOne 2016 resources in this post and add some of my own observations based on use of those resources. These resources are useful to those of us who were, as Katharine has stated in JavaOne roundup, "unlucky enough to be stuck at home or work."

If time constraints allow it, the best source of information available online is often the presentations themselves. Select JavaOne 2016 presentations are available on YouTube and the keynotes are available On Demand. Summaries of the sessions that were streamed live can be found in the posts JavaOne Live Streaming Day 1 (September 19), JavaOne Live Streaming Day 2 (September 20), JavaOne Live Streaming Day 3 (September 21), and JavaOne Live Streaming Day 4 (September 22). The JavaOne Conference Twitter feed, @JavaOneConf, provides numerous photographs and links to more details about events, sessions, and activities of JavaOne 2016. Besides the live streaming posts, The Java Source Blog also provides brief posts representing JavaOne 2016 "Highlights" for each day: Monday, Tuesday, and Wednesday.

NetBeans Community Day at JavaOne 2016 Conference

NetBeans Community Day at JavaOne 2016 Conference was on Sunday, September 18. Mark Stephens has written a nice summary of the first two sessions of NetBeans Day 2016. Geertjan Wielenga has written about James Gosling on NetBeans and Apache. David R. Heffelfinger's The Coolest things I"ve seen at JavaOne 2016 so far reviews "several sessions showcasing NetBeans capabilities." A post written before NetBeans Community Day about that day also describes the scheduled presentations. Josh Juneau's post JavaOne 2016 Follow-Up provides an overview of the entire conference with significant coverage of NetBeans Community Day.

JavaOne 2016 Keynote

The JavaOne 2016 Keynote held on Sunday, September 18, and was actually multiple keynote addresses (Java Keynote, Intel Keynote, and Visionary Keynote). It has been reviewed several times, including the following:

JavaOne 2016 Community Keynote

Katharine's post JavaOne Community Keynote: IBM to open source Java SDK highlights arguably the biggest announcement at the Community Keynote: the IBM SDK for Java is Going Open Source (slides). Monica Beckwith's InfoQ post JavaOne 2016: IBM's Keynote – Accelerating Innovation with Java provides another overview of the IBM portion of the Community Keynote "Accelerating Innovation with Java: The Future is Today."

JavaOne 2016 Sessions Available/Highlighted Online

Several sessions of JavaOne 2016 were recorded, were reviewed, and/or have had their slides made available.

JavaOne 2017

JavaOne 2017 will be October 1-5, 2017.

References