|
|
??????????????????????????????????????????????????????????????????? ?
??1.????????
??????????????????????????????????????????????????????????????????????bug??????????????????????????????????????????????????????????????????????????????lambda????????????
- /// <summary>
- /// Some function with partially duplicated code
- /// </summary>
- void OriginalA()
- {
- DoThingsA();
-
- // unique code
-
- DoThingsB();
- }
-
- /// <summary>
- /// Another function with partially duplicated code
- /// </summary>
- void OriginalB()
- {
- DoThingsA();
-
- // unique code
-
- DoThingsB();
- }
复制代码
?????????????????????????????????
- /// <summary>
- /// Encapsulate shared functionality
- /// </summary>
- /// <param name="action">User defined action</param>
- void UniqueWrapper(Action action)
- {
- DoThingsA();
-
- action();
-
- DoThingsB();
- }
-
- /// <summary>
- /// New implmentation of A
- /// </summary>
- void NewA()
- {
- UniqueWrapper(() =>
- {
- // unique code
- });
- }
-
- /// <summary>
- /// New implementation of B
- /// </summary>
- void NewB()
- {
- UniqueWrapper(() =>
- {
- // unique code
- });
- }
复制代码
??2.??????
??????????Facebook?Twitter???????????????????????????????????????????????5??????????????????????????????
??3.???????
?????????????????bug?????????????????????????????????????????????????????????????????????????
??4.???????
????????????????????????????????????????????????????????????????????????????????????????????????????????????null????????????????????????????????????
??5.????
?????????????????????????????????????????????????????????????????????????????????????????????????????
??6.????
?????????????????????????????????????????????????????
- if (numMines > 0)
- {
- enabled=true;
- }
- else
- {
- enabled=false;
- }
复制代码
????????????
???????????????????????????????????????????????????????????????????
??7.?????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
- static public double GetConvexPolygonArea(Vector2[] vertices)
- {
- double area = 0;
- for (int i = 0; i < vertices.Length; i++)
- {
- Vector2 P0 = vertices[i];
- Vector2 P1 = vertices[(i + 1) % vertices.Length];
-
- area += P0.Wedge(P1);
- }
-
- return area / 2;
- }
复制代码
??8.?????????
????????????????????????????????????????????????????????????????????????????????????????????????????????
- void DamagePlayer(Player player, int damageAmount)
- {
- if (!player.m_IsInvincible && !player.m_IsDead)
- {
- player.InflictDamage( damageAmount );
- }
- }
复制代码
??????????????????????????????????????????????
??9.???????????
????????????????????????????????????????????????????????????????????????????????????bug??????????????????????????????
??10.???
??????????????????????????????????????????????????????????????????????????????????????????????
??11.??????
???????????????????????????????????????????????????????????????????????????????bug?
????????????????????10??????11??????????
??????????????????????????
??????????
???????????????????????
?????
|
|