EDITING BOARD
RO
EN
×
▼ BROWSE ISSUES ▼
Issue 19

What to Learn In 2014

Alexandru Bolboacă
Agile Coach and Trainer, with a focus on technical practices
@Mozaic Works



MANAGEMENT

The starting of the year is a good moment to think at the future. How can you grow your career? How can you have a (more) stable job? How can you be more wanted in a competitive market?This article contains 10 technical skills that a programmer can learn and can help grow your profile with your colleagues and managers.

10. Touch typing

Formula 1 cars have many secrets; the best kept one is the tyres. The reason is simple: no matter how efficient the engine is and how good the pilot, the tyres are the ones that connect the car with the running surface.

Similarly, the keyboard is the way the programmer"s brain connects with code. Your ideas, no matter how good they are, must translate into code as quickly as possible. Touch typing is the skill to write on the keyboard without looking at it. It allows fast typing and focus on problem resolution. Moreover, it allows reducing the time spent writing emails or documentation.

Like any other skill, touch typing can be trained through practice. www.typingstudy.com , www.typingclub.com/typing-qwerty-en.html or play.typeracer.com are websites where you can learn touch typing or compete with friends or co-workers. Using these websites usually turns into a fun activity, because of their competitive nature.

9. Your Editor Or IDE

Modern code editors have hundreds of features. Some of them are extremely useful and not used enough. Mastering them allows quick editing, navigation and code modification, even with unknown or poorly structured code. For example:

  • Advanced editing
    • Delete a line (Ctrl+D in Eclipse, Shift+Ctrl+L in Visual Studio)
    • Move a line up or down. Also works on multiple lines of code.
    • Selecting any block of code between curly braces or parenthesis (Ctrl + W in ReSharper)
  • Navigation

    • Finding all references towards a variable or class
    • Navigate to a method implementation
  • Refactoring

    • Renaming a variable, method or class (Alt + Shift + R in Eclipse, Ctrl + R, Ctrl +R in Visual Studio).
    • Extract method (Alt + Shift + M in Eclipse, Ctrl + R, M in Visual Studio)
    • Extract interface
    • Promote method from a class into an interface or base class
    • Extract class

Many other useful features are documented in cheatsheets available online.

8. Reducing Compile Time

Any code change requires validation. For the programmers who use a compiled language, the validation time depends on the compilation time. It"s never pleasant to wait for a program to compile; plus it"s easy to lose focus in this time.

Java IDEs, like Eclipse or IntelliJ Idea, offer continuous compilation on the expense of CPU and memory. .NET Daemon from RedGate (www.red-gate.com/products/dotnet-development/dotnet-demon) offers the same thing for .NET.

Even without these tools, it is possible to significantly decrease the compilation time of a program, no matter how large it is, through a few techniques:

  • SSD Hard Drives. Although they still seem expensive, their price is rapidly compensated by the programmer"s spared time

  • Creating temporary solutions or projects (or compiling units in C++) that can be modified, compiled and validated much faster than the whole project

  • Knowing the compiling options. For example: incremental compilation and using all available cores are common compiler options that help decrease compilation time.

7. Programming Language and the Main Technology Used

A feature can be implemented in countless ways. Only a few of them are both correct and easy to extend.

One of the common simplification methods is to use to the maximum what"s already implemented in the technology. Language constructs equally allow simplifying the code.

A counter-intuitive method to master a technology is to try other technology and compare. The simplest way to try another technology is to collaborate with a knowledgeable programmer, either by discussing on existing code or by writing new code using pair programming (see 2).

6. Modifiable Design Principles

The main problem developers everywhere face is that they always need to modify existing code. In the beginning of the project, the code is easy and quick to change. As the project advances and more code is written, modifying it becomes challenging. That"s why the application design should be optimized for changeability.

SOLID principles and design patterns have emerged as solutions from the common experience of programmers more than 10 years ago. Any team challenged by code changes should invest time in profoundly understanding and applying them.

5. Effective Refactoring

Difficult to change code can be transformed into easy to change code through refactoring. Refactoring is an investment in the future; the resulting code "opposes" less resistance and the cost to implement a new feature decreases.

To refactor successfully, a programmer needs two things: knowing and applying the principles of changeable design (see 6) and optimizing the refactoring time.

Here are some secrets of effective refactoring:

  • Use the automated refactorings. Modern IDEs (Eclipse, Visual Studio + ReSharper or IntelliJ Idea) offer these features. Popular programming editors, like vim, offer the possibility to record macros or write refactoring scripts. No matter the solution, automated refactorings help save time
  • Know manual refactorings. Sometimes, the editor hasn"t automated certain refactorings. The "Refactoring" book by Martin Fowler describes in detail how to make manual refactoring safe and fast.
  • Refactor continuously. The longer you wait to refactor, the more difficult it is to change the design and the highest the investment. Continuous refactoring allows eliminating design problems very early, but it requires solid design knowledge and reviews with colleagues.
  • Automating complex but common refactorings. Most IDEs can be automated through scripts, which allows automating refactorings specific to the application.

4. Effective Test Automation

As new features are added to an application, the testing time tends to increase. Modularization, adding new testers and automated testing are possible solutions of this problem. Teams that choose automated testing often fall into the trap of complex and difficult to maintain tests. The solution is to structure automated tests using the pyramid of tests.

The pyramid of tests is a structured approach to automated testing through the division of tests in categories:

  • Unit tests: validate behaviors expected from a class or more classes. They are fast, simple, use test doubles (stubs and mocks) and are executed by programmers after each change in the code. They are the most and can cover 90%+ of the behaviors.
  • Integration tests: validate the integration of the classes from the application with any external system (libraries, frameworks, services, OS). They are slower, more difficult to write and should run whenever the libraries change or on automated build.
  • Contract tests: validate collaboration contracts between two classes, usually from different modules.
  • End to End Tests: validate the most important features from a module or application, by exercising the real system. They are usually complicated, slow and brittle because they require creating and configuring a test environment similar with the production. They don"t use the UI.
  • System tests: validate the system using the UI. They can be executed manually or automated with specialized tools (eg. Selenium)
  • Exploration Tests: manually executed by a tester who actively searches programming errors. They are very useful for finding hidden problems.
  • Acceptance Tests: their purpose is to create executable specifications easily read by Business Analysts, Product Manager, Product Owner, Business Stakeholders and other non-technical but knowledgeable about the business or product.

An effective testing strategy is based on a combination between many unit tests, just enough tests from the other categories and exploration testing to prevent most bugs. This strategy can cover a whole application (if it"s business or life-critical), or just the most risky parts. An architect or CTO can define and see to the implementation of this strategy.

3. Working fast and safe with existing code

Most programmers work with existing code. It is often older than 2-3 years, sometimes 10+ years. The initial team members are not in the team anymore or can"t answer questions. It is therefore the job of the programmers to understand and change the existing code without introducing new bugs when adding a feature or fixing a bug.

If testing a new feature is easy, validating that nothing else was broken is much more difficult. At the same time, we would like to improve the design to optimize adding new features in the future (see 5). But how to do it, if the existing code is unclear?

Special techniques to understand and modify unclear code have been created in time. Some of them are:

Golden master: writing automated tests that first store the outputs and on the next executions compare them to the initial ones. They ensure a first safety net against undesired changes, but are just an intermediate step towards unit tests.

Characterization tests: writing automated tests with the purpose to discover behaviors of existing code. Once a piece of code has been covered with characterization tests, it can be extracted in new classes or methods, as a first step towards design simplification.

Extract and override: a technique that allows focusing on a small piece of code. It"s composed from extracting a complex piece of code that we don"t yet want to focus on in a method that is then overwritten for testing purpose (a partial mock).

Exploratory Refactoring: Refactor with the purpose of discovering alternative designs. When refactoring is automated through scripts, you are using the Mikado Method.

Many other techniques exist, most of them described in the book "Working Effectively with Legacy Code" by Michael Feathers and treated in the workshop "Working FAST and Safe with Existing Code" (www.mozaicworks.com/workshops/working-fast-and-safe-with-existing-code) .

2. Faster Learning

Technologies and the software industry change continuously. Programmers have to learn new things all the time, so optimizing learning is very useful.

A few methods exist to learn faster, and some of them are:

  • Involve other programmers in learning (social learning)
  • Prepare a presentation for a friendly audience
  • Deliberate practice
  • Coaching or facilitated practice sessions
  • Experimenting

For more details, read the article "5 Trick to Amplify Learning" (www.mozaicworks.com/blog/5-tricks-to-amplify-learning/).

1. Remember to Have Fun!

The most important thing is to enjoy your work. There will be difficult moments, problems and misunderstandings in any team. It"s important to remember that programming is an amazing job, that you"re working with intelligent people and that we can often ease the lives of our users.

Celebrating team successes, events like "code and beer" or code retreat, working with unknown programmers at community meet-ups are just a few ways to enjoy writing code and to remind yourself how fun it is.

Have Many Accomplishments in 2014!

Conference TSM

VIDEO: ISSUE 109 LAUNCH EVENT

Sponsors

  • Accenture
  • BT Code Crafters
  • Accesa
  • Bosch
  • Betfair
  • MHP
  • BoatyardX
  • .msg systems
  • P3 group
  • Ing Hubs
  • Cognizant Softvision
  • Colors in projects

VIDEO: ISSUE 109 LAUNCH EVENT