Managing and measuring developer productivity is, probably, a hard task. Many tools have been developed to measure productivity and to ease the process of software development.
And, there are theories floating around the term, the 10x developer/programmer. Whether this is a myth or a fact remains to be seen but there are different ways to improve developer performance, perhaps make attempts to define developer productivity.
- If a person writes a good code using good design principles, he is a productive person.
- If he can debug problems quickly, he is competent.
- If he can work on a task and be focused on it, he is an asset.
- If he can identify and understand reusable libraries, never let him go.
But what happens when productivity is hampered due to the following reasons?
� Reading and writing extremely long and complex codes.
� Spending time and energy in debugging.
� Not understanding which all libraries can be reused.
A good developer knows that he can increase his productivity by learning new skills and new programming languages. The progression in the IT sector has prompted developers to keep themselves updated with new languages in order to be competent in their work.
They have to be constantly equipped to cater to the latest trends in both domain specific and cross platform applications; so learning new programming languages can also improve their productivity.
C, C++, Java, HTML, Python and PHP are the common ones, but don�t stop there. Every year, new programming languages make their entry; so if you are a developer, make it a point to learn at least one every year.
Keeping that in mind, let�s explore two of the most important programming languages that have already made a mark in the field of mobile app development - Kotlin and Swift - used by Android and iOS developers respectively.
Kotlin - Statically Typed Language for Dynamic Developers
Kotlin, a statically typed open source programming language developed by JetBrains, is built on LLVM compiler architecture and runs on Java Virtual Machine (JVM).
JetBrains unveiled the first official release of Kotlin in February 2017. It is already well known in the industry for bringing out the best IDEs like Android Studio, Netbeans, Eclipse and IntelliJ. All the IDEs work amazingly well with Kotlin, thanks to the support the latter provides. This makes it much better than other JVM based languages.
There is an amazing feature in Kotlin that lets you convert your Java file to Kotlin quickly in Android Studio. It is so simple that all you need to do is just put in your old Java file and in a single click, it will get converted to its Kotlin equivalent file.
In short, Kotlin allows 100% interoperability with Java, as it is designed to be an industrial strength object oriented language. Developers can easily call Java code from Kotlin and vice versa. They both have the same bytecode, so you can start using Kotlin instantly with the existing Java code.
This saves the developer the need to convert the entire project to Kotlin code right from the start; they can use the same Java code. Initially they can start writing minimal UI components and very little business logic.
Kotlin was inspired Java,JavaScript, Scala, Groovy and C# and can be mainly used for :
1. Client side development (using JavaScript and JavaFX),
2. Server side development (using Spring, Vert.x and K.tor) and
3. Android development
Developers who have been using Java for years have been looking for a new and modern programming language that negates all the drawbacks of Java. Kotlin, mainly used for developing Android apps, definitely fits the bill.
Kotlin has a very powerful tool, Lambdas (a way of representing a function) and it allows modelling functions in a very simple way. Through Lambdas, developers get access to an infinite number of possibilities.
Kotlin has the support of a very powerful library, Anko and apart from allowing developers to write clean and easy codes, it gives a fast and type-safe way to write dynamic Android layouts.
The different parts of Anko are Anko Commons, Anko Layouts, Anko SQLite and Anko Coroutines. Another Kotlin library worth mentioning here is the Kovenant, an easy and asynchronous library with extensions for Android, JavaFX, RxJava and more. It is easy to use and reduces overhead considerably.
Several well-known software development companies like Teleram, Yandex, Prezi, Uber, AWS, Pinterest, Netflix, Atlassian (Trello) and Coursera use Kotlin.
It is also worth noting here that Corda, the distributed ledger platform, mainly used for automating legal agreements between business partners, also vouch for the usability of Kotlin.
How Kotlin Increases Productivity of Android Developers
It is true that Java is the most commonly used programming language for Android app development. With the Java code, you can run on all devices as long as there is a virtual machine to make it work.
But even though it is a super language, Java does have certain disadvantages of its own.
1. Very Old
Java is one of the oldest and probably, an outdated programming languages around. It doesn�t support modern features like lambdas, method references, pointers, multiple inheritance and so on.
2. Highly Verbose Code
One of the most commonly mentioned flaws of Java is its highly verbose code. This makes it noisy, while developers have to spend more time reading the codes. The chances of bugs are also higher.
Perhaps Java was made verbose to allow for more customisability and flexibility on what you can do. But that feature has backfired because of the time consumption and the mental energy required to write and analyze the code.
3. Error Prone
Java is accused of being null error prone, NullPointerException (NPE) and this is one of the most common causes for Android app crashes, as bugs come in between
The reason for an NPE or NullPointerException could be the following:
� A special call to throw NullPointerException()
� Usage of the !! operator
� External Java code
� Data inconsistency with regards to initialization
When you say Kotlin is 100% interoperable with Java programming language, it means that your existing codebase can interact with Kotlin without any issues. It is possible to call Kotlin code from Java and vice versa, thereby making it easier to adopt the codes; hence the risks are considerably reduced.
The IDE has a built-in Java to Kotlin converter that allows for easy migration to code. Also, Kotlin offers developers the following main advantages.
1. Clear and Concise Code
Kotlin has a clear and concise code; hence easy to read. It is also an expert at reducing the amount of boilerplate codes that you need to write. This makes coding a pleasure, and the process is much easier when compared to verbose languages like Java.
In Java, the Hello World code is written as follows:
public class HelloWorld {
public static void main( String[] args ) {
System.out.println( "Hello World!" );
System.exit( 0 ); //success
}
}
Whereas in Kotlin, it�s as simple as this:
package demo
fun main(args : Array<string>) {
println("Hello, world!")
}</string>
As only about 40% less lines of codes are used, Kotlin becomes the obvious choice for Android developers.
2. No NullPointerException Error
Another noted feature of Kotlin is the distinction it makes between nullable and non-nullable database. Kotlin provides in-built null-safe operators. This indirectly increases developer productivity because it�s easy to catch nulls during compile time and there are no more worries of crashing your app at the runtime.
In Kotlin, all nullable objects are usually declared with a �?� postfix after the type name. The type system can totally remove NullPointerException from the codes. It can distinguish between references that can hold null, and those that cannot.
It is also important to tell Kotlin whether the variable is nullable or not when you define a variable. During nullable check, the Kotlin system will inform you of the error when you call a method from a nullable variable.
3. Highly Bug Free
Kotlin becomes a hot favorite as it allows developers to catch bugs in the compiler time and not in the runtime. This is an exclusive of a statically typed programming language as the type is associated with the variable and not the value assigned to the variable.
4. Excellent Support for IDEs and Tools
The IDE has full tooling support for Kotlin, especially on Android Studio 3.0. In the past, you needed to add the Kotlin plugin, but for all the latest releases of Android Studio, the tools come in-built. This lets quick conversion of Java language code and easy debug leading to increased developer productivity, right from language to framework and to tools.
5. Easy to Review Code
Because Kotlin is statistically typed, the developer can easily see where the class or function is applied in the code. They don�t have to leave the IDE to reach it. Kotlin focuses on readable syntaxes, so even people who are not familiar with the language can do code reviews.
Kotlin also provides functional programming support with zero overhead lambdas and mapping, folding over standard Java collections. The type system of Kotlin allows you to distinguish between mutable and immutable collections.
Instead of HTML for API docs, Kotlin supports markdown writing. This makes writing the code a pleasurable task. If developers use the Dokka tool (equivalent of JavaDoc), it can write both Kotlin and Java source code to create combined doc websites - in its own style and in the standard HTML style.
Kotlin plays an important role in tension functions too as it lets you add methods to classes without modifying the source code. It will help you build powerful language extensions and integrate existing Java APIs with other features (of Kotlin).
To get a detailed idea about the features of Kotlin in comparison to those of Java, click here.
Swift - Compiled Programming Language for �Swift� App Development
Swift is a very powerful, intuitive open source programming language developed by Apple for iOS, macOS, watchOS, tv OS, and Linux. Built with LLVM compiler infrastructure, it was designed to provide compatibility with Cocoa and Objective-C.
Swift is also a paradigm language, meaning it can support more than one programming language, and through this the developers get a framework that programmers can work in different styles. Writing the Swift code is interactive and fun, with expressive, but concise syntaxes.
It contains several modern features that the developers of today love and it is really helpful in making high speed, safe and secure apps. Apple�s Swift will run on all iOS devices that contain OS X devices starting from OS X 10.9 or later and iOS 7 or later.
However, it can use the same runtime as the current Objective-C system to run on iOS 6 and OS X 10.8 platforms. It gives Cocoa and Cocoa Touch developers to work seamlessly, thanks to the object-oriented features like classes, protocols and generics, and it helps them to develop apps with the performance and power they need.
Swift is famous for exhibiting the best of Objective-C and C, but without the limitations of C compatibility.
How Swift Increases Productivity of iOS Developers
Objective-C has been the preferred programming language for iOS app development. But, for a long time, developers have been looking out for an alternative language to Objective-C.
These are the main shortcomings present in Objective-C.
1. Highly Verbose and Difficult Code
Objective-C has been around for more than 30 years or so, and it does have a more clunky syntax when compared to Swift. Objective-C is verbose when it comes to string manipulation, and programmers have to update and maintain two different files of code due to it two-file requirement. This also means more work for the programmer.
2.Tough Learning Curve
Developers generally feel that Objective-C is tougher to learn due to its high complexity and vast syntax. Moreover, it�s imperative that you have a strong base in Cocoa/ Cocoa Touch frameworks without which it�s almost impossible to develop iOS apps with Objective-C. And, these frameworks also add to the steep learning curve of Objective-C.
3. Somewhat Unsafe
Objective-C has a strange type system that makes it unsafe. It also uses pointers - a method by which developers can expose values enabling programmers more direct access to data. This eventually leads to vulnerabilities in security. It is also not very easy for you to fix bugs.
4. Not Open Source
The source code is not available to public, and modifications are not possible. This limits the programmer�s creativity.
5. Non-interactive
Objective-C doesn�t have any particular feature that helps in visualization. Hence, most apps developed in Objective -C are non-interactive to the user and may look dry and boring.
Apple designed Swift to provide seamless compatibility with Cocoa, X-Code and Objective-C. Xcode is an IDE for developing Objective-C applications; it is like a workshop that lets you code, debug, test, profile and ship apps for Mac, iOS, tvOS, watchOS.
This makes Swift a very powerful and convenient tool to help with your Cocoa app development workflow. Developers can also use Objective-C APIs in Swift and vice versa. This ranges from system frameworks to any custom code you develop. The three main aspects of compatibility between Swift and Objective-C while developing Cocoa apps include
- Interoperability - where you can interface between Swift and Objective-C code and Swift classes in Objective-C, and make use of familiar Cocoa classes and patterns while developing Swift codes.
- Mix and Match - where you can create mixed language apps consisting of both Objective-C and Swift files.
- Migration - becomes easy, thanks to the interoperability feature and it is possible to mix and match, with the newest features from latest Swift version to your Objective-C apps.
Swift scores over Objective-C due to these main features:
1. Safe Design
Swift doesn�t use pointers, which means it is safer unlike Objective-C which uses pointers (it is a method that exposes values giving developers better and direct access to data). No pointers means no vulnerability in security.
2.Concise and Expressive Syntax
The Swift syntax is more concise, streamlines code and resembles readable
English. The Method and Function call in syntax uses comma separated list of parameters with parenthesis, which is the standard industry-rated usage.
The readability feature of Swift enables developers to adopt Swift from the following languages - JavaScript, Java, Python, C#, and C++ into their tool chain.
This is how Hello World code looks like in Objective-C:
#import <foundation foundation.h="">
int main()
{
/* my first program in Objective-C */
NSLog(@"Hello, World! \n");
return 0;
}
In Swift, the Hello World code is just so short:
print("Hello, world!")
This single line of code is the complete program.
3. Superb Speed
One of the striking features of Swift is its lightning fast speed. With a rich array of object oriented features like type inferences, generics, operators, tuples, etc., Swift saves developers the time needed to build apps. In fact, it�s very fast compared to Objective-C and Python.
Credits: Swift - Apple
4. Absence of �Nil� Object
This helps in fixing bugs in the code as soon as possible, preventing runtime crashes. The nil is dealt with the help of �?� syntax, and has been helpful for the developer as he can fix the issue right away.
5. Highly Bug Free
As developers can detect the bugs in compile time and generate compiler error, they can fix the issue, thereby saving testing time, and the preventing the chances of app crashes.
6. Easy Code Maintenance
The two main aspects that make codes easier to handle are readability and easy maintenance. Through unified files, Swift makes excellent use of immutable data structures, thereby improving code quality and increasing program reliability. Apart from reducing coupling, this would make the code reusable and coding an enjoyable task. Code maintenance is also easy, with low integration costs.
7. Interactive
Swift is interactive and fun with the help of the revolutionary iPad app, Swift Playgrounds. As it is a coding environment, it helps you to interact with Swift code, learn and explore coding in Swift without going through a project setup process. All you need to do is just create the playground to start coding.
There is no need to (1)configure providing profiles, (2) create reverse domain app ids or (3) configure provisioning profiles.
That�s not all. Swift has several other features as well.
Swift has functional programming support, meaning there is no mutable data, or no implicit, hidden state, just pure object oriented development. In fact, it aids in promoting code without any side effects or change of value in variables.
Swift has dynamic library support. Dynamic libraries are executable code chunks which you can link to an app. Through this feature, it is possible to link the current Swift base apps to the newer versions of Swift that will come up in the future. The developer will then submit the app, along with the library.
Swift has another powerful feature known as Generics that helps you to write flexible, reusable functions and types depending on the requirements you define. This will help you to avoid code duplication. A good portion of the Swift standard library is created with the generic code.
Another noted feature in Swift is the struct or the structure feature as named types that helps you encapsulate related properties and behaviors. Define it, give it a name and then use it in your code.
Swift has the Tuples feature that joins multiple values together and form a single compound value. It is mainly used when you need information about the result of an action or behavior. It has more functions that just returning a value.
Swift is also known for exceptional error handling, where errors are represented through values of types that cater to Error protocol. The enumerations in Swift can represent conditions after which support is provided for throwing, catching, propagating and manipulating errors that can be recovered at runtime.
SwiftKotlin - a Crossover from Swift to Kotlin
SwiftKotlin is an open source Mac tool that helps you to automatically convert Swift code into Kotlin code. Even though they run in different environments and have access to different frameworks and system libraries, their syntaxes are almost similar.
If you are a Swift developer, you will definitely love Kotlin, and vice versa. You can use Xamarin, ReactNative, Cordova or low level libraries to make multi platform apps. Interestingly, both have an easy learning curve and support functional programming. Both the codes are concise and hence, easy to read and maintain.
Now, let�s look at the aspects in which Swift and Kotlin differ:
1. Enums - Swift displays very powerful enums and are first-class type. They also portray the features of structs, computed properties, and different associated values per case. This leads to patterns like Results enum, which you will not find in Kotlin, as there are language limitations. However, it is possible to implement a similar pattern using sealed class instead of enum. This is a bit complicated, though.
2. Data class - Swift has no data class while Kotlin has it. It is a common pattern that deals with plain objects, and it allows you to automatically implement things like equality and copying. There is no counterpart for this in Swift.
3. Tuples - Kotlin has no tuple types and expressions, so you will have to create small data classes. Tuples are helpful in defining components interactions where you don�t have spawn additional classes to define interfaces between components.
4. Structs - Swift gives you the freedom to use the class or struct that you like for your data. This brings about major changes during implementation. There are no struct types in Kotlin and the language is of the same pattern as Java. Only the basic types like int, float and boolean are passed by value, and the rest are passed by reference.
5. Annotations- While Kotlin has full support for annotations, Swift does not allow it. There are no counterparts in Swift even for common annotations like @Inject and @Treat, which are very common in Java libraries.
6. Delegated classes and properties - Kotlin�s delegated classes and properties are its main attraction. This helps you to automatically forward invocation of methods to another class and define behaviors for properties like lazy, observable etc. It is also possible to create your own property delegates. This is not possible in Swift because you have to use the ones already provided.
7. Memory management � Kotlin manages memory through Garbage Collection approach while Swift manages memory through Automatic Reference Counting (ARC) approach. Swift�s memory management is comparatively better than Kotlin�s.
So as you can see, SwiftKotlin can plug the differences between the two and help the developer create amazing apps.
Conferences to Attend
Kotlin Conference 2017
Attending the Kotlin Conference would give you deep insights on Kotlin�s technical content. It is a two-day conference, and an official event organized by Jetbrains.
Kotlin�s creators and supporters participate in the event, apart from members of the Kotlin community. Talks about new frameworks, libraries, meetups and community events are the highlights of the conference.
The year�s conference will be held at San Francisco on 2nd and 3rd November 2017.
Click here to register for the Kotlin Conference.
Swift Conference 2017
SwiftConf is going to be held on September 6th and 7th, 2017 at the 7P�s offices in Cologne, Germany. The two-day event will discuss new trends on coding, design engineering with Swift, Swift and OpenWhisk, easy ways to do server side Swift and so on. It is an outstanding opportunity to network within the industry, and to learn how to use the new frameworks.
Click here to know more about SwiftConf.
Conclusion
Swift and Kotlin are different languages, yet they have so many similarities in them. Through the Mac translation tool, SwiftKotlin, the power of both Swift and Kotlin can be brought together under a single platform. It helps developers to build robust products through close collaboration in a more efficient manner.
Now, developers have nothing to stand in the way of their productivity; they can enjoy clean and short codes, easy to read syntaxes, no NPE errors, safe code design, less runtime crashes and so on. It can be rightly said that Swift and Kotlin can change the face of mobile app development.
Want to adopt Kotlin or Swift for your next product? Come to us; we can help you.