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.
Management EssentialsTo manage a business a manager must control the outcomes of daily activities so that the goal of the business is achieved now and in the future. To most of you I am sure this probably sounds like a statement affirming the value of motherhood and apple pie. With all that has been written on management why another article? What can one more article add?
It is said that once we understand something, it can be described in just a paragraph or two. If this is true then we certainly do not yet understand management! Rather than paragraphs, we have many tomes written on the subject. The authors of these various books, while agreeing on many things, differ on many others. So the debate continues, but managers need practical answers today. They cannot wait until the topic is fully understood. They are responsible to act now, but while action is necessary, it is not by itself sufficient!
As one who holds both a bachelors and masters degrees in the subject, has practiced it for several years in organizations both large and small, and has taught it for over ten years at the post-secondary level, I can attest to the breadth of the topics encompassed by management. The breadth alone ensures that it would take several volumes just to introduce the subject. It would require a library to adequately cover the entire field of management, so this article can not be a definitive work on management.
So what is it? I will present certain ideas, to lay a foundation for a better understanding of the fundamentals of this subject. One cannot build a large edifice on a poor foundations for it will surely topple if we do. I do believe that we have adequate knowledge to properly manage any of the various organizations in our society today. However, I also believe that the breadth and depth of knowledge available to us today has obscured the issue of what is essential for managers to do. Because of this managers stumble, and they lose focus.
If the activities managers focus on do not move the business closer to their goal, then those activities, no matter how well meaning, are not contributing to the success of the business, rather they are contributing to its demise. If the actions are not contributing then the manager too is unfocussed. It is all about how a manger uses his time.
Mintzberg in his seminal study on How Managers Spend their Time commented as follows.
"A manager's work is characterized by the brevity of individual tasks, the unrelenting pace of activity, and the understanding that their work is never done. In an organizations where time management is paramount, how managers use their time is critical!"
We all know that a manage's job is never done, but how they approach the task can be quite revealing. Most of us are familiar with organizations which demand that their managers spend many hours toiling to make the business successful. Most of us are also aware that some businesses require only an eight or nine hour day from their employees and then want them out of the office. In other words time is also obviously not sufficient for success.
The textbooks say 'to manage is to monitor and control a system so it yields the desired results'. This requires that we first identify and understand the system which is our organization. Second we must understand how to manage that system. That implies we must know how to change the system to produce desired results while preventing undesireable outcomes.
Of necessity we must also be clear as to the goal of the system. This is not a trivial matter as anyone will understand when they read the literature on goals and goal seeking. All too often managers seem to lose focus and even forget what the goal of an economic system must be. This also happens if the activities managers undertake moves us farther from the goal rather than nearer to the goal. Determining whther an action will move us closer to our goal before we take the action is not a trivial matter!
I would argue that many managers do not adequately understand the system they are supposed to control. They do not understand how to change their system so as to create intended outcomes without undesireable outcomes. Many do not even understand what their goal should be. This article will show you how to remedy these devastating yet essential components.
So how do we accomplish these things. It requires the mastery of a set of thinking processes for controlling systems. The three steps of the process are:
- What to change.
- What to change to.
- How to cause the change.