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

Real life scenario for using a database transaction - by Dastin Sandura

Did you ever learn about transactions and ask yourself, will I ever use it?

Real life scenario

When programming business logic, which involves multiple steps, you may have a need to make sure that all of the steps are persisted in the database. It is a very easy task in Java, because you simply write explicitly which step should be executed and imperatively decide what is the order.
However, this is the "happy-path". What about the case, when e.g. the 9th out of 10 steps raises and exception? What about database changes made by previous 8 steps?

Possible approach

One of the solutions is to prepare a set of database queries which will reverse the changes made by each step. In simple cases, with few simple independent DML queries it is easy enough as you prepare one reverse query for each query executed. This is possible in the case, when each query makes individual, independent of previous queries, change. But, what if each query inserts different data, depending on the result of the previously executed queries? Then, possible flows of the code execution grow so fast, that it becomes a headache to keep track of what should be reversed and in which order should it be reversed, to keep the data in the database consistent at every step.

Database transactions

Fortunatelly, databases have a functionality of grouping multiple queries into a set, called transaction. You can explicitly determine, which query begins the transaction and which query is the last in the transaction. What is more, if any of the queries contained in the transaction fail, you have a possibility of reverting all of the changes made since the beggining of the transaction, with a rollback command. Use of transactions is very scalable, when you look at it from the maintenance perspective, because no matter how many queries are inside the transaction, all of the changes can be rolled back, with one command.
   

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

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 betw