Jerry's profile妖居PhotosBlogListsMore Tools Help

妖居

工作不要太辛苦 生活不要太幸福
May 05

MVC和EF项目经验总结 随时更新 点滴记录

  • EF的Entity Class一通到底,从Repository到View。但是要阻止不通过Repository层调用数据库。目前只能是通过团队规则而无法再代码上避免。
  • 通过Repository的Load方法读取子表数据(Entity Reference和Collection的数据)。此举是为了使得单元测试可以在Service层进行。
December 02

[Unit Testing Series – I] Why we need unit testing

It’s time for me to introduce these several day’s investigation on unit testing. Unit testing is a huge topic about development, project management, tools, methodology, etc. I think it should be better into split them to some specific areas to discuss. So let’s start from the very beginning, which is the reason why I’m getting to be interested in unit testing part – Why we need it.

Before we decided to use something new it should be because of some problem we are having now. Some of them are real problems while other are potential or underlying. So let’s to see what we are or might be meeting with in our project lifecycle.

  • Low quality in my project both in the overhead architecture and some specific codes.
  • Many degrade bugs when maintain.
  • Difficult to control the quality when managing the Agile projects.
  • Difficult to find out the relevant parts when changing something.
  • Misunderstanding of the specification or requirement.

All these things always happen when developing a project regardless if it’s a windows client application or a website. Also regardless if it’s a huge enterprise system or a simple C/S application. Can you believe that automatic unit testing can help us to resolve these problems. Not all but it could be.

When we talk about the high quality software or high quality code, we probably say the code should high-cohesion and loose coupling. We explain a well quality code with flexible, extensible but now we can gather them into – TESTABLE.

If you want your code can be tested, you must separate it into properly sub-parts. You should keep one method only doing one job in order to confirm it easily when testing. You also must split the utilities using in your method and wrap them with an interface if needed to make them can be switched when testing. Hence, you will see that if you want to test some code, you must make it flexible and extensible. Hence, testable = high-cohesion + loose coupling + flexible + extensible. We will talk more about how to split some parts when unit testing which called “mock” in some future articles.

Another key task when you want to implement automatic unit testing is to establish a continuous integration server to make your code can be built once the code had been changed and run all your test code. Then you will find that it’s very easy to find the degrade bugs and to find out the related part of your changes as if it’s true they cannot pass their tests. This will be mentioned in some posts next.

I know this is a boring article. We are technical guys we like to read codes rather than texts. But I think it might be good to us to know why we need it before we learn it. In the next post I would like to introduce one of my favorite unit testing frameworks which can help us easy to do testing jobs - xUnit.

Hope this can help you.

August 19

What would you do if the deadline was looming

This is a survey in the last week on codeproject which one of the most famous software development community in world wide. It's a common matter for all companies like us. Also I think all of you, especially PM and people who have experience on project management had been facing this situation. Let's look at the result and considered what we will deal with this horror.

The 1st one is "Crank up the overtime. All-nighters and weekends for everyone.", 60.12% with 772 votes. I think it's the most common and easy selection when we are under pressure to deliver. All estimation looks like not enough and the change requires always come when we're going to delivery and the overtime is common in this industry now. But I would like to say this is the worst selection. To be a PM I really don't want and I think I will never let my members work overtime even if the deadline was looming. The members will complain you and the company when long period and frequently overtime. And the performance of them also will be turned to very low, even much worse than having a rest and continue in the next day. But why so many people selected this one? I think the most reason are

  1. We are easier and convenient to let our developers to work overtime than beg our client to do some changes of the deadline or deliverable.
  2. Most companies will not pay for the overtime. It's free.
  3. Developers' complaint? It's none of my business. Low performance? I can let them overtime more longer.

The 2nd one is "Leave out some documentation" with 47.82%, 614 votes. Well I don't want to talk about whether the documents are useful or not but I thought if these documentation can be left out it must be spare. We need documentation of course but we only need the ones necessary. I don't agree with this selection even though it's much better than the above.

The 3rd one, "Ignore the deadline" which is 38.47%, 494 votes. I almost could not believe myself when I saw this result. I really wanted to ask the people who selected it, "What do you do then?" Ignore the deadline means ignore the customer and the business. If you though you were your customer who are waiting for you product then you will notice that how they feel when you ignore the deadline. Think about that if you are waiting for a pizza at home for more than 3 hours and the restaurant tell you they ignored your order when you call them. What's your feeling. All people how selected this option should be fired whatever pretty excuse they have.

I also would like to say the 4th one, "Skip test cases" is terrible, too. Quality always should be on the top priority. I think the customer can agree with extend the deadline or delay some parts of requirements but cannot put up with a product full of bugs and exceptions.

In fact then I read this result and the options I almost cannot select any of them. They are all not quite good solution. I think the best choice is notice before it happen with plenty monitoring, data collection and analysis, and good communication with the client.

So if you were facing this case, what will you do?

what.do.you.do.get.it.over.the.line

August 13

Faking it at Olympics

I heard this issue from Yahoo this morning which the little girl named Lin Miaoke (林妙可) was not the real singer of the song "Ode to the Motherland" at the Olympic opening ceremony eve. The real singer was Yang Peiyi (杨沛宜).

To be honesty I was not surprised because when I saw the live of the ceremony I found her mouth was not fit for the voice very well. But I also thought that's Okay for using lip-synching in an important issue such as the Olympic opening. I know not only the director Zhang Yimou (张艺谋) but all Chinese wanted to present a wonderful opening to the world. We wanted everything is the best: best looking, best voice, best fireworks and lights. So if they selected a pretty looking girl and pretty voice background singer that is fair enough.

What I thought at the same time was for the real singer Yang Peiyi is it fair to her? She didn't get any applause and cheer which she should have. How will this affect her in the future I don't know but I think the organizer should announce that she, Yang Peiyi (杨沛宜) was the real singer at that night.

lin_miaoke 
Lin Miaoke (林妙可)

yang_peiyi
Yang Peiyi (杨沛宜)

God bless these 2 pretty girls.

August 04

Home Working

In my memory when I attended the 1st English class I presented a speech for the class members which the name was "3 Improvements of Ethos". Rick, our English teacher gave us a funny starting and we were going though with him. But in my funny speech it's not whole making a fun, at least except the 3rd part -- Home Working.

Now our company is flexible working time now means there is no coming deadline and leaving deadline. I think we could make it more improved -- Home Working. Okay, what pretend us from home working?

  1. Communication: Well this is a big problem for the traditional company when they want to apply home working but if it's really a big stone in front of us? No. We are utilizing variant ways such as MSN, Skype, Mail to communicate with our colleagues, leader and client. It doesn't matter if we working at home because many of us can access the Internet and using these tools as well as in the office.
  2. Developing: Yes this was a problem if we working at home because we could not reach our source code server and our development documentation when a long time ago. But now things had been fixed. We are using Jira and Confluence and world wide SVN which we can login anywhere we have the Internet. We can do our jobs with our colleagues wherever they are together to read, write and discuss the specification, update the source code without mess them up, report bugs without looking his angry face.
  3. Meeting: Every time people says Home Working there must be someone asked "What about the meeting?" At that moment I always say "Home working does not equal MUST working at home. " We can build a policy in a team, a group or the entire company which specify a certain date as the meeting day means all members must be at the office. Also the leader can announce a certain day as the meeting day to resolve such as client's meeting, boss meeting, etc.
  4. Working Record: I think we got the final point of this topic. How to identify if the worker really worked at home? Firstly I would like to say there are 2 modes of policy in managing a company: type X and type Y. In type X mode, all workers are being regarded as the laziest guys. The policy in this mode are focused on how to pretend them from not being loaf. In type Y all people are regarded as guys working with passion. They are believed to do their jobs as best as they could if they have good environment and fairly treatment. The result is if a company in type X, all its employees will be turned to lazy while if a company in type Y although some of the employees might still lazy but most of them became passion guys. I hope, and I think our company are being in type Y and all my colleagues are full of passion. And, don't forgot, we've Jira and Time Tracking ;)

So till now all questions are being resolved I think and what can stop us from apply the home working? Maybe it's the traditional ideas in our mind. I know there is few company can let their employees home working but why shouldn't us be a pioneer? Philana said "Punish is not a good solution for making us fill a good TT." but shall we do like this, no punish, but reward.

  1. People who had a good quality TT in the last month will have the rights to apply the home working in this month. (If your TT was bad sorry you cannot home working.)
  2. You must asked to your PM or Group Head if you want to home working before. They mandatory information are begin and end date, your online time of each days and your emergent contact information such as mobile or home phone number.
  3. You cannot home working unless they approved.
  4. You cannot apply the home working for more than continuous 3 days.
  5. You must keep your mail and (MSN or Skype) opening when online time and make sure people can contact with you by your emergent contact information.

Okay I think for now it's still not well enough to begin our home working policy at once but I believe this should be a good start. Let's fix it and make it available.

 

Jerry Xu

Occupation
Location
工作不要太辛苦 生活不要太幸福
No list items have been added yet.

Feed

The owner hasn't specified a feed for this module yet.
Photo 1 of 5
More albums (1)