Stage 2module 1
-
Upload
shaiksaadullah -
Category
Documents
-
view
215 -
download
0
Transcript of Stage 2module 1
-
8/18/2019 Stage 2module 1
1/104
1.1. What is Programming?
A problem is defined as any question, something involving doubt, uncertainty, difficulty or a situation whose
solution is not immediately obvious. A situation which is a problem for one person may not be a problem for
another person. Figure 1.1 graphically represents the concept of problem solving.
A Computer is a tool that can be used to solve problems by writing programs. Writing a program withoutknowing the problem that we are trying to solve is like swinging a knife without knowing what it is that we want
to cut.
A program is a set of instructions that tells the computer how to do a task. When a computer follows these
instructions, we say it eecutes the program
Fig 1.1: Problem Solving
A programming language is a computer language that programmers use to develop applications. An application
is a set of instructions for a computer to eecute. A set of rules that provides a way of telling a computer what
operations to perform is called a !rogram.
!rogramming is the process of designing, developing, testing, debugging and maintaining the source code of
computer programs. "t is used to create a set of instructions that computers use to perform specific operations
or to ehibit desired behaviors. #ource code can be written using programming language such as C$$, %ava,
!ython, #malltalk, C&, etc. 'he process of writing source code often requires epertise in many different
sub(ects, including knowledge of the speciali)ed algorithms, application domain and formal logic.
Within software engineering, programming *implementation+ is considered as a phase in the software
development process.
The Programming Process
eveloping a program involves different steps similar to any problem solving task. 'here are five main steps in
the programming process. 'hey are as follows-
1. efining the problem
. !lanning the solution
/. Coding the program
0. 'esting the program
. ocumenting the program
2et us discuss each of these steps.
-
8/18/2019 Stage 2module 1
2/104
1. Defining the problem
As a programmer, you meet with end users from the client organi)ation to analy)e the problem, or you meet
with a systems analyst who outlines the pro(ect. #pecifically, the task of defining the problem consists of
identifying what you know *input3given data+, and what you want to obtain *output3the result+. 4ventually, you
create a document or an agreement that specifies the kind of input, processing, and output required to
complete the task.
2. Planning the solution
'here are two ways that are commonly used to plan the solution to a problem. 'hese are to draw a flowchart
and to write pseudo code, or both.
Pseudo code
!seudo code is an 4nglish3like non3standard langauge that permits you to focus on the program logic without
having to be concerned about the precise synta of a particular programming language. 5owever, pseudo code
is not eecutable on the computer. "t lets you state your solution with more precision than plain 4nglish.
5owever psuedo code has lesser precision than is required when using a formal programming language. An
eample is given below-
4ample - 6ead number n and print the integers counting up to n.
6ead n
"nitiali)e the variable i to 1
while i 7less than or equal to n7 do
!rint i
"ncrement i
end while
#top
"n the above eample, the program enters the while loop only if the condition *i less than or equal to n+ is true.
'wo statements !rint i and "ncrement i are eecuted for each iteration. At the end of each iteration, the
condition is evaluated again and the loop continues as long as the condition is true.
Flowchart
"t is a pictorial representation of a step3by3step solution to a problem. "t consists of arrows representing the
direction the program takes and boes and other symbols representing actions. "t is a map of the steps
involved in a program. 'he American 8ational #tandards "nstitute *A8#"+ has come up with a standard set of
flowchart symbols. 'he following figure shows the flowchart symbols and how they might be used in a simple
flowchart of an everyday action preparing a letter for mailing.
-
8/18/2019 Stage 2module 1
3/104
Figure 1.2: Flowchart
!lease refer the links below to learn more about pseudo code and flow chart.
http-99ceng.anadolu.edu.tr9emrekacma)9bil1:9flowchart3pseudocode3eamples.pdf
http-99o)ark.hendri.edu9;burch9csbs(u9cs91
-
8/18/2019 Stage 2module 1
4/104
that you require. After that, the program must be keyed, probably using a personal computer, in a form that the
computer can understand.
4. Testing the program
#ome eperts claim that a well designed program can be written correctly the first time and there are
mathematical ways to prove that a program is correct. ost of the programs may have a few bugs *errors+
when eecuted for the first time. 'his is a little discouraging at first, since programmers tend to be careful,
precise and detail3oriented people who take pride in their work. 'here are many ways in which mistakes or
problems may happen in programs. >ou will probably have made some of them. 4ventually, after coding, we
must prepare to test the program on the computer.
'esting involves three phases-
1. esk3checking
. 'ranslating
/. ebugging
2et us discuss each of them.
Deskchecking
'his is similar to proofreading. 'his phase is sometimes avoided by the developer9programmer who is looking
for a shortcut and is eager to run the program on the computer once it is written. 5owever, with careful desk3
checking we can identify several errors and possibly save our time in the long run. "n desk3checking, you
simply sit down and mentally check or trace the logic of the program in an attempt to ensure that it is error3free
and is in workable condition. any organi)ations take this phase a step further called walk through, a process
in which a group of programmers review the program and make suggestions or comments in a collegial way.
Translating
A translator is a program that
". Checks the synta of the program to make sure that the programming language was used correctly, giving
you all the synta related error messages called diagnostics, and
"". 'hen translates the program into a form which the computer can understand. A by3product of the process is
that the translator tells us if we have improperly used the programming language. 'hese mistakes are called
synta errors. 'he translator gives descriptive error messages.
!rograms are most commonly translated using a compiler. A compiler translates the entire program at one time.
'he translation involves your original program *#ource file+ which is transformed by a compiler into an ob(ect
module. !re3written programs from a system library may be added during the load9link phase, which results in a
load module. 'he load module can then be eecuted by the computer.
Debugging
ebugging is used etensively in programming. "t means detecting, locating, and correcting bugs *mistakes+ by
running the program. 'hese bugs are called as logic errors, which tells the computer to repeat an operation but
not telling it when to stop repeating. "n this phase we run the program using the test data that we devise. We
must plan the test data carefully to make sure we test every part of the program.
-
8/18/2019 Stage 2module 1
5/104
!. Documenting the program
ocumenting is an ongoing process. "t is a detailed description of the programming cycle and specific facts
about the program in the written form.
'ypical program documentation include the origin and nature of the problem, a brief description of the program,
logic tools such as pseudo code and flowcharts, program listings, data3record descriptions and test results.
Comments in the program are also considered as an essential part of documentation. any programmers
document as they code.
A wise programmer continues to document the program throughout its design, development and testing.
ocumentation is used to supplement human memory and to help organi)e program planning. ocumentation
is also critical to communicate with others who have an interest in the program and may be part of a
programming team.
1.2. "h# programming is re$uired%
We may have already used software, in the form of spreadsheets or word processing, or to solve problems.!erhaps we are now curious to learn how programmers write software. A program is a set of step3by3step
instructions that directs the computer to do the tasks we want it to do and produce the results we want.
'here are three good reasons for learning programming-
1. !rogramming helps us to understand computers. "f we learn how to write simple programs, we will know
better about how a computer works.
. Writing a few simple programs increases our confidence level. We will find great personal satisfaction in
creating a set of instructions that solvea a problem.
/. 2earning programming lets us find out quickly whether we like programming and whether we have the
analytical turn of mind that programmers need. 4ven if we decide that programming is not for us, understanding
the process certainly will increase our appreciation of what computers and programmers can do.
"hat Programmers Do%
'he programmer prepares the set of instructions of a computer program and runs those instructions on the
computer, tests the program to see if it is working properly, and then makes corrections to it. 'hese activities
are all done for the purpose of helping a user to fill a need, such as paying employees, admitting students to
college or billing customers.
!rogramming can be done as a solo activity, but a programmer typically interacts with a variety of people. For
eample, if a program is a part of a system of several programs, the programmer coordinates with the other
programmers to make sure that all the programs fit together correctly. "f you are a programmer, you might also
have coordination meetings with users, systems analysts, managers, and with peers who evaluate your work
(ust as you evaluate theirs.
&e'els of &anguage
-
8/18/2019 Stage 2module 1
6/104
!rogramming languages can be BlowerB or Bhigher,B depending on how close they are to the language the
computer itself uses *
-
8/18/2019 Stage 2module 1
7/104
'hese so3called third generation languages spurred a great increase in data processing that characteri)ed the
1G
-
8/18/2019 Stage 2module 1
8/104
• We may be limited by the availability of languages. 8ot all languages are available on all computers
and in all installations.
• 'he language may be limited to the epertise of a programmer. 'he program may have to be written in
a language that the available programmer knows.
a(or !rogramming 2anguages are F@6'6A8 *a scientific language+, C@?@2 *a business language+, ?A#"C*simple language used for education and business+, !ascal *education+, Ada *military+, and C *general
purposed+, C, C$$, %ava, and %avascript.
2.1. -'er'iew of oftware De'elopment
#oftware development is a discipline in the computer science field that focuses on the creation of programs that
control computer hardware. 'hese programs, also referred to as 7software applications7 or in short 7apps7, are
groups of instructions that tell a computer what is to be done. 'he software development field consists of
several computer programming languages, each designed to fulfill various requirements depending on the
pro(ect at hand.
"t is almost unbelievable to think that a few decades back, the programmers did not even have desktop
computers to work on. "nstead they punched instructions into paper cards which were input into a mainframe
computer centrally located in a Bmachine roomB. "n those times, these instructions were written in assembly
language or machine code, the native language used by hardware of the computer. As software development
evolved, 7higher level7 languages were developed patterning natural languages and better reflecting the human
problem3solving process. 4ven today, assembly language is still used, especially by low3level engineers
developing computer components and embedded systems. ?ut, most of the desktop and web3based
development is done using high3level languages like A#!, C$$, C&, %ava, !erl, etc.
"f hundred programmers were asked, 7What do they think is the best programming language for beginnersK7
you might get one hundred and one answers. 4ach individual has an opinion. 'he question is akin to asking
what is the best vehicle to drive 3 there is simply no right or wrong answer. Fortunately, some general
guidelines eist to get the novice programmer off to a good start. 5owever, those who are completely new to
computers and unsure of whether they are up to the task *or whether software development will be of interest
to them+ should start with a language that is designed to teach basic principles with very minimal compleity.
'he ?A#"C and 2@J@ programming languages were early attempts to bring computer programming to the
masses. 'oday a language like icrosoft7s Disual ?asic would be ideal for a beginner. Disual ?asic helps you to
make practical applications with a visual interface in a matter of hours without getting bogged down by the
technical details. Hnlike ?A#"C and 2@J@, Disual ?asic has practical applications that can be used in bothcasual and commercial environments.
'hose who are technically inclined or already have a fair amount of eperience with computers may be
prepared for more advanced programming concepts. For many years, !ascal was considered the entry
language for such people, and was generally used in schools and universities to teach programming at a
professional level. 8owadays more BpracticalB languages like C$$, C&, and %ava are taught for the reason that
they provide a more direct approach to learning how to develop software with tools that are more commercially
viable than !ascal.
-
8/18/2019 Stage 2module 1
9/104
&ife C#cle of a oftware De'elopment Pro/ect
#oftware development is a complicated process comprising different stages. 4ach stage requires a lot of
paperwork and documentation in addition to the process of development and planning. 'his is in contrast to the
common thinking of newcomers to the software industry who believe that software development is (ust writing
code.
4very software development pro(ect has to go through the following stages at least once-
• 6equirement gathering
• Writing functional specifications
• Creating architecture and design documents
• "mplementation and coding
• 'esting and quality assurance
• #oftware release
• ocumentation
• #upport and new features
'here may be many additional steps and stages depending upon the nature and the type of the software
product. >ou may have to go through more than one cycle during the testing phase as software testers to find
problems and bugs. 'he developers need to fi them before a software product is officially published or
released. 2et us go into these stages in detail.
0e$uirement athering
6equirement gathering is usually the first stage of any software product. 'his stage officially commences when
you are thinking about developing software. "n this phase, you meet customers or prospective customers, and
do a market analysis of the requirements and features that are in demand. >ou might as well find out if there isa real need in the market for the software product you are trying to develop. "n this stage, most of the work is
done by the marketing and sales people, or people who have direct contact with the customers. 'hese people
talk to customers and try to understand what eactly their requirements are.
A comprehensive understanding of the customersL needs and writing down features of the proposed software
product are the keys to success in the requirement gathering phase. 'his phase is actually a base for the whole
development of the software. "f the base is not laid appropriately, the product will not find a place in the market.
"f a very good software product which is not required in the market is developed, it does not sell no matter how
well you build it. >ou can find many instances of software products that failed in the market because the
customers did not require them. 'he marketing people usually create a arketing 6equirement ocument or
6 that contains formal representation of the market data gathered. >ou can also consider your competitorsL
products *if any+. 'his process is called competitive analysis.
Finally, list down the features required by the product. Appropriate consideration must be given to the
economics of software creation at this point. Muestions that must be asked are- is there a marketK Can " make
some profitK will the revenue (ustify the cost of developmentK
"riting Functional pecifications
Functional specifications may consist of one or more documents. 'hese documents show the behavior or
functionality of a software product on an abstract level. Assuming the product is a black bo, these
-
8/18/2019 Stage 2module 1
10/104
specifications define its input9output behavior. 'he product requirements documentation put forward by people
who have contact with the end user of the product or the customers, forms the basis of the functional
specifications.
"n larger products, functional specifications may consist of separate documents for each feature of the product.
For eample, if the product is a router, you may have a functional specification document for 6"! *6outing
"nformation !rotocol+, another for features on security, and so on. Functional specifications are important
because developers use them to create design documents. 'he documentation people also use them when
they create manuals for end users. "f different groups are working in different physical locations, functional
specifications and architecture documents *discussed net+ are also a means to communicate.
Neep in mind that sometimes during the product development phase you may need to amend functional
specifications keeping in view new marketing requirements.
Creating )rchitecture and Design Documents
When you have all of the requirements collected and arranged, it is the turn of the technical architects team,
which usually consists of highly qualified technical specialists, to create the architecture of the product. 'his
defines different components of the product and how they interact with each other. @ften, the architecture also
defines the technologies used to develop the product. While creating the architecture documents, the team also
needs to consider the timelines of the pro(ect. 'his is the target date when the product is required to be on the
market. @ften ecellent products fail because they are either too early or late to market. 'he marketing and
sales people usually decide a suitable time frame to release the product. ?ased on this timeline, the
architecture team may drop some features of the product if it is not possible to bring the full3featured product to
market within the required time frame. After deciding the components of the product and defining their
functionalities, interfaces are designed for these components to work together.
ost often, no component works in isolationE each one has to coordinate with other components within the
pro(ect. "nterfaces are the rules and regulations that define how these components will interact with each other.
'here maybe ma(or problems down the road if these interfaces are not designed properly and appropriately
detailed. ifferent people will work on different components of any large software development pro(ect and if they donLt fully understand how a particular component will communicate with others, ma(or problems arise
during integration. For some products, new hardware is also required to make use of technology
advancements. 'he architects of the product also need to consider this aspect of the product. @nce the
architecture, software components and their interfaces are defined, design documents are created as the net
phase of development. At the architecture level, a component is defined as a black bo that provides certain
functionality. At the design documents stage, you have to define what is in that black bo.
'he design documents are usually created by the senior software developers and these documents define
individual software components to the level of functions and procedures. 'his is the last document completed
before development of the software starts. 'hese design documents are passed on to software developers as
they begin coding. Architecture documents and 6s usually need to stay in sync, as sales and marketing will
work from 6s while engineering works from engineering documents.
mplementation and Coding
'he software developers use the design documents and development tools *editors, compilers, debuggers etc.+
and start writing software. 'his is often the longest phase in the product life cycle. 4very developer has to write
his9her own code and collaborate with other developers to make sure that the different components can inter3
operate with each other. A revision control system such as CD# *Concurrent Dersions #ystem+ is needed in this
phase. 'here are many open source revision control systems as well as commercial ones available these days.
-
8/18/2019 Stage 2module 1
11/104
'he version control system provides a central repository to store the individual files. A normal software pro(ect
may contain anywhere from hundreds to thousands of files. "n larger and comple pro(ects, directory hierarchy
must also be decided beforehand so that files are stored in appropriate locations. uring the development
cycle, different developers may modify the files. "f the rules are not followed by everybody, this may easily
break the whole compilation and building process. A typical eample is duplicate definitions of the same
variables causing problems.
#imilarly, if included files are not written properly, loops get created easily. @ther problems pop3up when
multiple files are included in a single file with conflicting definitions of variables and functions. Coding guidelines
must also be defined by architects or senior developers. As an eample, if software is intended to be ported to
some other platform, it must be written on a standard like A8#". uring implementation, developers must write
enough comments inside the code so that if anybody starts working on the code in the future, he9she would be
able to understand what has already been written. Writing good comments is etremely important as all other
documents, no matter how good they are, will be lost eventually. 'en years subsequent to the initial work, it7s
probable that you may find only that information which is in the form of comments, present inside the code.
evelopment tools also play an important role in this phase of the pro(ect.
Jood development tools save a lot of time for the developers. 'hey also help to save money in terms of
improved productivity. "n terms of time saving the most important development tools are editors and debuggers.
An editor helps a developer to write the code quickly.
A good debugger helps to make the code operational in a short period of time. ?efore the start of the coding
process, considerable time must be spent in choosing good development tools. uring the development phase,
review meetings also prove helpful. 'hrough review meetings, potential problems are identified earlier in the
development. 6eview meetings are also helpful to keep track of whether the product is on time or if more effort
is needed to complete it within the required time frame. 'here will be times when you may also need to make
changes in the design of some components because of new requirements from the marketing and sales team.
6eview meetings are a great tool to convey these new requirements. 5ere, architecture documents and 6s
are kept in sync with any changes9problems encountered during development.
Testing
'esting is probably the most important phase for long3term support as well as for the company7s reputation. "f
you donLt control the software quality, it will not be able to compete with other products on the market. "f
software crashes at the site of the customer, he loses productivity as well money and you lose credibility. @n
most occasions these losses are huge. Hnhappy customers will never buy other products from the same
vendor and will not refer other potential customers. >ou can avoid this situation by doing etensive testing. 'his
testing is often called as Muality Assurance, or MA, in the software world. Jenerally testing starts as soon as
the initial software components are available. 'here are multiple types of testing. 4ach of these has its own
importance.
1. nit Testing 3 Hnit testing is testing one part or one component of the product. 'he developer generally
does this when he9she has completed writing code for that part of the software. 'his makes sure that thecomponent is doing what it is intended to do. 'his also helps the software testers as well as developers save
time by eliminating many cycles of software being passed back and forth between the developer and the tester.
When a developer is ready with a particular part of the software, he9she can write test cases to test the
functionality of this part of the software. 'he component is then passed on to the testers who run test cases to
make sure that the unit is working properly.
-
8/18/2019 Stage 2module 1
12/104
. anit# Testing 3 #anity testing is a very basic check to see if all the software components compile with each
other without any problems. 'his is to ensure that developers have not defined conflicting or multiple functions
or global variable definitions.
/. 0egression or tress Testing 3 6egression or stress testing is a process done in some pro(ects to carry out
a test for a longer time period. 'his type of testing is used to determine the behavior of a product when used
continuously over a period of time. "t can epose some bugs in software like the ones related to memory
leakage. "n some cases, developers allocate memory but forget to release it. 'his is usually referred to as
memory leakage. When testing goes on for many days or weeks, it often results in allocation of all of the
available memory until no memory is left. 'his is the point where your software starts showing abnormal
behavior. Another potential problem in long3term operation is counter overflow. 'his happens when you
increment a counter but forget to decrement it resulting in an overflow when the product is used for long time.
'he regression testing may be started as soon as some components are ready. 'his type of testing requires, by
its very nature, a very long period of time. 'he process should be continued as more components of the
product are integrated. 'he process of integration and communication through interfaces may create new bugs
in the code.
0. Functional or #stem Testing 3 Functional testing is carried out to make sure that the software is doing
eactly what it is supposed to do. 'his must be done before any software is released to customers. Functional
testing is done by testers whose primary (ob is software testing, and not the developers themselves. "n small
software pro(ects where a company canLt afford dedicated testers, other developers may also do functional
testing. 'he key point to keep in mind is that the person who wrote a software component should not be the
person who tested it. A developer will always have a tendency to test the software the way he9she wrote it.
5e9she may easily miss any problems in the software. 'he testers need to prepare a testing plan for each
component of the software. A testing plan would contain test cases that are run on the software. 'he tester can
prepare these test cases using functional specifications documents. 'he tester may also get assistance from
the developer to create test cases. 4ach test case must include methodology used for testing and epected
results. Additionally, the tester may also need to create certain infrastructure or environment to test the
functionality of a piece of code. For instance, you may simulate a network to test the routing algorithms that
may be part of a router. 'he net important (ob of the tester is to create a service request if an anomaly is
found. 'he tester must include as much information in the service request as possible.
'ypical information included in reporting bugs includes-
• 'est case description
• 5ow the test was carried out
• 4pected results
• 6esults obtained
• A description of that environment, if a particular environment was created for testing
'he bug should be forwarded to the developer so that the developer may correct the problem. any software
packages are available in the market to track bugs and fi problems in software.
oftware 0eleases
Any software product is officially released before you start selling it. 'his means that you create a state of the
software in your repository, ensure that it has been tested for functionality and the code is fro)en. A version
number is assigned to the released software. After releasing, development may continue but it will not make
any change in the released software. 'he development is often carried on in a new branch and it may contain
-
8/18/2019 Stage 2module 1
13/104
new features. 'he released software is updated only if a bug fied version is released. Jenerally companies
assign incremental version numbers following some scheme when the net release of the software is sent to
market. 'he version number change depends on whether the new software contains a ma(or change to the
previous version or it contains bug fies and enhancement to the eisting functionality. #oftware releases are
also important because they are typically compiled versions of a particular code version, and thus provide a
stable set of binaries for testing.
1. ?ranches 3 "n almost all serious software development pro(ects, a version control system is used. 'his
system keeps a record of changes in source code files and is usually built in a tree3like structure. uring the
release of the software, the state of each file that is part of the release should be recorded. ?y creating
branches to this state, future developments can be made. #ometimes special branches may also be created
that are solely used for bug fiing.
. 6elease 8otes 3 4very software version contains release notes. 'hese are prepared by people releasing the
software version with the help of the developers. 6elease notes show what happened in this software version.
'ypically the information includes-
• ?ug fies
• 8ew functionality
• etails of new features added to the software
• Any bugs that are not yet fied
• Future enhancements
• "f a user needs a change in the configuration process, it is also mentioned
Jenerally a user must be given enough information to understand the new release enhancements and decide
whether an upgrade is required or not.
Documentation
'here are broadly three categories of documentation related to software development processes-
• 'echnical documentation developed during the development process, such as the architecture,
functional and design documents.
• 'echnical documentation prepared for technical support staff, including technical manuals that support
staff use to provide customer support.
• 4nd3user manuals and guides. 'his is the documentation for use of the end user. "t assists the user in
getting started with the product and using it.
All three types of documents are necessary for different aspects of the support of the product. 'echnical
documents are necessary for future development, bug fies, and adding new features. ocumentation for technical support staff contains information that is too complicated for the end user to understand and use. 'he
support team needs this information in addition to user manuals to provide better support to customers. Finally
each product should have the user manuals. 'echnical writers often develop user manuals which are based on
functional specifications. "n the timelines of most software development pro(ects, even before the start of code
development, functional specifications are prepared. #o the technical writers can start writing user manuals
while developers write the code. #o when the product is ready, the user manual is almost completed.
upport and ,ew Features
-
8/18/2019 Stage 2module 1
14/104
>our customers need support when you sell a product. 'his is true regardless of the si)e of the product, and
even for non3software related products.
'he most common support requests from customers are related to one of the following-
• 5elp in installation and getting started
• 'o release a patch or update to the whole product
• A new feature required by the customer
"n addition to these, you may also want to add new features to the product for the net release because
competitor products have other features. ?etter support will increase your customer loyalty and will create
referral business. >ou may adopt two strategies to add new features. >ou may provide an upgrade to the
current release as a patch, or wait till you have developed a list of new features and make a new version. ?oth
these strategies are useful depending how urgent the requirement for new features is.
2.2. -'er'iew of problem sol'ing Techni$ues
Jood problem solving skills empower managers in their professional and personal lives. Jood problem solving
skills seldom come naturallyE they are consciously learnt and nurtured. Jood problem solving skills should
include-
• developing innovative and creative solutionsE
• developing solutions which are practicalE
• showing independence and initiative in identifying problems and solving themE
•
applying a range of strategies to problem3solvingE
• applying problem3solving strategies across a range of areasE
"hat is a Problem%
A problem can be defined as an opportunity for improvement. O4very problem has a gift for you in its hands,P
says 6ichard ?ach. An optimist looks at challenging or problematic events as potential opportunities for
improvement. 5e will be always seeking answers for the questions such as-
• "s there more than one probortunityK B!robortunityP Q a synonym by combining the words OproblemP
and OopportunityP.
• "s it my personal probortunity or "s it the probortunity of the organi)ationK
• "s it an annoyance or an actual probortunityK
• "s this the real probortunity, or merely a symptom of a larger oneK
A problem can be defined as the difference between the actual state and the desired state. A problem could
also be the result of the knowledge that there is a gap between the actual and desired or ideal state of
ob(ectives. Clarity of the problem is determined by the clarity of the knowledge which one precisely wants and
which one has. Jreater clarity of the problem will help in finding a better and an effective solution.
-
8/18/2019 Stage 2module 1
15/104
A problem can also result from the recognition of an imperfect present and the belief in the possibility of a better
future. 'he belief that one7s hopes can be achieved will give one the will to aim towards a better future.
e# approaches to Problem sol'ing
'here are different ways of problem solving Q each has its own advantages and disadvantages. 'he process
an individual adopts as a manager will be influenced by organi)ational policies, his9her own personality andcommunication style, and the kind of information available about the problem. ?roadly, there are two problem
solving models available to a manager.
). 0ational Problemol'ing
6ational problem solving rests on the following principles *6. N. Wagner 3 O2earning to solve practical
problemsP+-
• !roblems are identified by comparing actual performance with an epected standard performance
• !roblems are deviations in actual performance from the epected standard
• A precise and complete description of the problem is needed to identify a solution
• What is happening?
• Where is it happening?
• When is it happening?
• To what extent is it happening?
• 'he cause of the problem can be found by comparing the problem and non3problem situations.
• 6ecent problems are due to some change in the situation that has caused an unwanted deviation from
epectations.
'he 6ational ecision3aking model requires the following steps, which if followed, are assumed to lead to
Bvalue3maimising choices.B 'hese steps are as follows-
• need to define the problem,
• identify the decision criteria,
• weigh the criteria which can be used to determine rank of importance,
• generate alternative solutions,
• rate each alternative on a different criteria, and
• compute the optimal decision.
5. &ateral or Creati'e Problemol'ing
2ateral or creative problem solving does not follow any standard set of procedures. "t is a Rsubconscious
process based on past distilled eperiencesL. "t is based more on the gut feeling of the manager than on an
ob(ective process of weighing alternatives.
'here are a set of conditions and it is accepted that under those conditions intuitive approach is generally
preferred to rational approach. "ntuitive method is preferred when-
• there is a high level of uncertainty,
-
8/18/2019 Stage 2module 1
16/104
• little precedence to draw on eists,
• variables are not that easily predictable,
• facts are limited or facts are contradictory,
• analytical data is not of much use,
• there are several plausible solutionsE and
• decision needs to be made in a short period of time
'he creative9lateral problem solving is very fleible. #o it can be used to eamine real problems and issues.
Problem sol'ing process
'here are a variety of problem3solving processes. ?ut each process consists of a series of steps Q which
include identifying the problem, searching for possible solutions, selecting the most optimal solution and
implementing a possible solution. "t is useful to view problem solving as a cycle because, sometimes, a
problem needs several attempts to solve it or at times the problem itself changes. 'he diagram below shows a
seven3step problem solving process.
2.1 : Seven-Step Problem Solving Process
1. dentif#ing the Problem6 'he first step in the problem solving process is si)ing up the situation to identify
the problem. 'his may sound simple enough, but sometimes managers might be uncertain about even what the
problem isE they might (ust be feeling anious or be confused about what is getting in the way of their
ob(ectives. "f that is the case, they can ask themselves or consult with their friends or a professional epert.
@ther useful techniques for identifying the problem include3
• Comparison with others
• onitor for weak signals
• ?rainstorming
• Checklists
• Comparison of current performance with ob(ectives or past performance
• 2isting complaints S role playing
. 78ploring the Problem- 5aving identified the problem, managers should analy)e the problem to see what is
the root cause for it. @ften people get caught up in symptoms or effects of a problem or issue and never drilldown to the real cause. 'hey get mad at someoneLs attitude, anger, or actions, which is not the real cause of
the problem. 'he key here is to focus on analy)ing the problem for the real root cause without being affected by
emotional issues. #eeking answers to questions such as the following will help eplore the problem-
"dentify the !roblem Q Ask WhoK
• Who says that this is a problemK
• Who caused or is causing the problemK
-
8/18/2019 Stage 2module 1
17/104
• Whom does it or will it affectK
• Who has done something about the problemK
"dentify the !roblem Q Ask WhatK
• What happened or will happenK
• What are the symptomsK
• What are the consequences for othersK
• What circumstances surround the occurrence of the problemK
• What is not functioning as desiredK
"dentify the !roblem Q Ask WhenK
• id it or will it happenK
• Why did it happenK
• When did it first occurK
"dentify the !roblem Q Ask WhereK
• Where is the problem occurringK
• id it or will it have an impactK
• Where did it have an impactK
"dentify the !roblem Q Ask WhyK
• Why is this, a problemK
• id it or will it occurK
• Why did it occurK
• Why was nothing done to prevent the problem from occurringK
• Why did no one recogni)e and do something about the problem at the earliestK
• Why is a response needed nowK
"dentify the !roblem Q Ask 5owK
• 5ow should the process be workingK
• 5ow are others dealing with this or similar problemsK
• 5ow do you know this is a problemE what supporting information do you haveK
@nce the root cause is found, plans can be made to fi it. Analy)ing implies gathering information. "f there is not
enough information, they should find some ways to research and collect it.
/. et oals- 5aving eplored and analy)ed the problem, managers should be able to write a goal statement
that focuses on what is the successful end of the process. @nce the root cause is found, plans can be made to
fi it. Analy)ing implies gathering information. "f there is not enough information, they should find some ways to
research and collect it.
-
8/18/2019 Stage 2module 1
18/104
aking and writing down a goal statement will-
• help them to clarify the direction to be taken in solving the problemE and
• give them something definite to focus on
'hat is, what will occur as a result of the solutionK 'his whole process is about fiing or closing the gap
between the problem and the goal. Writing down the problem ensures that they are not side3tracking from, but
addressing the problem.
0. &ook at alternati'es- 8ow that the problem has been analy)ed, the managers can start developing possible
solutions. 'his is a creative as well as practical step where every possible solution needs to be identified. 'hey
should identify the various alternative solutions available to them through techniques such as Q
• Analysis of past solutions
• 6eading
• 6esearching S thinking
• iscussing
• Asking Muestions
• Diewing the problem with fresh eyes
• #leeping on it
• ?rainstorming
'he idea is to collect as many alternative solutions as possible. ind mapping is another technique that can be
used for finding alternative solutions. ind mapping uses pictures and9or word phrases to organi)e and
develop thoughts in a non3linear fashion. "t helps people see a problem and its solution.
5ereLs how to do mind mapping-
• 'ake a sheet of plain paper and turn it sideways *if using flipchart paper you donLt need to turn it
sideways 3 it is large enough+E Hsing colored felt pens, draw a small picture *or write a phrase+ in the
centre of the paper representing the issue you want to solveE raw lines out from the main problem *it
helps to use different colors for each line+.
• 4ach line should represent a different aspect of your problem or issueE
• Write down what each line represents either on top of or on the lineE
• Add other lines flowing off these main linesE
• Write a word or short phrase on the smaller lines indicating what each new line represents *you mayfind that mind mapping works best for you if you write down the phrases or draw the images first and
then connect them with the lines+E and
• "f you want, add images net to your main line that illustrate what each line means to you *some
people think better with pictures, others with words+.
. elect the best solution- 8ow that there are a wide variety of possible solutions available, it is time to select
the best solution from among them to fi the problem, given the circumstances, resources and other
-
8/18/2019 Stage 2module 1
19/104
considerations. 5ere the managers are trying to figure out what eactly would work best given the nature of the
problem. 'here are always a number of things that can affect a solution, for instance, money, time, resources,
procedures, rules, policies, and so on. All of these factors must be thought about. anagers should prioriti)e
the solutions by their effectiveness. 'his is a slow process of elimination. 'here may be some possible
suggestions that may need to be immediately eliminated. 4ventually, managers should narrow down the
choices to one best possible solution which will promise them the best or optimal outcomes.
G. mplementation- "mplementation is a crucial part of problem3solving process. "n order to implement the
solutions chosen, managers must have an action plan and communicate it to those people who are directly and
indirectly affected. Jemmy Allen *O!roblem3#olving S ecision3akingP+ says that communication is most
effective when it precedes action and events. "n this way, events conform to plans and events happen when,
and in the way, they should happen. anagers should answer the below vital questions before they are asked,
like Q
• What should be communicatedK
• What is the possible reason for the decisionK
• Whom all will it affect and howK
• What are the benefits epected for the individual, department, and the organi)ation as a wholeK
• What ad(ustments will be required in terms of how work will be doneK
• What is each individualLs role in implementing the decisionK
• What are the results epected from each individualK
• When does the action called for by the decision go into effectK
I. 7'aluation- 'his is the final step in the problem3solving process. anagers should review the effectiveness
of the solution against desired outcomes. Muestions like did the solution workK "f not, whyK What went right,and what went wrongK What ad(ustments do they have to make to ensure that the solution will work betterK
'his stage will require careful analysis that improves upon the best solution.
'he review of your progress can help a manager identify any problem. #teps may need to be revised or new
steps need to be added. @ne may need to consider a different solution, if the current one, with which he9she
has been, is not helping.
7ssentials of 7ffecti'e Problem ol'ing
• Clear description of the problem
• escription of the negative or limiting factors involved in the problem
• A description of the positive or the constructive factors involved in the problem
• A clear delineation of the OownershipP of the problem 3 Whose problem is it- mine, yours, the other
guyLs, my bossL, my spouseLs, my childLs, my parentsL, my teacherLsK
• #cope of the problem need to be clearly defined- 5ow etensive a problem is itK 5ow long has this
problem eistedK 5ow many people are affected by thisK
-
8/18/2019 Stage 2module 1
20/104
• A clear description of the consequences if the problem were not solved 3 What is the possible impact
on my family, (ob, life in this community, etc., if this problem isnLt solvedK What is the worst possible
thing that could happen if this problem isnLt solvedK
• A list of brainstormed solutions to the problem, with each alternative analy)ed as to its reality, its
benefits, and the consequences for following each one.
• A system of ranking each solution to finali)e the decision3making process 3 A rating system for
analy)ing each solution is developed, e.g., 1
-
8/18/2019 Stage 2module 1
21/104
installation in order to improve the eecution on the particular hardware of the system being installed
on.
• &ink time is the phase during which the names of implementations are looked up and connected
together. For instance, a program that invokes libraries does so by stating the name and an interface
of the library. uring link time the particular implementation of that interface is connected to the
program that invokes it. 'his connection can be done inside the compilation system, or during theinstallation, as a part of starting eecution, or even invoked during the process of eecution.
• &oad time is the phase in which an eecutable image is taken from its stored form, and placed into
active memory, as part of starting eecution.
• 0un time is the phase during which the behavior of the program is ehibited. 6un time is the time
during which a program is running *eecuting+, in contrast to other phases of a program7s lifecycle
such as compile time, link time, load time, etc.
• A run3time error is detected after or during the eecution of a program, but a compile3time error is
detected by the compiler before the program is ever eecuted. #torage allocation, type checking, code
generation, and code optimi)ation are typically done at compile timeE however it may be done at run
time depending on the particular language and compiler.
3.1. ntroduction to basic programming concepts
When a programmer writes a program, he9she needs to write the instructions to store, process and arrange
data. Also, instructions are required to control the flow of the program. A programmer needs to understand the
following concepts to write a program-
• What is a data type and how to use a data typeK
• What is a variable and its useK
• 5ow to control the flow of the programK
• 5ow to arrange and use a group of dataK
• 5ow to group a set of instructions into a single unitK
• 5ow to create new data typesK
A program is a sequence of instructions (written using a programming language) for
machine/computer to accomplish a task. A textual explanation of squence of instructions is called an
algorithm or pseudocode.
3.2. Datat#pes
Data and Datat#pes
!rograms need data in the form of numbers, time, names, date, description etc.
Consider a program to calculate the sum of two numbers.
-
8/18/2019 Stage 2module 1
22/104
sum $y
5ere the two numbers are the data and the type of data *numeric data3integer, decimal etc.+ is the data type. "n
more elaborate terms, a data type used in a program determines the type of data, memory needed for storing
the data, and the kind of operation that can be performed with the data *e.g. you can multiply two numbers
together, you can concatenate alphabets and make it a word and multiple words into a sentence.+
What can we infer from the figure aboveK We can see that different types of data like integer, string, date etc.
have been used in the form.
A datatype represents the type of data, memory storage and the operations that can be performed using the data.
Classif#ing data t#pes
ata types are divided into primitive and composite types. 'he primitive data types are the basic data types
that are available in most of the programming languages.
!rimitive data types are used to represent single values that include numeric types like integer or float,
boolean, character and string.
'he data types that are derived from primary data types are known as non3primitive or composite data types.
'hese data types are used to store a group of values. Composite type includes Array, #tructure, Class etc.
5asic Data T#pes
-
8/18/2019 Stage 2module 1
23/104
8umeric type is divided into "nteger type and Floating3point type. 'he table below shows the division and
eamples for numeric types-
,umeric T#pes
Datatypes are mainly classified into primite and composite types.
3.3. Introduction to variables
+ariables and Constants
'he input data needed for a program and the output data generated by the program are stored in the computer
memory. While writing a program, the programmer needs to specify the memory required for storing the data
needed for the program and generated by the program. 'he memory location where data is stored is called a
variable. 'he program can change the data in that memory location any number of times, and hence the
name.
A program also needs a memory location where it can store data but cannot alter it later. #uch memory
locations are called constant memory locations.
Consider a program that finds the area of a circle. 'he program takes radius *numeric+ as an input data to
calculate the area. When user gives the input data, the program stores it in the memory for further calculation.
-
8/18/2019 Stage 2module 1
24/104
'he program also stores the result *area of circle+ after calculation. 'his means that the program uses at least
two memory locations *two variables+E one for storing the input *radius of circle+ and one for storing the result
*area of circle+. >ou know that !i is a constant and has a fied value */.10+. "n this program the value of !i can
be stored as a constant because the program cannot alter the value of !i.
Program teps6
• eclare a variable radius to store radius of the circle.
• eclare a variable area to store the area of the circle.
• eclare a constant !i to store the constant value.
• Calculate the area of circle * !iU radiusU radius+.
• #tore the result in variable area.
A variable is a memory location whose value can change throughout the operation of a program. A constant is a
memory location whose associated value cannot be altered by the program during its eecution.
)ctions using +ariables
Following are the actions that a programmer can do using a variable-
• eclaring or creating a variable
• "nitiali)ing a variable
• #toring data to a variable
• 6etrieving or fetching data from a variable
Declaring or Creating a 'ariable
'o declare or create a variable, the programmer needs to select an appropriate data type and a meaningfulname for the variable. 'he data type must be used only while declaring a variable.
'he general format for declaring a variable is -
ata-t!pe variable-name"
#g: int counter" String name"
-
8/18/2019 Stage 2module 1
25/104
nitiali9ing a 'ariable
"nitiali)ing a variable means putting an initial value to the variable*bucket+. A variable can be initiali)ed while
creating or declaring it.
#g: int counter$%" char gener$&'&"
toring data to a 'ariable
@nce a variable is created, data can be stored in the variable. An assignment operator*+ is used in theprogram to store data to a variable. 'he initial value of the variable can be changed by assigning a new value
using the assignment operator*+.
counter $ 1%"
gener $ (F)"
0etrie'ing or fetching data from a 'ariable
'o retrieve or fetch data from a variable, use the name of variable.
int 1
-
8/18/2019 Stage 2module 1
26/104
int sum $yE
"n the above program statement, the names of the variables * and y+ are used to retrieve the values stored in
the variables.
Always initiali!e a ariable while declaring or after declaring it.
3.4. ntroduction to -perators
@perators are special symbols that perform specific operations on one or two operands, and then return a
result.
Consider a program that does mathematical operations like addition, subtraction, multiplication, division on two
numbers. *'he program needs two variables to hold the two numeric values.+
int num1 E 99 declares a variable num1 of type int to store the first numeric data.
int numE 99 declares a variable num of type int to store the second numeric data.
int resultE 99 declares a variable result of type int to store the result after operation.
result num1 $ numE 99 add num1 and num and store the sum in variable result.
"n the above program statements, num1 and num are the operands and $ is the operator. 'he sum of num1
and num is stored in the variable named result.
@perators can be classified into unary and binary operators. Hnary operators are the operators that deal with
only one operand *one variable+. ?inary operators are the operators that deal with two operands *variables or
constants+.
2inks for reference-
http-99msdn.microsoft.com9en3us9library9
-
8/18/2019 Stage 2module 1
27/104
http-99docs.oracle.com9(avase9tutorial9(ava9nutsandbolts9operators.html
"perators are special symbols that perform specific operations on one or two operands, and then
return a result.
3.!. Control structures
ntroduction
A program is a set of instructions or commands given to a computer to do a specific activity or task. 'he normal
eecution flow of program statements will be sequential. #ometimes the sequential flow should be altered
because of some conditions which change the flow.
For eample, every day a person drives his car from city A to city ? through a straight national highway to reach
his office. @ne day, there is a big traffic (am on the way to city ?. "f the person wants to reach city ? then the he
has to select an alternate route. 5ere changing route is equal to changing the flow of program *controlling the
flow+ and the decision of selectiing an alternate route will be based on some parameters like distance or
condition of the road.
#ontrol structures help to control the flow of a program.
T#pes of control structures
#equence, #election and 6epetition *"teration+ are the three main control structures used to control the flow of
program in any programming language.
http://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.htmhttp://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.htm
-
8/18/2019 Stage 2module 1
28/104
e$uence6
#tatements in the program will be eecuted one3by3one from the first to the last statement.
election6
'he selection control structure allows one set of statements to be eecuted if a condition is true and another set
of statements to be eecuted if a condition is false.
'he following are the common selection control structures use in programming languages.
• if
• if3else
• switch
0epetition
4ecuting one or more steps of an algorithm or program based on some condition. 'he repetition control
structure is also known as the looping or iteration control structure.
'he following are the common looping control structures use in programming languages.
• while
• do3while
• for
$equence, $election and %epetition (&teration) are the three main control structures used to control the
flow of program.
3.:. ntroduction to )rra#s
ntroduction
-
8/18/2019 Stage 2module 1
29/104
ost of the programs deal with a group9collection of data. For eample, list of bank account numbers, eam
scores, country names etc. ata could be primitive like integer or composite like ate.
!rogram needs to arrange and manage these groups of data. All programming languages provide one basic
data structure named array, that helps to store and manage a group of data.
An array helps to store a collection of data *elements+. 2ike the numbering used in the above diagram, array
uses an inde to represent the location of each independent data stored in it.
'he main ability of an array is to represent a group of data using a single name and accessing each individual
data stored in it using an inde. "n programming world, starting inde of an array will always be )ero.
Arrays can be one dimensional, two dimensional or multi3dimensional. 'he figure given above can be looked
upon as a single dimensional array having a single row with 11 columns *< Q 1< seats+.
Consider a program that needs to store the names of all the students participating in a qui) program. 'he input
data for the program is-
-
8/18/2019 Stage 2module 1
30/104
• 8umber of students participating in the qui)
• 8ames of the students
We need a variable to store the number of students and an array to store the names of students.
int count" **variable to store number o+ stuents
String name,rra!count" ** arra! to store names o+ stuents
An array is used to store a group of data of similar type.
Create and se an )rra#
Creating and initiali)ing an array
'he general format for creating and initiali)ing an array is given below.
atat!pe arra!/name $ 0value1 value 2 value3"
#g. int nums/arra! $011 22 44553 "
)rra# Creation
)dding elements into an arra#
After creating an array, data can be added to it. For adding data to an array use the inde of the array. 'he
general format for adding elements to an array is given below.
arra!/nameinex $ value"
#g. nums/arra!% $ 66"
6etrie'ing data from an arra#
Hse array inde to retrieve data from an array.'he general format of accessing data from an array is given
below-
variable/name $ arra!/nameinex"
#g. num1 $ nums/arra!4"
)rra# creation e8ample
Consider a program that stores the scores of the participants who attended a qui) and calculates the average
score of all participants.
'he type of data*qui) score and average score+ which we need to use in this program is numeric.
"f the selected programming language is %ava9C9C$$, then we can select int or float as numeric type. 2etLs
select int for individual score and float for average score.
-
8/18/2019 Stage 2module 1
31/104
Assume the total number of participants as 1
-
8/18/2019 Stage 2module 1
32/104
Functions are a named group of instructions that perform a specific task.
Defining a function
!he following "uestions help to define a function#
• $hat specific task needs to be performed by the function %body&'
• $hat are the inputs %arguments(parameters& needed by the function to complete its task'
• )oes function return any result' If it returns, what kind of result %data& does it return'
Each function has two parts, header and body. Function header specifies the name of the
function, input parameters and the output type. !he function body contains the logic of thefunction.
!he general format of a function is as follows.
return_type functionName( [datatype parameter1, datatype parameter1, …]){
// function body
*
+ere returntype means the type of data%numeric , -tring,& the function will return after
executing the logic in the body part. If the function does not return any data but performs a task,
then the return type will be void %means no returnvalue&.
Example:Function definition
-
8/18/2019 Stage 2module 1
33/104
Function Examples
Example/# Function that takes an input, performs a task and returns a result.
Example0# Function that takes an input, performs a task and returns no result.
Example1# Function that takes no input, performs a task and returns a result.
-
8/18/2019 Stage 2module 1
34/104
Example2# Function that takes no input, performs a task and returns no result.
void alert(){
sendAlertessa!e(" #o$ %esource&)'
!he function alert takes no input, but performs a task via a function sendAlert3essage%& anddoes not return any output.
Calling/Invoking a function
!he main function should know the name of the sub function and the arguments(inputs needed
by the sub function to invoke(call the sub function.
!he common syntax for invoking a sub function is#
functionname([ar!uments]) ' or
result function_name([ar!uments])' //store result in a variable, if function return some data
• float result 4 avg%/5,05,15&6
• int count4 get7ount%&6
• alert%&6
• store%8+appy 9:day;&6
3.8. Composite Datatpes
ntroduction
!rograms not only use primitive data types but also composite data types like ate, #tring, 4mployee, #tudent
etc. Composite data types are constructed using primitive data types and other composite data types.
Composite data types can be built3in data types *e.g. #tring or ate+ or programmer defined data types *e.g.
#tudent, 4mployee+.
Consider a program that stores the details of a group of students. 5ere each student has data like "d, name,
age, college, stream, and grade.
-
8/18/2019 Stage 2module 1
35/104
'he program requires-
• A new data type, which represents a student
• An array, which can store the student details
Defining data t#pe
4very programming language provides a way to define and use composite data types.
C programming language provides keywords like typedef and struct to define a composite data type. @b(ect
oriented programming language like %ava provides a keyword named Class to create a composite data type.
C program
t!pee+ struct 0
int i"
char name5%" ** language use character arra! as string
char college1%%"
char stream25
char grae"
3 Stuent"
;a'a program
class Stuent0
int i"
String name"
String college"
String stream"
char grae"
3"
?oth these programs define a new type #tudent, where "d, name, college, stream, grade are the members
*data members+ or properties of #tudent type.
Creating a 'ariable of composite t#pe
Composite variables are created like primitive variables. A composite variable consists of a fied number of
variables Bglued togetherB.
'he eample below shows how to declare and initiali)e composite variables.
Stuent stu1 $0 1%% @AohnB BSCBB#B),)3" **structure in
Stuent stu2 $ new Stuent9 1%1BDohitBB'7TBBSB),)
-
8/18/2019 Stage 2module 1
36/104
)ccessing data members
A special operator named dot operator *.+ is used to access data member of a composite data.
5ere stud1 and stud are variables that store composite data.
char name $ stu1.name"
String college $ stu2.college
#omposite ariable consists of a fixed number of ariables glued together.
4.1. ntroduction to De'eloping a ser nterface
ntroduction
'o work with a system, the users have to be able to control and assess the state of the system. For eample,
when driving a vehicle, the driver of the vehicle uses the steering to control the direction, and the accelerator
pedal, brake pedal and gears to control the speed of the vehicle. 'he driver understands the position of the
vehicle by looking through the windshield and the eact speed of the vehicle by checking the speedometer. 'he
driver7s interface of the automobile is on the whole composed of the instruments that the driver can use to
accomplish the tasks of driving and maintaining the automobile. "nteractive entities must constantly be
designed to support the way in which humans interact with the world and information.
-
8/18/2019 Stage 2module 1
37/104
"n information technology, the user interface is everything designed into an information device with which a
human being may interact 33 including the monitor, keyboard, mouse, the appearance of a desktop, characters
in tet, help messages, and how an application or a Web site invites interaction and responds to it. "n the
previous generations of computers, there was very little user interface ecept for a few buttons at an operator7s
console. 'he user interface was mainly in the form of punched card input and report output.
2ater, a user was provided with the ability to interact with a computer online and the user interface was a nearly
blank display screen with a command line, a keyboard, and a limited set of commands and computer
responses that were echanged. 'his command line led to a new form of interface in which menus *list of
choices written in tet+ predominated. 4ventually, the graphical user interface *JH"+ arrived, originating
predominantly in Zero7s !alo Alto 6esearch Center, adopted and enhanced by Apple Computers, and finally
standardi)ed effectively by icrosoft in its Windows operating systems.
'he user interface can, essentially include the total Buser eperience,B which may include the aesthetic
appearance of the device, response time, and the content that is presented to the user within the contet of the
user interface.
Different t#pes of ser nterface
'he three most common types of Hser "nterfaces are-
• Command 2ine "nterface *C2"+
• Jraphical Hser "nterface *JH"+
• Web Hser "nterface *WH"+
5owever, a few other types of Hser "nterfaces also eist
• 'ouch Hser "nterface*C2"+
•
Doice Hser "nterface
Command &ine ser nterface6
"n a command line user interface, the user provides the input by typing a command string with the computer
keyboard and the system provides output by printing tet on the computer monitor. 'his is normally used by
programmers and system administrators, and by technically advanced personal computer users.
A good eample of command line user interface is the windows command prompt, as seen in the image below.
'he advantages of using a command line user interface are-
• Consumes low bandwidth Q As the command line interface is devoid of any graphics or etra data,
this is especially useful in a networked environment where network traffic is to be limited.
• )ppeals to e8pert users Q as the commands relevant to a particular task give information about that
task only, any other etra data9information that could potentially cause a distraction to the user are
easily avoided.
-
8/18/2019 Stage 2module 1
38/104
5owever this type of user interface poses the following disadvantages too-
• &earnabilit# and 0etention of commands is generall# poor Q this is especially applicable to non3
epert users, who would find learning and remembering individual commands of each task difficult.
5ence they won7t be comfortable with the command line interface.
• ,ot 'er# user friendl# and hence error rates are high Q especially when a user is trying to enter
data. A mistake made in typing while using command line is often not forgiven. 'hat is, a user is
usually not warned or prompted for confirmation while using direct commands in the command line.
5ence chances of wrong data being entered are very high.
raphical ser nterface
-
8/18/2019 Stage 2module 1
39/104
cons 3 #mall pictures that represent windows, files or commands. ?y moving the pointer to the icon and
clicking the mouse button, you can convert the icon into a window or eecute a command. >ou can also move
the icons around the display screen as if they were real ob(ects on your table.
"indows 3 >ou can divide the screen into different areas. "n each window, you can display a different file or run
a different program. >ou can change the si)e and shape of the windows and even move them around the
display screen at will.
(enus 3 ost graphical user interfaces let you eecute commands by selecting a choice from a menu.
Toolbars 3 6epresent a group of buttons that perform related functionality and generally have icons over them
instead of tet.
Hse of JH" over Command line user interface provides us with the following benefits-
ncrease in producti'it# Q for normal users, there is no need for any specific training for the users to start
using a well designed JH". 'he users do not need to learn or remember any commands to effectively use a
JH".
Decrease in training cost and support line cost
-
8/18/2019 Stage 2module 1
40/104
4.2. "hat is the need for a good "hat is the need for a good %
For most of the end users, Hser "nterface is the #ystem. 5ence the look and feel that a Hser "nterface provides
is one of the ma(or factors that decide the Hser #atisfaction and Hser 4perience. For eample, if cost isn7t a
factor for the same function *of making calls+, which one out of the two phones below would you preferKK
A remarkably good Hser "nterface esign can act as the difference between product acceptance and re(ection
in the marketplace.
A cumbersome, not easy to learn9 use H" in an otherwise ecellent product could result in the failure of that
product. Jood Hser "nterface can make a product easy to understand and9or easy to use, which results ingreater user acceptance. !oor user interface is the reason why many software systems are never even used.
A badly designed user interface can cause a user to make catastrophic errors.
'he best eample of this from real world is the B?utterfly ?allotB used in !alm ?each, Florida during the
-
8/18/2019 Stage 2module 1
41/104
"f the designers of that ballot understood the basics of user interface design, there may very well have been a
different outcome to the election.
4.3. 5asic steps to be followed for de'eloping a good %ust like customers form perceptions about the company by looking at its office or retail shop, in case of the
internet world, a good3looking website is the first eperience that your customers have with a brand online. 5ow
they perceive the brand is likely to be influenced quite significantly by the quality of the H" and the overall
eperience of the online property.
Hsers do not care much about what is underneath. ?ut they are actually influenced a lot by what they
eperience, what they feel, and what they see. "n other words, it is the design quality that essentially affects the
business results.
Jood design and user interface not only impact the consumers, but also influence the decision of potential
investors.
From a non3designer7s perspective, well thought3out and eecuted design is subtle, yet very powerful. !roduct
Hser "nterface *H"+ and Hser 4perience Q regardless of the software, mobile, or web, the 4ase of Hse is one of
the biggest key factors for its popularity.
'he below pointers must be taken into consideration when designing a good Hser "nterface-
Consistenc# 3 'he most important thing you can possibly do is to ensure that your user interface works
consistently. For eg., if you can double3click on items in one list and produce a certain action, then you should
-
8/18/2019 Stage 2module 1
42/104
be able to double3click on items in any other list and have the same kind of action to happen. !lace your
buttons in consistent places on all the windows, use the same kind of wording in labels and alert messages,
and use a consistent theme of colors throughout. Consistency in your user interface makes it easier for the
user to get used to the interface quicker.
5e prepared to hold the line 3 When you are developing the user interface for your system you will discover
that your stakeholders often have some unusual ideas as to how the user interface should be developed. >ou
may, of course, listen to these ideas but you also need to make your stakeholders aware of your corporate H"
standards and the need to conform to them.
,a'igation between ma/or pages 3 "f it is difficult to move from one screen to another, then the users of your
website will obviously become frustrated and give up. When the flow across screens matches the flow of the
work the user is trying to accomplish, it becomes easier for the users. ?ecause different users work in different
ways, the system needs to be fleible enough to support their various approaches.
"ording the messages and labels effecti'el# 3 'he tet displayed on the screens is a primary source of
information for the users of the web application. "f the tet is worded inappropriately, then the interface will be
perceived poorly by the users. Hsing full words and sentences, as against codes and abbreviations, makes the
tet easier to understand. essages should be worded positively, implying that the user is in control, andproviding insight into how to use the application properly. For eample, considering the two messages ahead
which one do you find more appealingK OAn account number should be eight digits in lengthP or O>ou have input
the wrong information.P 'he messages should also be worded consistently and displayed in a consistent place
on the screen. Although the messages O'he personLs first name must be inputP and OAn account number should
be inputP are worded well when looked at separately, however, together they are inconsistent. A better wording
of the second message would be O'he account number must be inputP to make the two messages consistent.
se color appropriatel# 3 Color should be used sparingly in the webpages and, if used, a secondary indicator
must also be used. 'he problem is that some of the users may be color blind and if color is used to highlight
something on a screen, then something else must be done to make it stand out for those users to notice it.
Colors must be used consistently, so as to have a common look and feel throughout.
Follow the contrast rule 3 "f you are going to use color, you need to ensure that your screens are still
readable. 'he ideal way to do this is to follow the contrast rule- Hse dark tet on light backgrounds and light tet
on dark backgrounds. 6eading dark blue tet on a white background is easy, but reading blue tet on a dark
red background is difficult. 'he problem is that of enough contrast not eisting between blue and red to make it
easy to read, whereas there is adequate contrast between blue and white.
78pect #our users to make mistakes 3 5ow many times have you accidentally deleted some tet in one of
your files or deleted the file itselfK Were you able to recover from these mistakes or were you forced to redo
hours, or even days, of workK 'he reality is that to err is human, so you should design your user interface to
recover from mistakes made by your users.
Don>t create crowded user interfaces Crowded screens are difficult to understand, and, hence are difficult to
use. Hsers would not be interested in working with a busy9crowded webpage than one with limited
functionalities spread neatly across the page. %ust think whether Joogle.com would7ve got all the popularity if it
had not started out as a page with a simple search functionK
roup things effecti'el# 3 "tems that are logically connected should be grouped together on the screen to
communicate their connection, whereas items that have nothing to do with each other should be separated.
>ou can use spaces generously between collections of items to group them and9or you can put boes around
them.
-
8/18/2019 Stage 2module 1
43/104
5asic tools
-
8/18/2019 Stage 2module 1
44/104
[p\y dog ate [b\all[9b\ the guacamole.[9p\
When displayed, this looks like the figure above.
#ome elements do not contain other elements. For eample, the image tag *B[img\B+ simply specifies the file
name of the content *an image+ as an attribute- [img srcBsmileyface.(pgB\
@ften a forward slash is placed before the final angle bracket to indicate the end of the tag. "n 5'2 this is
optional, but required in Z5'2 *which is an Z2 schema that implements 5'2 elements+.
*T(& 7lements ? the basic building blocks
5'2 consists of a set of elements. 'hese elements define the semantic meaning of the content. 4lements
include everything between two matching element tags, including the tags themselves. For instance, the B[p\B
element indicates a paragraphE the B[img\B element indicates an image.
#ome elements have very precise meaning, as in Bthis is an image,B Bthis is a heading,B or Bthis is an ordered
list.B @thers are less specific, such as Bthis is a section on the pageB or Bthis is part of the data.B Whereas some
others are used for technical reasons, such as Bthis is identifying information for the page that should not be
shown.B 6egardless of the reason, in one way or another all 5'2 elements have a semantic value.
ost elements may contain other elements, forming a hierarchic structure. A complete but a very simple web
page looks like this-
[html\
[body\
[p\y dog ate all the guacamole.[9p\
[9body\
[9html\
As you can see, [html\ elements surround the rest of the document, and [body\ elements surround the page
content. 'his structure is often thought of as a tree with branches *in this case, the [body\ and [p\ elements+
growing from the trunk *[html\+. 'his hierarchical structure is called the D-(6 the Document -b/ect (odel.
*T(& Tags
5'2 documents are written in plain tet. "t can be written in any tet editor that allows content to be saved as
plain tet *although most 5'2 authors prefer to use a speciali)ed editor that highlights synta and shows the@ structure+. 'ag names may be written in either upper or lower case. 5owever, the W/C *the global
consortium that maintains the 5'2 standard+ recommends using lower case *and Z5'2 requires lower
case+.
5'2 attaches special meaning to anything that starts with the less3than sign *B[B+ and ends with the greater3
than sign *B\B+. #uch markup is called a tag. 5ere is a simple eample-
[p\'his is tet within a paragraph.[9p\
-
8/18/2019 Stage 2module 1
45/104
"n this eample there is a start tag and ends with a closing tag. Closing tags looks the same as the start tag but
also contain a forward slash immediately after the leading less3than sign. Almost all the elements in 5'2 are
written using both start and closing tags. 'he starting and closing tags should be appropriately nested, that is
closing tags should be written in the opposite order of the start tags. !roper nesting is the one rule that must be
obeyed in order to write valid code.
'his is an eample of valid code-
[em\" [strong\really[9strong\ mean that[9em\
'his is an eample of invalid code-
"nvalid- [em\" [strong\really[9em\ mean that[9strong\
8ote that in the first eample, the closing tag for the nested element is placed before the closing tag for the
element in which it is nested.
#ome elements do not contain any tet content or any other elements as such. 4mpty elements such as these
need no closing tag. ?elow is an eample-
[img srcBsmileyface.(pgB\
any people mark up such empty elements by using a trailing forward slash *which is mandatory in Z5'2+.
[img srcBsmileyface.(pgB 9\
"n 5'2 this slash has no technical functional significance and using it is a pure stylistic choice.
)ttributes
'he start tag may contain additional information, as in the below eample. #uch information is called an
attribute. Attributes usually contains parts-
• An attribute name.
• An attribute value.
A few attributes can only have a single value. 'hey are ?oolean attributes and may be shortened by only
specifying the attribute name or leaving the attribute value empty. 'hus, the below / eamples have the same
meaning-
[input requiredBrequiredB\
[input requiredBB\
[input required\
Attribute values that consist of a single word or number may be written as they are, but when there are two or
more strings of characters in the value, it must be enclosed within quotation marks. ?oth single and double
quotes are allowed. ost web developers prefer to always use quotes to make the code less ambiguous to the
eye and to avoid mistakes. 'he below code includes such a mistake-
[p classBfooB bar\ *?eware, this probably does not mean what you think it means.+
"n the above eample the value of class was supposed to be Bfoo barB but since there were no quotes the code
is interpreted as if it had been written like this-
[p classBfooB barBB\
-
8/18/2019 Stage 2module 1
46/104
,amed Character 0eferences in *T(&
8amed character references *often casually called entities+ are used to print characters that have a special
meaning in 5'2. As seen earlier, 5'2 interprets the less3than and greater3than symbols as tag delimiters.
When you want to show a greater3than symbol in the page, a named character reference can be used. 'here
are four common named character references one must know-
SgtE denotes the greater than sign *\+
SltE denotes the less than sign *[+
SampE denotes the ampersand *S+
SquotE denotes double quote *B+
'he above four are the most important,