1 / 36

Methods of Development

#1 Refactoring. Methods of Development. Wat is refactoring?. Refactoring. Refactoring. Refactoren : waarom ?. Xtreme Programming. Wensen van designers veranderen vaak. Wensen van designers veranderen vaak. Wensen van designers veranderen vaak.

ismet
Download Presentation

Methods of Development

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. #1 Refactoring Methods of Development

  2. Wat is refactoring?

  3. Refactoring

  4. Refactoring

  5. Refactoren: waarom?

  6. XtremeProgramming

  7. Wensen van designers veranderenvaak

  8. Wensen van designers veranderenvaak

  9. Wensen van designers veranderenvaak

  10. Wensen van designers veranderenvaak !!!

  11. Wensen van designers veranderenvaak

  12. Wensen van designers veranderenvaak

  13. Wensen van designers veranderenvaak

  14. Wensen van designers veranderenvaak

  15. Wensen van designers veranderenvaak

  16. refactor

  17. Schone code vs later refactoren

  18. X • Schone code vs later refactoren

  19. Refactoren: hoe moetdat?

  20. Minder code is betere code • Vermijdtdubbele code Welke code lijktveel op elkaar?

  21. D3DXHANDLE refractionTechnique, skyTechnique, glowTechnique; • g_refractionEffect->FindNextValidTechnique(0, &refractionTechnique); • g_refractionEffect->SetTechnique(refractionTechnique); • g_skyEffect->FindNextValidTechnique(0, &skyTechnique); • g_skyEffect->SetTechnique(skyTechnique); • g_glowEffect->FindNextValidTechnique(0, &glowTechnique); • g_glowEffect->SetTechnique(glowTechnique);

  22. D3DXHANDLE refractionTechnique, skyTechnique, glowTechnique; • g_refractionEffect->FindNextValidTechnique(0, &refractionTechnique); • g_refractionEffect->SetTechnique(refractionTechnique); • g_skyEffect->FindNextValidTechnique(0, &skyTechnique); • g_skyEffect->SetTechnique(skyTechnique); • g_glowEffect->FindNextValidTechnique(0, &glowTechnique); • g_glowEffect->SetTechnique(glowTechnique); void InitalizeEffect(D3DXEFFECT *effect, D3DXHANDLE &technique) { effect->FindNextValidTechnique(0, &technique); effect->SetTechnique(technique); }

  23. Waterniethoortmoetweg

  24. Code emigreren • Nieuwefunctie / member maken • Verhuizennaar (super)object • Verhuizennaar ‘free function’

  25. Nieuwefunctie/ member • voidUpdateKaleidoscope(int kaleidoSides, float time) • { • … • tc[0] = center + zoom * D3DXVECTOR2(cosf(angle - 2.0f * 3.141592654f / 3.0f), sinf(angle - 2.0f * 3.141592654f / 3.0f)); • tc[1] = center + zoom * D3DXVECTOR2(cosf(angle), sin(angle)); • tc[2] = center + zoom * D3DXVECTOR2(cosf(angle + 2.0f * 3.141592654f / 3.0f), sinf(angle + 2.0f * 3.141592654f / 3.0f)); • … • floattriangleVertices[] = • { • p0.x, p0.y, 0.0f, tc[0].x, tc[0].y, • p1.x, p1.y, 0.0f, tx1.x, tx1.y, • p2.x, p2.y, 0.0f, tx2.x, tx2.y • }; • g_d3dDevice->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 1, triangleVertices, 5 * sizeof(float)); • } • }

  26. Nieuwefunctie/ member • voidUpdateKaleidoscope(int kaleidoSides, float time) • { • tc[0] = center + zoom * D3DXVECTOR2(cosf(angle - 2.0f * 3.141592654f / 3.0f), sinf(angle - 2.0f * 3.141592654f / 3.0f)); • tc[1] = center + zoom * D3DXVECTOR2(cosf(angle), sin(angle)); • tc[2] = center + zoom * D3DXVECTOR2(cosf(angle + 2.0f * 3.141592654f / 3.0f), sinf(angle + 2.0f * 3.141592654f / 3.0f)); • } • void RenderKaleidoscope() • { • floattriangleVertices[] = • { • p0.x, p0.y, 0.0f, tc[0].x, tc[0].y, • p1.x, p1.y, 0.0f, tx1.x, tx1.y, • p2.x, p2.y, 0.0f, tx2.x, tx2.y • }; • g_d3dDevice->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 1, triangleVertices, 5 * sizeof(float)); • }

  27. Verhuizennaar (super)object OBJECTKaleidoscope METHODS Update Render ATTRIBUTES vector0, vector1, vector2 center zoom

  28. Verhuizennaar (super)object OBJECT Effect METHODSUpdate Render OBJECTKaleidoscope EXTENDS Effect ATTRIBUTES vector0, vector1, vector2 center zoom OBJECT Bloom EXTENDS Effect ATTRIBUTES …

  29. Verhuizennaar ‘free function’ • stringToLower(string s) • { • transform(s.begin(), s.end(), s.begin(), ::tolower); • return s; • }

  30. Maak code leesbaar • Repeat • Input->update(); • Physics()->update(); • World->Update(); • World->Render(); • Until…

  31. Dit kun je nu al toepassen!

  32. Eindopdracht • Inleveren in week 12

More Related