Monday 10 December 2007

Number of features grows logarithmically

The main problem in big software projects is complexity growing as the project unfolds. Generally when the main architecture is ready and the product has been started the number of architectural features grows with the size of the code. The speed of growing, though, is not constant. At the beginning it is almost linear and equal to time multiplied by team. But the longer it lasts, the bigger size of the code, the more complex is the product to develop further. From my personal experience the time spent to develop a new feature of average size increases by an exponential law. [Features are meant to be architectural but perceived in complexity from the customer point of view.] This idea gives a rule to predict milestones and practical limit of the product. For example, if the first 10 features took 4 days to develop and the second 10 new features took another 5 days to develop, then to implement 50 features will take 7 weeks and to implement 100 features 27 weeks. [Formula used is y=F*ln(kt+1). In the example above we find that k=1/16 and F=10/ln1.25]

Friday 7 September 2007

On coding practices

Coding rules are written for particular community of people who intend to review, maintain, or use the code. It is called coding standard. But there are 2 other important sources which influence the style. These are taste and simplicity. I disagree on that the coding standard, whatever it is, has to be followed blindly.

So 3 points influencing the style are:
1. Personal taste: You personal choice
2. Simplicity/clarity: Do not sacrifice clarity to your or other people's taste
3. Community: What most (other) people expect to see when looking at the code.

My personal preferences are:
1. Find which community is likely to work later with the code.
2. Follow coding rules if they do not disagree with your taste and code clarity.
3. If a rule is not good from your point of view, decide which one: your taste or community is more important in that context.
4. If a rule makes code less simple or clear, ignore the rule. [This is very subjective so be prepare to stand for your opinion]

19.04.2007

Wednesday 29 August 2007

Console/Window executables

Simple trick to suppress console window to pop up is to change the flag 03 to 02 as it is done in the following example (in case you forgot 03 is ctrl-C and 02 is ctrl-B):

0000: 4D 5A 90 00 03 00 00 00 04 00 00 00 FF FF 00 00 MZ_ ♥ ♦ яя
0010: B8 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 ё @
0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0030: 00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 00 _
0040: 0E 1F BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68 ♫▼є♫ _○Н!ё☺LН!Th
0050: 69 73 20 70 72 6F 67 72 61 6D 20 63 61 6E 6E 6F is program canno
0060: 74 20 62 65 20 72 75 6E 20 69 6E 20 44 4F 53 20 t be run in DOS
0070: 6D 6F 64 65 2E 0D 0D 0A 24 00 00 00 00 00 00 00 mode.♪♪◙$
0080: 50 45 00 00 4C 01 12 00 7B DA D4 46 00 68 5E 00 PE L☺↕ {ЪФF h^
0090: 34 1F 00 00 E0 00 06 01 0B 01 02 38 00 50 0A 00 4▼ а ♠☺♂☺☻8 P◙
00A0: 00 1C 10 00 00 F8 20 00 A0 12 00 00 00 10 00 00 ∟► ш ↕ ►
00B0: 00 60 0A 00 00 00 40 00 00 10 00 00 00 02 00 00 `◙ @ ► ☻
00C0: 04 00 00 00 01 00 00 00 04 00 00 00 00 00 00 00 ♦ ☺ ♦
00D0: 00 F0 7F 00 00 06 00 00 4A 86 63 00 03 00 00 00 р⌂ ♠ J┼c ♥
00E0: 00 00 20 00 00 10 00 00 00 00 10 00 00 10 00 00 ► ► ►
00F0: 00 00 00 00 10 00 00 00 00 90 30 00 22 46 00 00 ► _0 "F
0100: 00 E0 30 00 98 20 00 00 00 00 00 00 00 00 00 00 а0 _
0110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0120: 00 10 31 00 88 4B 00 00 00 00 00 00 00 00 00 00 ►1 _K
0130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

This flag is at the end of the line 00D0. This flag is not in absolute offset so you may try to guess.

Wednesday 15 August 2007

Software complexity limit

Software development is a sequential process. The product is always being developed bit by bit. The main problem arises when new bits added to the future product break the previous functionality. This is called complexity limit. Once the product developed reaches its complexity limit no reasonable development becomes possible. The complexity limit is obviously subject to both the design and the process. The difference between them is that if the design adds absolute value in fighting with complexity the process adds relative. That means that the process can leverage the extent of the final product, but cannot define it. As example, suppose that the product is 100 percent functionality and with some given design the complexity limit appears at about 50 percent. Next suppose that the process may leverage the extent by 20 percent of the reached extent. So the final product will have 50+50*0.2 = 60 percent of desired functionality. Now if the design is poor and allows going only up to say 20 percent, then the gain obtained from the process is 20*0.2 = 4 percent (totalling 24). If the design is good allowing 80 percent with no process, then the process will add 16 percent (totalling 96).


Under design I mean here all development solutions on the whole scale from architectural to coding. Under process I mean here the standards accepted by the development team.

Thursday 26 July 2007

Notes on programming

Programming is a fight against the complexity


When a program is being developed its complexity may increase or remain the same. We can define the program complexity as the complexity of its most complex component (the component decomposition can be seen as a separate component itself). It would be an interesting question what kind of program modifications increase the complexity and what do not.


Complexity multiplies but capacity does not sum up


A number of people cannot create a program which is more complex than at least one of these people can understand. From the other hand, linearly adding a new component of lesser complexity that already exists does not increase the overall complexity. Keyword here is “linearly”, which means that complexity of the decomposition (referring to the level on which the component added) does not increase as well, or increase so as not to outweigh the overall complexity. But making the new component interdependent with existing components opens new dimensions in internal states of the program (non-linearity) that is multiplying the complexity.


Architecture


Each character of the code has its own path to the top level concept of the program. Top level concept of the program lies on the abstract layers braking up the program architecture into independent components, which are lying on lower level layers and so on until we reach each separate character of the code.
Understanding this path from the bottom level to the top level is architectural awareness. It is important that the programmer has one. Otherwise the complexity of the product can grow incredibly fast.


Push, pop, and pull requirements


The requirements evolve from the customer to the final coder. It is not possible to imagine that the programmer can develop a program targeting each customer requirement individually.

The requirements can be generally grouped into 3 categories.

  1. Customer requirements (Pull). Something which defines the product.
  2. Architect requirements (Pop). The model which can be implemented in software and is proven to mimic the customer definition of the product. These requirements are conditions to components and their interaction.
  3. Code requirements (Push). Testable functionality of the program.


Push requirements are satisfied when the program undergoes a number of scenarios defined the requirements. This can be done by auto scripts validating expected output.
Pop requirements are satisfied when the program conforms to the defined component interfaces. This can be done by documented and frozen APIs.
Pull requirements are satisfied automatically given that the model is adequate to the required product. These can be customer acceptance tests, but they would not be a part of the product development.

Failure to break the requirements into these 3 categories and treat the customer requirements as the requirements to the software leads to ad hoc style programming. Programs written in this way are difficult to modify and they are sources of plentiful hard tracking bugs. This can work only for small programs.

Thursday 10 May 2007

Visual Studio 2005 Express, OpenGL and Glut

Visual Studio 2005 Express does not have SDK. Instead of installing huge SDK what I did to make Visual Studio 2005 Express to run with openGl and Glut is the following.

1. Downloaded and unpacked
glutdlls37beta.zip
and
opengl95.exe
(ftp://ftp.microsoft.com/softlib/mslfiles/opengl95.exe)

2. copied glut32.dll into windows directory

3. created dir GL in include
in my case it was
C:\Program Files\Microsoft Visual Studio 8\VC\include\GL

4. copied *.h files in there

5. copied *.lib files in lib directory
in my case it was in
C:\Program Files\Microsoft Visual Studio 8\VC\lib

Also have a look at:
http://www.opengl.org/resources/faq/technical/gettingstarted.htm
(2.060 What do I need to compile and run OpenGL programs?)