Hiring guide for JML Engineers

JML Developer Hiring Guide

JML, short for Java Modeling Language, is a sophisticated and comprehensive behavioral interface specification language. Designed specifically for Java, it provides an intricate platform that allows developers to specify the detailed behavior of Java modules. JML's multi-faceted nature makes it a crucial tool in the realm of software development; its ability to express intricate specifications for interfaces and classes in Java programs sets it apart from other languages. The genesis of JML dates back to 1998 when Gary T. Leavens and his colleagues at Iowa State University initiated its development with the goal of creating a single unified notation for detailed designs in Java, which was rapidly gaining popularity as an object-oriented programming language. JML embodies a fascinating blend of two-dimensional aspects: first, its practical dimension, which includes designing and documenting methods' detailed behavior through assertions such as preconditions, postconditions, and invari

Ask the right questions secure the right JML talent among an increasingly shrinking pool of talent.

First 20 minutes

General JML app knowledge and experience

The first 20 minutes of the interview should seek to understand the candidate's general background in JML application development, including their experience with various programming languages, databases, and their approach to designing scalable and maintainable systems.

How would you describe the purpose of JML?
JML is a behavioral interface specification language that can be used to specify the behavior of Java modules. It combines the design by contract approach of Eiffel and the model-based specification approach of the Larch family of interface specification languages, with some elements of the refinement calculus.
What are the main components of a JML specification?
The main components of a JML specification are: requires clause, ensures clause, and signals clause. The requires clause specifies the preconditions, the ensures clause specifies the postconditions, and the signals clause specifies the exceptional postconditions.
How would you use JML to specify a method's behavior?
In JML, you can specify a method's behavior by using preconditions, postconditions, and invariants. Preconditions are specified using the requires keyword, postconditions are specified using the ensures keyword, and invariants are specified using the invariant keyword.
Describe the difference between a precondition and a postcondition in JML.
In JML, a precondition is a condition that must be true before a method is invoked. It is specified using the requires keyword. A postcondition, on the other hand, is a condition that must be true after a method has completed execution. It is specified using the ensures keyword.
What are model fields in JML and how would you use them?
Model fields in JML are abstract fields that are used to specify the behavior of a class or interface. They are not part of the implementation, but they help in understanding the behavior of the class or interface. You can use them in specifications to describe the state of an object.
The hiring guide has been successfully sent to your email address.
Oops! Something went wrong while submitting the form.

What you’re looking for early on

Does the candidate have a strong understanding of JML syntax and semantics?
Can the candidate demonstrate experience with formal methods and formal verification?
Is the candidate able to effectively debug JML code?
Does the candidate show good problem-solving skills?

Next 20 minutes

Specific JML development questions

The next 20 minutes of the interview should focus on the candidate's expertise with specific backend frameworks, their understanding of RESTful APIs, and their experience in handling data storage and retrieval efficiently.

How would you specify a loop invariant in JML?
In JML, you can specify a loop invariant using the loop_invariant keyword. The loop invariant is a condition that is true before and after each iteration of the loop.
What is the purpose of the assignable clause in JML?
The assignable clause in JML is used to specify the locations that a method is allowed to modify. It helps in understanding the side effects of a method.
How would you use the signals clause in JML?
In JML, you can use the signals clause to specify the exceptional postconditions, i.e., the conditions that must be true if a method terminates due to an exception. The signals clause is followed by an exception type and a predicate.
Describe the difference between normal_behavior and exceptional_behavior in JML.
In JML, normal_behavior is used to specify the conditions that must be true if a method terminates normally, i.e., without throwing an exception. On the other hand, exceptional_behavior is used to specify the conditions that must be true if a method terminates by throwing an exception.
What is the purpose of the pure keyword in JML?
The pure keyword in JML is used to specify that a method does not have any side effects, i.e., it does not modify any state. Pure methods are often used in specifications.
The hiring guide has been successfully sent to your email address.
Oops! Something went wrong while submitting the form.

The ideal back-end app developer

What you’re looking to see on the JML engineer at this point.

At this point, a skilled JML engineer should demonstrate strong problem-solving abilities, proficiency in JML programming language, and knowledge of software development methodologies. Red flags include lack of hands-on experience, inability to articulate complex concepts, or unfamiliarity with standard coding practices.

Digging deeper

Code questions

These will help you see the candidate's real-world development capabilities with JML.

What does the following JML code do?
@ requires x >= 0;
@ ensures \result == x * x;
public static int square(int x) {
    return x * x;
}
This JML code defines a method 'square' that takes an integer 'x' as input and returns the square of 'x'. The 'requires' clause ensures that 'x' is non-negative, and the 'ensures' clause guarantees that the result is the square of 'x'.
What will be the output of the following JML code?
@ requires x > 0 && y > 0;
@ ensures \result == x + y;
public static int add(int x, int y) {
    return x + y;
}

add(5, 10);
The output of the code will be 15. The method 'add' adds the two input integers 'x' and 'y', and returns the result.
What does the following JML code do?
@ requires arr != null;
@ ensures \result == (\sum int i; 0 <= i && i < arr.length; arr[i]);
public static int sum(int[] arr) {
    int sum = 0;
    for (int i = 0; i < arr.length; i++) {
        sum += arr[i];
    }
    return sum;
}
This JML code defines a method 'sum' that takes an integer array 'arr' as input and returns the sum of all elements in the array. The 'requires' clause ensures that 'arr' is not null, and the 'ensures' clause guarantees that the result is the sum of all elements in the array.
What will be the output of the following JML code?
@ requires x > 0;
@ ensures \result == x * 2;
public static synchronized int doubleValue(int x) {
    return x * 2;
}

doubleValue(10);
The output of the code will be 20. The method 'doubleValue' multiplies the input integer 'x' by 2, and returns the result. The 'synchronized' keyword ensures that the method is thread-safe.

Wrap-up questions

Final candidate for JML Developer role questions

The final few questions should evaluate the candidate's teamwork, communication, and problem-solving skills. Additionally, assess their knowledge of microservices architecture, serverless computing, and how they handle JML application deployments. Inquire about their experience in handling system failures and their approach to debugging and troubleshooting.

How would you specify that a method does not modify any state in JML?
In JML, you can specify that a method does not modify any state by using the pure keyword. You can also use the assignable clause with no locations.
What are ghost variables in JML and how would you use them?
Ghost variables in JML are additional state variables that are not part of the implementation, but are used in specifications. You can use them to make specifications more understandable or to specify properties that are not directly expressible in terms of the program's variables.
How would you specify a class invariant in JML?
In JML, you can specify a class invariant using the invariant keyword. The class invariant is a condition that must be true before and after each public method of the class.

JML application related

Product Perfect's JML development capabilities

Beyond hiring for your JML engineering team, you may be in the market for additional help. Product Perfect provides seasoned expertise in JML projects, and can engage in multiple capacities.