Sunday, January 5, 2025

Code Quality 2024 Part 4: Collaboration and Software Development


 

Why collaboration influences software quality? This is a very simple answer. If you have a bazaar of ideas or solutions you can select the best idea. Or to describe it a little bit more mathematically, if you know at least two solutions from N and selecting the best of the two, you have guarantee that you solution is not the worst. Software development is not a game of perfect, it’s more important not to pick the worst solution. And if you put some statistics in it, you have two random solutions, then you can imagine the benefit of collaboration.


Collaboration in the Real World

Collaboration in the Real World doesn’t exists, mostly. But try it, try pair programming, learn how to do pair programming. It takes a really log time to establish pair programming. Don’t give up.

Saturday, January 4, 2025

Code Quality Part 3: Use Test Driven Developmen (TDD)

First, TDD is not about having unit tests. TDD is a about software design and about specifying software requirements. Using TDD will improve your coding and the product.

TDD and Legacy Code

TDD and legacy Code is a combination from hell. Use TDD for new code parts. TDD will punctual improve the software quality. Don’t try to TTD-ing the complete legacy code, this is an idea from hell, you will get mad. Containment is the better option for legacy code. Build some tests around your legacy code, that covers and describes the most important code flows.



OK some words why I’m a big TDD fan.

- TDD saves time by reducing the time finding bugs in your implementation and believe me your code and my code containing bugs at least in the early iterations. A debugger is common tool for most developers, I don’t need it. I take the debugger only if I handle legacy code. TDD is an inverse debugger.

- It makes refactoring save and enables iterative software development

- It’s a driver for decomposition and the separation of concerns

- You don’t have to write extra tests, only few integration tests


I never seen TDD in real life. That means most developers are not using TDD.


There is on major disadvantage of TDD, it is not common. Every developer heard about TDD but that’s all.

What are barriers of using TDD, as far as I know

- Never tried it

- Stereotypes like: time expensive

- Routine

- No need


How to break down the barriers

- Try it.

- Pair programming


TDD and Test Coverage

Drop Test Coverage Metrics, they are useless. Test Coverage Metrics are to avoid, they costs productivity.

A major misunderstanding is the believe that a high test coverage is a software quality criteria. That is false. But what is true a TDD project have a high quality and have a high test coverage. Don’t mix-up causality and correlation.


Last Words

TDD is a blend of test first, decomposition pattern and iterative software development. Try it.

Saturday, December 28, 2024

2024 Software Development Review: What works, what not, what needs to improve, what to try next

 

The current sate of software development in 2024 from the practical side. What works, what needs to improve, what is to avoid and what to try next.

  1. What is working well
    1. TDD
    2. Tidy First
    3. Chore at Last
    4. Agile Software Development
    5. Distributed teams in the same time timezone
    6. Remote working
    7. Freelancers
    8. Deploy often
    9. OKR
    10. Linux on development clients - new entry
  2. What is working but still need to improve
    1. Pair programming - down from What is working well 2023
    2. SCRUM
    3. Align business flows to teams 
    4. Conferences
    5. Code Metrics
  3. What is not working and should be avoid at any costs
    1. Waterfall plus JIRA, some Companies call it Agile Development but it isn't
    2. Hybrid Agile approaches, whatever that means
    3. External Service providers trying to dominate the customer
    4. Team Metrics like Sprint Velocity
    5. Big bang releases only
    6. Complete Teams from Service Providers or agencies
    7. Distributed Teams over time zones with big time differences
  4. What to try next
    1. SCRUM beyond
    2. Mob Programming
    3. Pure JIRA

Pair Programming is going down in 2024. Well, pair programming itself is still major productivity improvement. Why I move it down is that there are huge obstacles starting with par programming. It's very important to find an easy way to lower the entry obstacles.

Monday, December 23, 2024

2024 ONCD Report - Toward to Secure Software - My Review Part 1

 In case you missed it, the Whitehouse released the ONCD Technical Report - A Path Toward Secure and Measurable Software (Link).

It's a only 19 pages long report containing mostly nothing new or interesting. You can read it but is mostly dull. More interesting are some of the source links.

The only important thing is the preference of memory save programming languages. Well, this could be the end of the Rust vs C debate, but it isn't, see this video with Linus Torvalds (Link).

What you can take out of this debate, if let all the pseudo relgiouse aspects of programming languages beside, there two takeaways:

  1. A fool with a tool (programming language) is still a fool
  2. There are some programming languages (Rust, Go, Java, ...) that have advantages if you are not Linus Torvalds or me if you are a normal software developer
  3. The discussion about which new programming language will be so much better, will never end. 

What I personally found remarkable in the Video was the argument of simplicity of C.

Next chapter, the verification thingy, I have major doubt of this idea, It sounds for me like some academics are on the search for gold. The other thing, the usage of trustfully libs, dam this common sense. But for Go and Python this is areal problem at the moment.

The next chapter about software measurability, hey that's exactly my business. At the end, it's a hard problem to measure software security, no way Sherlock.


To be continued ... or not.

The rest of the report is generic or common bla bla. It's not worth reading.

Saturday, December 14, 2024

Unit Test Anti-Pattern 2

Branches and loops in unit test are tech debt.

General rule: unit test should have a cyclomatic complexity of one.

If of If-Else or Switch branches are a clear indicator that your test is bad one. It's clear that you are not testing one case, maybe your test setup is broken.

If you have catches (exception handling) this also mostly a indicator that you don't understand the code behavior. Don't mix this up with negative tests.

Loops are a little bit different, loops could be a indicator that your test setup is not optimal.

If you have higher cyclomatic complexity test you should try to refactor them. Have a look at parameterized tests, maybe it's the way to refactor your test.


Wednesday, December 4, 2024

Unit Test Anti-Pattern 1

 Unit test to only increase the coverage metric is an anti-pattern.

Example:

  1. testing data object
  2. testing getter and setter, ... if there is no logic in

Why it is an anti-pattern? Here my view.

  1. These coverage only unit test hide missing tests because they increasing the coverage metric but not increasing the code quality. No logic part is tested and it makes the coverage metric useless.
  2. If you have normal unit test then these tests covering all these simple things (getter, setter), if not then you ether missing real unit test or the code is not needed.