In this article, we will see. What is variables. Variables play very important role in any software development. In this article, tester can learn how to handle variables.
2. Variable
Forget about programming, let’s consider some scenarios in real
world. When we say “Object”, which things first come to your mind. Well,
sudden question from me may confuse you. Now ask yourself which
objects you have in your home. You may have chairs, sofa, TV, Washing
Machine and lot more.
Let’s take one object from things which you have at home, TV.
3. Can you tell me which Brand, Color, Model No., Size, Price of your
TV? And also I like to know whether your TV is smart TV?
Category: LED
Brand: Samsung
Color: Black
Model No.: xyz
Size: 55 inch
Smart TV: Yes
Price: 85,000
So, it means we can categories TV in Brand, Color, Model No., Size, Price, Smart_TV, right?
4. Let’s take universal example of TV, you can find TV in,
• Brand: Samsung, Sony, Haier, Videocon, LG etc.
• Color: Black, Silver, White, Red etc.
• Model No.: 32LJ522D, 24LH454A, UN32J525DAFXZA etc.
• Size: 26, 32, 42, 44, 55 etc
• Smart_Tv: Yes, No
• Price: 85000, 100000, 25000 etc
Here, we say brand, color, model_no are alphanumeric. Size is numeric, price is
decimal and smart_tv as Boolean.
5. In programming word alphanumeric, numeric, decimal and Boolean are called as datatype.
Brand, Color, Model No., Size, Price, Smart_TV are Variables.
Alphanumeric values are defined as “string”, numeric as int, decimal, float, money, double in
programming world.
Syntax for variable declaration is,
<data_type> <variable_name>;
We can initialize variables in following way and its value can be change later.
string water_unit = “ltr”; int taksh_age = 3;
6. If you are tester
• While doing Data Flow Testing, variables take important part.
• Because, It mainly focuses on the points at which values assigned to the
variables and the point at which these values are used by concentrating
on both points, data flow can be tested.
• Data flow testing uses the control flow graph to detect illogical things
that can interrupt the flow of data.
• So you would like to check things which are explained in next slide.
7. A variable that is declared but never used within the program.
On most of IDE like Microsoft studio, you may find that few variables are declared but they are in
gray color. When you take your cursor on it, message will pop up with “Variable never used.”
8. ▫ A variable that is used but never declared.
This problem is most of time when we use multiple classes. For few compiler,
ordering of classes do matters.
▫ A variable that is declared multiple times before it is used.
Developers sometimes, declare same variable multiple times. This happen
when code get lengthy. Most of time developers intialise same variable for
multiple times.
▫ Deallocating a variable before it is used.
This can be seen in array. Deallocation sometimes tends memory leak. So you
have handle this very carefully.
9. ▫ Whether variables have given proper name.
Most of the times project moves from one developer to other developer. This can be
the case when junior submit code to senior or developer left the job and other developers handles
it. So giving proper name to variable is very important. E.g., suppose there is variable with name
student_name have to be declared. In this case if suppose developer XYZ, declare it as using his or
her speaking language as vidyarthi_nav , and if this project is handed over to other developer ABC
then that time ABC may not understand what is vidyarthi_nav . So, giving proper name to variable is
more important.
▫ Whether variables have given proper data types.
It’s very important to use proper data type for variables. Common mistakes are done
when int values are declared as float or double. String is but char data type is enough.
10. Thank You
• To learn,
▫ *Android*iOS*C#, C, C++*Asp .net MVC*SQL*PHP*Java*Advance
Java*Javascript*Jquery*WCF*WPF*Angular JS*Python*React native
▫ Digital marketing and SEO on live projects.
▫ Microsoft CRM 365.
You can contact me by call or What’s App on +91 9819991929
www.codewithnilesh.com
Editor's Notes
How presentation will benefit audience: Adult learners are more interested in a subject if they know how or why it is important to them.
Presenter’s level of expertise in the subject: Briefly state your credentials in this area, or explain why participants should listen to you.
Lesson descriptions should be brief.
Example objectives
At the end of this lesson, you will be able to:
Save files to the team Web server.
Move files to different locations on the team Web server.
Share files on the team Web server.