Software Development 1 – Tutorial for Week 1
21 pages
English

Software Development 1 – Tutorial for Week 1

-

Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
21 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

Software Development 1 – Week 1 Using the Labs and an Introduction to Programming 1. Introduction When you have read through this and completed all of the tasks, you should be able to:  Use the specialist computing lab computers  Use commands from a Windows command prompt  Edit, compile and run small computer programs  Understand what the term compile means and the steps needed to turn a file produced in a text editor into a program that you can run on the computer.  Start to gain an insight into the common parts of all C# programs I suggest reading through the entire tutorial before starting it to ensure you know what tasks you will be performing and their relevance to later tasks. It is important that you complete all parts of this tutorial before the lecture next week. Note. If you wish to do these exercises on your computer at home as well, you will need to install Microsoft Visual Studio 2008 on your home computer. See the Module Handbook for Software Development 1 for information on how to obtain a copy of Visual Studio 2008. Instead of Notepad++, you can use any text editor (for example, Notepad). Do not attempt to use a word processor such as Word since this puts extra formatting controls in the file which will give you unpredictable results. If you want to use Notepad++ at home, instructions on how to obtain it can be found in the Module Handbook. Week 1 - 1 - 4CC050 Software Development 1 2. Using the Command Prompt 2.1 ...

Informations

Publié par
Nombre de lectures 16
Langue English

Extrait

Software Development 1 – Week 1
Using the Labs and an Introduction to Programming
1. Introduction
When you have read through this and completed all of the tasks, you should be able to:
 Use the specialist computing lab computers
 Use commands from a Windows command prompt
 Edit, compile and run small computer programs
 Understand what the term compile means and the steps needed to turn a file
produced in a text editor into a program that you can run on the computer.
 Start to gain an insight into the common parts of all C# programs
I suggest reading through the entire tutorial before starting it to ensure you know what
tasks you will be performing and their relevance to later tasks.
It is important that you complete all parts of this tutorial before the lecture next
week.
Note. If you wish to do these exercises on your computer at home as well, you will need
to install Microsoft Visual Studio 2008 on your home computer. See the Module
Handbook for Software Development 1 for information on how to obtain a copy of
Visual Studio 2008.
Instead of Notepad++, you can use any text editor (for example, Notepad). Do not
attempt to use a word processor such as Word since this puts extra formatting controls in
the file which will give you unpredictable results. If you want to use Notepad++ at
home, instructions on how to obtain it can be found in the Module Handbook.

Week 1 - 1 - 4CC050 Software Development 1 2. Using the Command Prompt
2.1 What is the Command Prompt?
Many of you will not have used a Windows command prompt before. If you have, then
you will be able to work through this section quickly. If not, this section will provide you
with the basic information you need and tell you how to obtain further information.
Note. Some people refer to the command prompt as the DOS box. This is because the
commands look like the old MS-DOS or PC-DOS commands and you can run some old
DOS programs. However, this is misleading. The command prompt simply provides you
with another way of running Windows applications and performing administrative tasks.
You can run any Windows application from a command prompt and do virtually
everything you can do in the graphical user interface using text-based commands. The
reason it is better to use a command prompt here is because you will be running
commands that require parameters and you will need to see the results of running the
commands. This is easier to do from a command prompt.
The normal command prompt can be accessed from the Windows Start menu by selecting
All Programs->Accessories->Command Prompt. You could do this, but you would
need to change some environment settings on the computer in order to run some of the
programs you will need, such as the C# compiler. Fortunately, a customized version of
the command prompt is provided with Visual Studio 2008 that you can use. This is the
version you will be using in the labs.
To run the Visual Studio command prompt, select the following from the Windows Start
menu:
All Programs->Languages->Microsoft Visual Studio 2008->Visual Studio Tools->Visual
Studio 2008 Command Prompt
as seen in figure 1.

Figure 1 – Starting the Visual Studio 2008 Command Prompt
Be careful which Command Prompt you select since, as you can see, there are three
different command prompts that can be selected from that menu.
Week 1 - 2 - 4CC050 Software Development 1 A Visual Studio 2008 command prompt window will open that is similar to figure 2.

Figure 2 – The Visual Studio Command Prompt
A flashing cursor indicates where you can type commands. The prompt always tells you
which disk drive and folder you are currently on. In figure 1, you can see that it is
currently on drive C in the folder Program Files\Microsoft Visual Studio 9.0\VC
1.2 Using a Different Disk Drive
The first thing you need to do is change the drive you are using. In the labs, you are not
able to save any files to drive C. All of your files must be saved to drive T. This is the
disk space allocated to you on the server.
If you are at home, you could save your files to this folder on drive C, but it is not
recommended. It would be better to create a new folder on the C drive using the
commands described below.
To change to drive T, type the following at the prompt and press Enter:
t:
To change to a different drive, you always enter the drive letter, followed by a colon
(“:”). Note that it doesn‟t matter whether you use lower case or upper case in the
commands – they are not case-sensitive. The command prompt should now look like
figure 3.
Week 1 - 3 - 4CC050 Software Development 1
Figure 3 – Changing to a different disk drive
In the next steps you will use the following Windows commands:
MKDIR or MD Create a folder
CHDIR or CD Change folder
DIR List the contents of a folder
You can see that there are two versions of some commands. For many Windows
commands, there are long names (such as MKDIR) and short names (such as MD). For
the rest of this tutorial you will see the short names used, but you can use either.
1.3 Creating a Folder
You are currently in the root folder of drive T. In order to organise your files, you should
create folders for different modules. In this section, you will create a folder called
Year1. Inside that, you will create a folder called SoftwareDevelopment1.
To create the folder Year1, type the following and press Enter:
md Year1
Next, to move into the folder, type the following and press Enter:
cd Year1
Your console window should now look like figure 4.
Week 1 - 4 - 4CC050 Software Development 1
Figure 4 – Creating and moving into a new folder
You can see that the prompt indicates that you are in the Year1 folder. Now, to create the
SoftwareDevelopment1 folder and move into it, type the following (pressing Enter after
each command):
md SoftwareDevelopment1
cd SoftwareDevelopment1
The prompt should now indicate that you are in the folder you just created,
T:\Year1\SoftwareDevelopment1.
You will notice that neither of the folder names contained any spaces (i.e. you used
“SoftwareDevelopment1” rather than “Software Development 1”. This was because the
use of spaces in folder and file names can lead to problems with commands unless you
think carefully about what you are doing. The use of spaces in folder or file names
generally requires that you put quotes around the folder or file name. For example:
md “Software Development 1”
To avoid extensive use of quotes, I have avoided the use of spaces in folder and file
names in this tutorial and I recommend that you do the same until you are very
comfortable with the use of the command prompt.

1.4 Displaying the Contents of a Folder
To display the contents of a folder, use the dir command as follows:
dir
Your command window should look like figure 5.
Week 1 - 5 - 4CC050 Software Development 1
Figure 5 – Using the Dir command
You can see that the folder T:\Year1\SoftwareDevelopment1 is empty apart from two
special folders: “..” and “.”. If you are interested in what these refer to, you can look these
up yourself. However, it is not important for this module. You will come back to the dir
command later.
1.5 Moving to Other Folders
If you want to move back up to the folder Year1, you can do this by typing:
cd ..
(i.e. cd followed by a space and two dots). The use of “..” always indicates “the folder
above this one”.
To move to the root folder of the current drive, use:
cd \
(i.e. cd followed by a space and the backslash character). To go directly to a particular
folder, you can specify the full path name. For example:
cd \Year1\SoftwareDevelopment1
1.6 Other Commands
There are many other commands that can be used in the command prompt that you will
find useful. These include:
COPY Copy one or more files from one location to another
MOVE Move one or more files from one location to another
DEL Delete files (Note that you cannot retrieve the files from
the recycle bin if you use the DEL command so use it carefully)
RENAME Rename one or more files
XCOPY Copies complete folders and sub-folders
Week 1 - 6 - 4CC050 Software Development 1 Information on these commands and other command that are available can be found in
the Windows Help. From the Windows XP Start menu, select Help and Support. In the
Window displayed, enter “Command-Line Reference” into the Search field and press
Enter. From the suggested topics, select “Command-line reference A-Z”. You will then
have access to help for each of the commands. This can be seen in figure 6.

Figure 6 – The Windows Command-Line Reference

2. Creating a Small Program
When people learn how to program computers, the first program they write always seems
to be a program that displays “Hello World” on the screen. I don‟t see any reason to
break this tradition, so that‟s what you will do next - you will create a small computer
program that simply displays “Hello World” in the command prompt. Do not worry if a
lot of the things in this section do not make sense to you at this stage. On

  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents