Refactoring - nonkitMac/Pictionary GitHub Wiki

This page illustrates what kind of refactoring will be done for this project.

Update Version

Update version information.

Use Init() Subroutine

Use Init() subroutine such as following code.

Sub Init
  gw = 598
  gh = 428
  GraphicsWindow.Width = gw
  GraphicsWindow.Height = gh
  GraphicsWindow.BackgroundColor = "LightGray"
EndSub

Use Array.GetItemCount()

Use Array.GetItemCount(shape) instead of hard coded number.

Replace Shape_ to Group_ Subroutines

Replace Shape_Add() to Stripe_Add().

Use Caption Maker

maker/CaptionMaker.sb will create such as following code.

Sub Shapes_Init_Caption
  ' Shapes | Initialize shapes data
  ' return shX, shY - current position of shapes
  ' return shape - array of shapes
  shX = 426 ' x offset
  shY = 358 ' y offset
  shape = ""
  shape[1] = "func=text;x=0;y=0;text=Ellipse;fn=Trebuchet MS;fs=50;fb=True;pw=0;bc=Black;"
EndSub

Use this code to show the caption.

Add New Line Between Subroutines

Add a new line between subroutines.

Remove Not Used Subroutine

maker/FindSubNotUsed.sb will find subroutines not used. Following list is a sample output.

C:\Users\nonki\Documents\GitHub\Pictionary\Ellipse.sb Math_CartesianToPolar Shapes_CalcRotatePos Shapes_Move Shapes_Remove Shapes_Rotate

This means that subroutines Math_CartesianToPolar, Shapes_CalcRotatePos, Shapes_Move, Shapes_Remove and Shapes_Rotate should be removed from Ellipse.sb