Skip to main content

Why waterfall approach is a bettter solution than agile approach from a manager's perspective

Stages of Software Development Lifecycle using a waterfall approach In the waterfall approach, each stage of the project delivered is a set of tasks that have to be completed by a planned deadline. A common set of stages for a software development project are [1]: System requirements Software requirements  Analysis Program design Coding Testing Operations  (until the system reaches its end of life - EOL) In theory, after the requirements are gathered, and the system was designed, implementation has to satisfy the requirements and the design without the possibility of changing the agreements made during in previous phases. Each phase is a silo of work, which is disconnected from other silos . This can result in a situation of conflicting requirements being detected during the testing or deployment phase without a chance to discuss these requirements with their authors. Maintenance is a special type of stage because there are cases when it is unknown, how long the system will be maintain

Java Text Blocks

When programming, sometimes you need to store a multi-line text in one String variable. So instead of having multiple variables of type String and then, joining all of them into one I recommend using Java feature called Text Blocks.

Compared to a simple String variable, a text block has to start with a triple quotation mark.

//regular String variables
String greeting = "Welcome to Dastin Sandura's blogspot!";
String description = "
I blog about the practical use of Java language."

For comparison, below is a String, initialized with a text block.

//text block stored in String variable
String multiLineGreeting = """
  Welcome to Dastin Sandura's blogspot!
   I blog about the practical use of Java language.""";

Both of the variables presented above are of type String, which means that by looking at a variable type you cannot tell if its value was set, by using the text block Java feature.

However, the most critical difference between the initialization of these two variables, is that the regular string uses a single quotation mark to mark the beginning and the end of the value, and the text block uses three quotation marks and a new line. Using text block without inserting a new line after three quotation marks will not pass the compilation.

Another difference is in the number of variables that we had to create. In the first case, we created a variable for each line.

Although, instead of creating a new variable for each line we could simply use the new line character (\n) and make the first code block look like this:

//regular String variable with new line special character
String greeting = "Welcome to Dastin Sandura's blogspot!\n"
 +"
I blog about the practical use of Java language."

We have removed the second variable and added a special character and a concatenation of two string variables.

This makes the code harder to read, due to characters that are visible in the code but will not be visible when printing the string to the view.


Sources:

"Programmer's Guide to Text Blocks" - https://docs.oracle.com/en/java/javase/17/text-blocks/index.html

Comments

Popular posts from this blog

Why waterfall approach is a bettter solution than agile approach from a manager's perspective

Stages of Software Development Lifecycle using a waterfall approach In the waterfall approach, each stage of the project delivered is a set of tasks that have to be completed by a planned deadline. A common set of stages for a software development project are [1]: System requirements Software requirements  Analysis Program design Coding Testing Operations  (until the system reaches its end of life - EOL) In theory, after the requirements are gathered, and the system was designed, implementation has to satisfy the requirements and the design without the possibility of changing the agreements made during in previous phases. Each phase is a silo of work, which is disconnected from other silos . This can result in a situation of conflicting requirements being detected during the testing or deployment phase without a chance to discuss these requirements with their authors. Maintenance is a special type of stage because there are cases when it is unknown, how long the system will be maintain

Type inference in Java 10

Which Java version understands the var keyword? In order to use the var  keyword, you must use a project based on Java 10. It is the first Java version that has introduced this keyword. How can the var  keyword be used? The formal name of this keyword is local variable type inference [1]. If we take a closer look at this name, we can recognize that it is composed of two parts: "local variable" and "type inference". Why could you use type inference? The juicy part of the local variable type inference is the  type inference  part, which practically means, that Java will assume the type of the variable, removing the need to explicitly write the type of the variable. It can reduce the number of keystrokes that are necessary to write our program by a significant amount and eliminate the possibility of making a typo. For example, instead of writing ArrayList<ObservableClassName>,  we can write only 3 letters: var . Where var cannot be used as of Java 10? It cannot