Thursday, 18 February 2010

Faces of consciousness and free will

1. Self-awareness is contemplating self inside the model of the world. It is like you watching a chess board with all the pieces moving by themselves except one piece which moves at your will. This builds strong association between the perceived object and self. This piece you call 'I'. 2. Conscious behaviour is a prediction of the future of the world model with implications of the potential action of 'I'. You may drive a car unconsciously. But when a policeman stops you, you immediately become aware of all possible future scenarios of the current situation. Hence what you are about to do is a conscious decision. 3. Conscience is the ethical judgement of personal actions and thoughts. It is not only a perception of the facts, but also colouring them and placing on the scale of desirable and undesirable. Conscience is not really consciousness since it serves for establishing moral dogmata in relation to the behaviour. 4. Free will phenomenon appears on two levels. On micro-scale, actual movements and other muscle control is the result of a mental decision made by brain. A free will sense on this level comes from self-awareness. On macro-scale, deeds or life decisions are the result of conditional beliefs and circumstances. The beliefs or truths are a remembered result of combining the information coming from outside and internal emotional state and feelings. The truths are formed inside during the life and they condition our behaviour.

Wednesday, 27 January 2010

On consciousness

What is the difference between conscious and unconscious action? Unconscious action is autonomous. It is executed according to a set of rules, although the action may be quite complex. Conscious action has a context – the environment, in which it takes place. Conscious action happens only after modelling of consequences. It implies perception of the implications in advance.

Unconscious actions are not remembered, but conscious are. Why? Because the brain cannot predict the result of the modelling: it can predict environment, but it cannot predict its own imagination. So unpredicted experience is recognized as valuable and remembered.

Why do I have only one consciousness in my head? Can I develop two and allow them to communicate? Indeed, if a part of cortex can model, predict, and imagine the environment why it cannot develop its own conscious behaviour? Or maybe we have multiple conscious agents in our head, but they so aligned with each other that they are not distinguishable. Have you ever heard voices in your head?

Tuesday, 12 January 2010

What is Intelligence

you understand something only if you can program it (Chaitin)

Intelligence is Abstract thinking plus Language plus Consciousness. Although all three are not independent, they can be understood in simple definitions.

Abstract thinking is thinking in terms and concepts produced by mind, not sensors. The world mind perceives mostly consists of introspective data.

Language is an agreement between communicating parties. Language serves as a port between the mind and the world.

Consciousness is perception of the abstract representation of self in the world.

The world is the model which the mind builds and holds to predict its future state.

Self is the object in the world the mind has control on. Self does not have well defined boundaries, for example, a governor may associate himself with a state.

Knowledge requires memory. Knowledge transfer requires language. Language is a simpler concept because it can be seen as a collection of symbols or rules. Knowledge is more complex because it is bound to language and behaviour. Any attempt to define knowledge immediately brings up a language. For example, storing any meaningful data requires some format, which is a language. But when we talk about knowledge, language is not necessary. For example, an ant knows where to crawl and does not need a language.

To a simple question "What is memory?" the dictionary answers "The ability to recover information about past events or knowledge" or "a part of a computer in which information is stored". But then what means "information"? What means "information stored"? Is it just a cause forwarded in time to make something behave different?

Friday, 1 January 2010

How to browse Google Maps offline

(See also Crumbles: Maps Offline with Tile Viewer (part II), update Oct 2010)

Once I had a problem that I required my laptop to browse Google maps offline. I looked on the Internet but with no satisfying result. A simple task turned out to be quite complex.

My idea was to have abstract and reliable way to cache and reuse the online content - tiled images. Here what I tried first.

1. I wrote a crawler - a javascript program to force the browser crawl across a particular area. The input specifies latitude and longitude box and steps, zoom level, crawling speed, and satellite or map type.
2. I made my own web server to be used browser instead of going directly to the Internet. I set up 2 machines (one could be virtual). Edit 'hosts' file on the machine A with the list of servers I would like to make cache pointing to the IP address of machine B.
3. Machine B has to accept requests and re-request files from the Internet or retrieve from its cache. I wrote a simple program to do this task.
4. The program running on the machine B did not directly request the data from the Internet. Instead it used wget program. It was a simpler solution since wget allows more advanced way of downloading, e.g. using proxy.
5. Once the cache is full and ready the service program could be run on the machine A with no Internet.

This approach did not work quite well. First complication was that the browser opens simultaneously many connections and my server was one threaded and was not fast enough to serve all of them in timely manner. To overcome this problem I wrote a serialiser - a program getting many connections simultaneously, but requesting only one at a time while keeping others on hold. This worked somehow, but slowly - not to my satisfaction.

Finally I thought that I will download automatically tile images from Google using wget and later worry about viewing them. To my surprise after downloading tiles for about half an hour, I start getting response from the Google servers with the message something like "We are sorry but you are trying automatic downloading. To protect our customers we have to block your IP."

An even simpler solution had been required. I noticed that Microsoft Internet Explorer saves files in its cache directory with proper sub-address names. I wrote a simple program to rip the files from the cache recoding their names. Using Internet Explorer I navigated IE over desired area, and then ran the program and all necessary tiles were successfully stored at my place with proper cataloguing.

The last step was to cook a program (since I was not able to find appropriate application) to view the tiled images which I did very quickly and a bit dirty.

Here are the tile ripper and tile viewer for Windows http://mazonka.com/bin/gmrip.zip

I used this program when driving along Eastern Coast. The maps itself were on maximal resolution level 15 and occupied around 500Mb.

Wednesday, 11 November 2009

Measuring life

Life is measured not in years but in a number of dreams of youth you have let go.

Friday, 2 October 2009

Thesis of darkness

In an evolving system only around one twelfth of substance contributes to the observable cause and consequence relations, the rest is darkness.
  • Dark matter and dark energy in physics.
  • Dark DNA in biology – junk or non-coding DNA.
  • Dark money in economics – money made by promises, in opposite to visible coin, plastic, and digital money.
  • Dark information – unexplainable sequences of events.

Wednesday, 30 September 2009

Wealth and Income

An interesting observation. I and many of my friends have to work to pay our debts. We are intelligent proletarians. A proletarian is a person who possessing neither capital nor production means, must earn his living by selling his labour. A non-proletarian may work, but he does not have to in order to support his living. We are paying out mainly our mortgages, which are mainly the loans for the houses we live in. And most of the value of the houses is the land. So basically we work hard to pay out the land we live on. That makes me ponder.

A simple model. A number of people are willing to buy a resource which is not producible by labour, for example, land. The market price for the land rises up to the level of the limit of competitive abilities of those people. If the people are desperate they borrow from the bank some kind of paper. By doing this they sell their future labour. The owner puts this paper back to the bank, and the bank cancels the paper. When future comes, people have to work to pay back the borrowed paper producing a lot of consumable products. If the amount of products is more than enough, they have to produce all kinds of luxuries to please the owners of the bank and the resource previous owners. When the demand for the resource declines, the prices fall, leaving years of hard labour spent on something, which those people not really required at the first place.

I always suspected that the slavery era has not ended. It transformed. People, who have to work and earn for living, pay taxes. They pay taxes directly through their income and indirectly through businesses they work for, and through the sale taxes. But some who do not have to work usually pay much less taxes, because their lives are businesses with tax deductible expenses. Am I a supporter of this kind of system? Would a simple solution as taxing wealth (not wealth taxing) instead of personal income make all people happier? That makes me ponder.

Tuesday, 14 April 2009

Bomb Problem (part II)

Assume that point A is at location -1 and point B is at 1. If one source produced both A and B and the next shot is expected to be produced by the same source, then the best fit is the normal distribution with mean 0 and dispersion 1: N(0,1,x) - gives the maximum probabilities for points A and B. On the other hand, if different sources produced A and B, the best guess would be that the third shot is normally distributed with one of the sources F(x). Now since no information present about whether one or two sources produced A and B, give the same chances to either way:

f(x)=(N(0,1,x)+F(x))/2

For F(x), give the same chances to points A and B:

F(x)=(F(-1,x)+F(1,x))/2


And the best guess for F(y,x) would be N(y,(x-y)/2,x), because the only information about the dispersion for F(y,x) is the distance between x and y, and the dispersion (x-y)/2 is the best fit. Note, that the function F(y,x) is not proper distribution for variable x, because the probability is given for fixed dispersion and it depends on x, i.e. to be normalized the dispersion has to be fixed. The overall distribution then is:

f(x)=(N(0,1,x)+(N(-1,(x+1)/2,x)+N(1,(x-1)/2,x))/2)/2

where
N(y,s,x)=1/sqrt(2Pi*s2)*Exp(-0.5(x-y)2/s2)

The graph for function f(x) is presented above. The minimum values are at points: -0.47 and +0.47. This means that the safest place is about a quarter distance from either end.

Friday, 3 April 2009

Kernel Density Estimation: Multikernel and Bomb problem

Given a sequence of independent identically distributed random variables X1, X2, ..., XN with common probability density function f(x), how can one estimate f(x)? (Old good KDE problem)

Let us consider the following simple question. You are on the road and you cannot go off side the road. Two bombs fall at points A and B in no particular order (for example you can see only two shell holes, but do not know which one was the first). Where is the safest place on the road if you expect the third bomb to fall? Obviously it is as far as possible from the both points. But what about the safest place between A and B? Is it the middle? Is it the place close to the point A or B?

If you think that both bombs fell from the same source and just randomly deviated from each other, then the middle point would be the most dangerous place, because it gives the highest probability that the most probable outcome is in the middle. However, if you think that those two bombs have independent sources, then the middle is the safest place because it is likely that the third bomb is sourced from either of those two. [It is the best guess because we do not have any information at this moment.] Now if you do not know if the sources are independent, somehow dependent or both are the same, then the answer is unclear.

Note that considering both sources sampled completely independent but with the bandwidth deduced from the distance between the points is the usual way for Kernel Density Estimation. The assumption that the sampled points are uncorrelated seems a bit weird, if not illogical at all. There is no relation between making distribution around points smooth and the spatial information. Doing this properly the estimator f(x) would be a sum of delta functions on points. But this is unacceptable, so the estimator is smoothed with Gaussians or some another kernels. Now if the smoothness (bandwidth) is big enough it is possible (depending on the kernel shape) that the middle is less safe than the end points. [For example see how the most dangerous place changes with the bandwidth parameter for the sum of 2 Gaussians.] In other words the probability in the middle adds equally from both sources and it can be greater than maximum probability from the source A plus probability from the source B at the point A.

If the common kernel is taken for both points, then the most probable place for the third point is the middle, which leaves end points safest - with simple shape of the kernel the middle is the most dangerous place and the further you are from the middle the safe you are; regardless whether you stand right inside the shell hole A or B, or next to it.

Personally I would hide in 1/4 of the distance between A and B from the point A or B, i.e. in the middle between the end point A or B and the middle point. What kernel does satisfy this? I do not know.

Thursday, 29 January 2009

How I made new Microsoft C++ compiler work without Visual Studio installation

My task was to make minimalist compiler configuration running on a machine without installed Visual studio. This helps to work on C++ programs on any computer: copy your files, copy the compiler, and then compile and run. Below are the steps I did to make it working.

1. I downloaded and installed free Visual C++ 2008 Express Edition
http://www.microsoft.com/express/download/

2. I created target directory d:\c15 and a file setvars.bat with the following content
set C15=d:\c15
set PATH=%C15%\bin;%PATH%
set INCLUDE=%C15%\include
set LIB=%C15%\lib

3. I copied files

mspdb80.dll
from "Microsoft Visual Studio 9.0\Common7\IDE\" into "d:\c15\bin\"

c1.dll, c1xx.dll, c2.dll, cl.exe, link.exe
from "Microsoft Visual Studio 9.0\VC\bin\" into "d:\c15\bin\"

whole directory 1033
from "Microsoft Visual Studio 9.0\VC\bin\" into "d:\c15\bin\"

whole directory include
from "Microsoft Visual Studio 9.0\VC\" into "d:\c15\"

libcmt.lib, libcpmt.lib, oldnames.lib
from "Microsoft Visual Studio 9.0\VC\lib\" into "d:\c15\lib\"

Kernel32.Lib
from "Microsoft SDKs\Windows\v6.0A\Lib" into "d:\c15\lib\"


4. At this moment I was able to compile C++ programs with the copied compiler. I started cmd, cleaned the PATH variable, run setvars (step 1), and cl.exe compiled the C++ and C programs. But when I moved this directory to the computer which does not have Visual studio installed then cl.exe failed with a message: "The system cannot execute the specified program".

5. I looked into cl.exe binary searching for the string "manifest". That part is XML. Noted the lines
name="Microsoft.VC90.CRT" version="9.0.21022.8"
Note: version reported by cl.exe is different!

6. I went into C:\WINDOWS\WinSxS\Manifests and found file
Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375.manifest
Note: version numbers match!

7. I copied this file into "d:\c15\bin" directory and renamed it into
Microsoft.VC90.CRT.manifest
Note: the name in step 1, the name of the file, and the name inside this file is the same "Microsoft.VC90.CRT"!

8. I went into C:\WINDOWS\WinSxS and found directory
x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375
Note: version match!

9. Copied all dlls from this directory into "d:\c15\bin" directory.

Voila, it worked in Virtual Windows with no Visual Studio installation.

Wednesday, 10 December 2008

Intelligent design

Biological life is so complex that it must be created by intelligent design. On the other hand, it is so complex that no sane intelligent creature would dare to engineer it.

Simplistic View On Evolution



This is the environment.




These are the organisms.



This is the phenotype.




These are mutations. The phenotype does not much change.




Genotype explores the environment, learns about the limits suitable for living. If the environment (including diseases) does not change, the genotype stays in steady state.




The environment changes. Inbreeding occurs (sexual), mutations become obvious, phenotype swells.




Genes are in desperate search for new environment. New exists are found due to the memory obtained when the living conditions were good and stable.




Two incompatible genotypes are now created.

Thursday, 2 October 2008

Saccade hypothesis

Thinking about how the visual cortex works I came to the conclusion that the 'movies' must be produced by the cortex itself. This is to make sure that the changes of the picture are not the changes in the world. One example for this can be saccades. I started looking for more information about this subject and surprisingly found that the main reason for saccades is difference in retina resolution. I do not agree with this.

According to the current belief the main reason for saccades of the human eye is that the central part of the retina, the fovea, plays a critical role in resolving objects. By moving the eye so that small parts of a scene can be sensed with greater resolution, body resources can be used more efficiently.

In my opinion this is not the case. The main reason for saccades is building abstract invariant of the picture. In visual cortex the information propagates up the higher level by building more abstract notation of the picture. The voluntary changing of the picture is the way for the cortex to deduce the common information. The crucial role here is that the brain (cortex) knows that the real cause (objects being seen) does not change. So the cortex must be working differently when the picture coming from the retina changes due to external factors or changes due to internally motivated saccades.

The memory prediction mechanism allows comparing the changed picture with the predicted according to a particular distance and direction of the saccade. This is done in partly learned memory. But the same mechanism works as finding the nvariants in the changing pictures produced by slightly different view.

The analogy of this process is the theory and the experiment. The theory is proven by different experiments giving the different results but fitting in the theory prediction. The assumption is that the essence does not change with the experiments.

"Saccades are a widespread phenomenon across animals with image-forming visual systems. They have been observed in animals across three phyla, including animals that do not have a fovea (most vertebrates do not) and animals that cannot move their eyes independently of their head (such as insects)." [Land, MF. "Motion and vision: why animals move their eyes". J Comp Physiol A. 1999 185:341–352.] Although in this paper the author argues that the reason for saccades "is the need to avoid the blur that results from the long response time of the photoreceptors".

Assuming that building image invariant is the main reason for saccades, one would come to a conclusion that the other voluntary picture changes should happen in the eye. Indeed, some animals allow their eye rotate [above paper]. Why human eyes do not rotate I do not know. Maybe our vision system is complex enough (3D) to allow less emphasis on obtaining picture.

Sensory cortex and saccade motor cortex must be closely coupled. Because the sensory cortex governs the motor cortex and motor cortex has to feed back its lower level information to sensory cortex. There should be many effects which can easily be tested by experiments to support this hypothesis.

Thursday, 25 September 2008

How to measure chaos

This is to propose the way to measure chaos in a computational system.

I studied the reversible algorithms of arithmetic multiplication (factorization problem). I have found a very interesting fact that when the information describing the ensemble grows fast, this exact process is difficult to reverse, i.e. find feasible computation reverse algorithm. Let me explain by example of computation.

Suppose there is an initial set of N bits {x}. If all bits are independent and can initially be set to either 0 or 1, then this is the ensemble of 2N states. Now suppose we have a function G describing all forbidden states of the ensemble. [The same up to inversion arguments would go with all allowable states.] Initially G=0, since all values of x are allowed.

Next suppose that we have a computational process which is done in atomic steps. Each step can be one of two kinds: either creating a new bit or forgetting an old. For example, add a new bit y1=x1&x2 (let us signify & as AND operation, | as OR, and ^ as XOR). The G function becomes y1^(x1&x2) if previous G=0, or in general case Gnext=Gprevious|y1^(x1&x2). Forgetting a bit x2 would make Gnext=Gx2=0&Gx2=1, where Gx2=0 is G with x2 replaced with 0.

It seems easy to keep G function defined while doing the calculation process. This is important because while we know G function the calculation is immediately reversible – it is easy at each backward step find out the previous forgotten bit. But the problem appears when G function becomes impractically huge in representation. This happens, for example, with arithmetic multiplication. The only way to attack this problem is to find symmetries in the function so to make it computationally practical, smaller.

Suppose that with a given intellectual strength we find the smallest representation of G function. This function can be written as a sequence of the atomic steps A=B&C, where A,B,C are bits or their negations (say A=B|C is ~A=~B&~C). The negation is not an operation, rather a perception of the bit. With this representation the function becomes measurable in number of atomic computational steps.

That makes it very natural to define the chaos as the increase of the size of the function G. Note that the definition includes the intellectual strength of the observer, which seems natural for the definition of chaos. Also it qualitatively resembles Lyapunov exponents as chaos measure.

Monday, 15 September 2008

Precise theory for Artificial Intelligence

Every research area has its own language. But there is a distinction between precise and non-precise theories describing the areas of interest. In physics, for example, the language is mathematical formulas. And this is a precise formal language; because formulae help, in general, to solve physical problems even if people applying the formulae have different interpretation of them. We can argue on the definition of Time and Enegry. But when it comes to the formula with E and t, everyone will get the same result regardless of personal (internal) understanding of these concepts.

Completely different situation is with Artificial Intelligence research area. Here are concepts of information, memory, awareness giving completely different philosophical theories depending on how the concepts are being understood. There is so big variety of opinions that it is difficult to call this area of research scientific. Nevertheless some groups of people sharing the same beliefs are able to communicate and even to make some progress in ideas. But with no practical results. Obviously now the understanding of the problem in question is different than ten years ago. Hopefully a simple model can be built in some near future, just to give the common basis for terminology used in this field.

Wednesday, 16 July 2008

Beating the nature

We are not cleverer than the nature. Just sometimes the nature does not understand us.

Wednesday, 9 January 2008

When we get together

When we get together our intellect does not add up, but our stupidity does.

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?)