VariablesProgramming is a process that requires us to organize our actions into three stages. These are:
- Entering information into the program.
- Processing the entered data.
- Outputing the results to a screen or a printer.
Inputs Necessary for Loan Calculation
- The amount of the loan.
- The current interest rate.
- The duration of the loan.
The question is what do we do with each datum entered so that we will have it when we are ready to perform the calculation. The answer is simple. We put it in a safe place where we can go back and get it whenever we need it. If programming terms that 'safe place' is called a variable.
The beginning programmer in Visual Basic will usually say: "Well it is in a safe place, it is in the textbox where the user entered it," or "It is in the radiobutton which the user selected." They are correct, but only partly. In a simple programming we can indeed leave our data on the form and expect it to be there when we need it. However, as a person learns more about programming you learn that there are advantages to making a copy of the data which has been entered and storing it in a place which will not permit the user to accidentally change or remove it. The only real disadvantage is a bit of extra coding to create the variable and store the information in it.
Some of these adavantages are:
- Data stored in a textbox is a string. If it is to be used as a number it must first be converted from string data type to one of the number data types. If we leave the data in the textbox then this conversion must be done everytime the data is needed. So the question is: should you do this conversion every time you need the datum or do it once and store the number as a number? Experience has shown that fewer conversions are more efficient and safer because there are fewer opportunities for errors to occur.
- By storing the data we want to keep track of, we are certain to have it when we need it. A form's main purpose is to allow the user to input data, and to display output, not for holding or storing data. Information in textboxes and radiobuttons could be changed by the user. If we do not store the data we need to keep track of, it may not be there when we need it because it may have been accidentally or deliberately altered by the user. By placing the data in a variable we can control it better preventing the accidental or deliberate changing of our data.
- Separating the entry of the data from the storage of the data allows us to check each time data is entered to see if it is the right kind of data. If it passes the error checks then we can store it in a variable. This way we are only asking our program to do one thing at a time. This is an approach which has been proven to be a more reliable way to do things for over fifty years.
- Processing is sometimes done in stages. If we continually convert our data from number to string and back again we can lose precision. We should convert between data types as seldom as possible. Ideally that means twice: once just after the data is entered and second when we display the result for the user. The best way to do this is to use variables for data storage.
- Q The data which has been input is stored in a textbox but it is not text data.
- A Create a variable then convert the date to the proper data type and store it in that variable.
- Q You have two numbers stored in two variables. How do you swap the numbers?
- A Declare a third variable. Move second number into the third variable. Move first number into second variable. Now move second number, currently located in the third variable, into first variable.
- Q You need to keep track of whether the data in your program has changed so that you will know whether the file needs to be saved.
- A Declare a boolean variable and name it appropriately e.g. fileNeedsSaving When this variable is set to
Truethe flie needs to be saved and when set to
Falseit does not need to be saved. Now use this variable to note when your file needs saving. For example when we add data the file needs saving, When the file has just been saved it does not need saving.
The Short and Glorious History of Organizational Behaviour
The study of how people behave in organizations is useful to all organizational participants. It helps the top level participants understand how to manage the organization. It helps managers become better at controlling their departments. It helps lower level participants understand why things are the way they are and how to protect themselves against being victimized by a system that appears to largly take them for granted. It offers help in understanding orgaizations from operational, tactical and strategic viewpoints.
One interesting introduction to this field, and a favourite of mine, is an overview written by Charles Perrow entitled "The Short and Glorious History of Organizational Theory". The article was originally published in Organizational Dynamics (Summer 1973). I read it in a compilation called Classics of Organization Theory while in a masters program in the early 1980's. The author employs a tongue in cheek style and renders the history as a struggle between the forces of light and the forces of darkness. What follows is my synopsis of Perrow's article.
Perrow characterizes organizational history in terms of two main forces. Those forces of research which treated an organization as a mechanical thing, he characterizes as the forces of darkness. The forces of light collectively refer to research that has a more humanistic basis and theme. "From the beginning, the forces of light and the forces of darkness have polarized the field of organizational analysis and the struggle has been protracted and inconclusive." The forces of darkness refer to such things as Taylorism (father of time and motion studies), division of labour, specialization, and line of authority. The forces of light comprize the human relations movement, Hawthorne studies and related themes. These aspects of organizational investigation emphasize people, accomodations and biological analogies over mechanical ones.
Scientific ManagementThe show gets started with the rise of Scientific and Classical Management. Emphasis was on planning, record keeping, reduction of span of control to about six, decisiveness and other rather simplistic pronouncements. The primary examples of organizations were the military and the Catholic church and organizations were seen as mechanical entities. As organizations expanded, most of these admonitions worked. However, the one constant in human affairs is change, and several factors arose which were problems for the formulae of the time. These included:
- Increasing importance of Labour accompanied by its rise in power.
- Increasing diversity of markets, proliferation of products, and increased complexity of technology.
- Changes in cultural, political and social changes altered the expectations of the general population with respect to the workplace.
- As growth increased organizations became too large and diverse to be seen as an extension of their owner. Mergers proliferated and a general preoccupation with management and leadership emerged.
Enter Human RelationsAlthough some individuals had opposed Scientific management they were mostly ignored. However, these voices received a tremendous boost from the publishing of two studies. The first was a book by Chester Barnard who proposed the theory that an organization is a "cooperative system" rather than a mechanical system. Then came the Hawthorne studies which emphasized the importance of human factors such as informal work groups, norms, and social relationships and their effects on productivity.
Attention then turned to the study of leadership. At first the emphasis was on leadership traits and the list sounded, as Perrow stated, "like an enumeration of Boy Scout qualities: kind, curteous, loyal, courageous". The research did turn up differences between employee centered aspects of leadership (consideration) and job centered aspects of leadership (initiating structure) and this provevd to be a fruitful area of investigation. It also bolstered the human relations approach to the study of organizations.
The Tavistock investigations into what is now known as sociotechnical systems also found important relationshsips between productivity and work groups. The practical negative impact of actions such as routine tasks, submission to authority, specialization of task, ignorance of the goals of a firm and centralized decision making on a group's morale were well documented. Another interesting discovery was how social systems interacted with job task considerations. Far from having only a negative influence on work productivity, social interaction was found, under certain circumstances, to improve work productivity.
The pace of change of technologies and the turbulence of the environment brought new views of how organizations ought to be organized. Models of the organization began to move toward organic and social systems rather than mechanical. While the models became much more complex, most agreed the models were much more realistic and very much more revealing.