TDD Training by JBrains

This is the second formal TDD training I have joined (The first one was conducted by Joey Chen(https://www.facebook.com/pg/91agile/about/?ref=page_internal). I could not find online line 😦  sad..). I would like to share some “Aha” moments along the way of this training.

Before that, allow me to share how i took the training(The first 2 series, which is free 🙂 ):

  1. For 1st series, I implement without TDD first. The reason why I do that is I am just very curious of what is the time difference and other difference if i am lucky to find out.
  2. For 2nd series, I just follow the video and stop where ever I need to think or research or take notes.

 

Ok. That’s enough. Let’s go to the my “Aha Wow” moments:

  1. Really step by step by step : Fail -> Add Logic -> Pass -> Commit -> Refactor
  2. It’s developers responsibility to cover more tests than the general requirements from clients. (I mention this because I have an assumption from my first TDD training that developers only need to add tests based on the requirements. )
  3. Avoid more complex integration test by adding unit test when small class or methods come out along the way of implementation.
  4. Triangulation concept somehow makes me feel better compare to one of TDD rules: You are not allowed to write any more production code than is sufficient to pass the one failing unit test. Because when ever I try to hardcode to make the test I feel so bad and keep wondering why not find the basic logic 1st.
  5. Multilevel of abstraction code smell apply not only to same functionality, but also all same level functionality with different purpose.
    e.g.
    Assume inside one function, there is one logic related to getPrice, three logic related to display price. We should abstract both the getPrice logic and the displayPrice logic to achieve same level of abstraction for easy reading and maintaining.
  6. Duplicated Concepts/Ideas: Do not repeat your self is not only about code, but also the way of covering the logic.
    e.g. if  A else if B else if C …. is one example of duplicated ideas
  7. Intuitive and Mechanical approach of software designer (http://blog.jbrains.ca/permalink/becoming-an-accomplished-software-designer)
  8. Refactoring based on single responsibility. Re-assign responsibility makes the code much more flexible and clear. For this I am not able to express it clearly by tying here. I strongly suggest you take the 2nd series of the training. Then you may feel it more.

 

“Post-Credit Scene”:
For my little test “For 1st series, I implement without TDD first.”, I did it within 15mins including the tests, while the training took more than one hour. But the test cases are much more less. Reason: I understand the logic of fraction adding. So my test only focus on the logic and with few special cases. I feel some tests inside the 1st series training are duplicated. So until now, I believe that TDD can help design the code but not necessarily helpful in every development scenario.

The Problems you may face in scrum and solutions


This blog will discuss the problems we encounter when adopting scrum and the solutions we choose to solve those problems.

Scrum itself is a nice approach to agile development. It helps on short development life cycle, frequent review, continuous valuable delivery, team diversity, team self management , etc.
To achieve all of these, scrum use the “sprint” as one short software development life cycle.

When adopting scrum, we encounter these problems:

Continue reading

.Net MVC ajax call return different views based on different conditions

As we know that, ajax is more efficient because it will only change the part that customer changed instead of the whole view. However, efficiency usually takes some effect. But don’t worry,this blog is to introduce a method to achieve this goal:

Using ajax to submit async request to controller/action, then controller/action will return different views data based on different conditions. At last, front end will replace different elements based on returned views data.

Here is one good way after some research and experiment :

Continue reading

.NET MVC Request Life Cycle

Why you want to know MVC Life Cyle

When I first time get involved in .NET MVC projects, I feel a bit lost because there are so many things behind the scenes. After some time, by hands on practice, I feel MVC is quite handy compared to WEBForms, but still not quite clear about the overall request life cycle. After some researches, I finally understand the whole request life cycle. So I blog it out to share with you so that you only need to research on what you don’t know. Hopefully this blog can save your time on researching a lot to find out what you don’t know. Continue reading