November 25, 2006

Dilemma of Software Design

Filed under: Software Design — khangharoth @ 2:23 am

What is Good Software Design and what are the measuring guidelines
for this ?

In fact how can one be sure that the system is well designed and always ready for that dreaded word CHANGE , and what is the limit of being paranoid and Overkill.

After all like any other task it also consumes resources like Time and Human labor (for sophistication we can use term Man Hours , but personally i hate this term as if Software programming is Seventh standard Work -Time problem)
anyway we come back to our current discussion Design.

So what separates Good from Bad and how to measure the impact on overall system when we choose one over the Other. There are Masters out their who have tried to tame this beast .
So in their language Good Design has

  1. Good design is innovative.
  2. Good design enhances the usefulness of a product.
  3. Good design is aesthetic.
  4. Good design displays the logical structure of a product; its form follows its function.
  5. Good design is unobtrusive.
  6. Good design is honest.
  7. Good design is enduring.
  8. Good design is consistent right to the details.
  9. Good design is ecologically conscious.
  10. Good design is minimal design.


Everything is fine although not fine but for time being lets concentrate on number 10
” Good design is minimal design” ,well with this one statement we are back to
square one! I hope you can appreciate the whole irony and it’s not funny either.

I would like to share my views about Design and as i am not Master so keep your mind
open, I can err!

1. Designing is not a Task that had to be done in beginning or end of Software Lifecycle
but it is Rhythm of development and so it needs attention everyday.

2. Whenever their is choice between mind-Blowing and Simple Algo ,
For God sake choose Simple one.

3. Software is like a beast and it will try its level best to not to be tamed.
So always keep hunter and keep refactoring of your code.

4. Size does matter! It sucks; keep your classes’ and methods small.

5. Classes should have only one reason to change and that reason
should be chalked out as early as possible.

6. Allocate extra time in Project Plan for Nomenclature of your classes ,
methods ,variables etc.It may sound funny but if not followed
we end up laughing on ourselves.

7) Algo optimization is million time better than code optimization.

8) Whenever in doubt scream Fire-Fire so that others can come for rescue.

9) While Designing Look Top-Down rather than Bottom-Up ,many of you may
not agree on this but this is what i feel .You got to know “What problem we are solving “,
then “What are the components in action” and ” How these components interact among
themselves” and than “Design Individual components”.

10) Have faith in God and keep praying, it seriously helps!

I have absolutely no idea how much it will help you as i am still as confused as I was in beginning of all this.


Making an User Cordinate System : UCS

Filed under: 3D Maths — khangharoth @ 1:07 am

More often than not , in any CAD application user is given a choice to create its own coordinate System and he works relative to his own created UCS but System translate all UCS Points into WCS for internal calculation like drawing an entity.

Lets take an example to get this thing clear .

User is working on a big file say where : All dimension can be anything say in meters
X extends between -400 to 400
Y extends between -400 to 400
Z extends between 0 to 400

Now he wants to draw a Circle of Radius 50 whose center is at (100,100,100 )
and circle is drawn in XY plane .

And inside the circle he wants to place some more Objects so for sake of convince
he would like to have a UCS at circle center so that he can specify points with respect
to circle center .But System will draw these points in WCS in which whole drawing is specified .

To define a New Coordinate System we need UCS Origin Point and two Orthogonal Axis say
X Axis and Y Axis and Z will get defined by taking crossproduct X cross Y

UCS X and Y axis can be any direction depending on User requirement as in which plane he wants to work on . In our simplistic case User X and Y axis coincide with System X and Y axis.

So parameters that user need to create a UCS at Center are
1) UCS Origin : (100,100,0)
2) X Axis Vector : (1,0,0)
3) Y Axis Vector : (0,1,0)

And thats it now we have sufficient Input to create an UCS

So Here is Small UCS Class which have utility methods like converting WCS Point to UCS and vice versa

import javax.vecmath.Matrix4f;
import javax.vecmath.Point3f;
import javax.vecmath.Vector3f;

* @author ksingh2
public class UcsCoordinates {
private boolean isUcsSet;
private Point3f ucsCentre=new Point3f();
private Point3f ucsPoint=new Point3f();
private Vector3f ucsXAxis=new Vector3f();
private Vector3f ucsYAxis=new Vector3f();
private Vector3f ucsZAxis=new Vector3f();
private Matrix4f wcsToUcs=new Matrix4f();
private Matrix4f ucsToWcs=new Matrix4f();

* Give Point in UCS corresoponding to
* WCS Point
* @param node
* @param canvas

public Point3f getUcsCordinates(Point3f wcsPoint ) {
return ucsPoint;


*Give Point in WCS corresoponding to
* UCS Point
* @param node
* @param canvas

public Point3f getWcsCordinates(Point3f ucsPoint ) {
return ucsPoint;


* @param originPoint
* @param yAxis
* @param xAxis
public UcsCoordinates(Point3f originPoint,Vector3f yAxis ,Vector3f xAxis) {

public boolean isUcsSet() {
return isUcsSet;
public void setUcsSet(boolean isUcsSet) {
this.isUcsSet = isUcsSet;
private void reset(){
public Matrix4f getUcsToWcs() {
return ucsToWcs;

public Matrix4f getWcsToUcs() {
return wcsToUcs;

Its a basic UCS class and we can incorporate more functionality like rotation and Translation
of UCS.


Create a free website or blog at