Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Integrated Development Environment Visual Studio, Assignments of Cybercrime, Cybersecurity and Data Privacy

How to use visual studio IDE's

Typology: Assignments

2020/2021

Available from 07/20/2022

lusssh
lusssh 🇬🇧

2 documents

1 / 28

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Page 1 of 28
Advantages of using Integrated Development
Environments (IDE’s)
Evaluating the use of Visual Studio
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c

Partial preview of the text

Download Integrated Development Environment Visual Studio and more Assignments Cybercrime, Cybersecurity and Data Privacy in PDF only on Docsity!

Advantages of using Integrated Development

Environments (IDE’s)

Evaluating the use of Visual Studio

Contents

    1. Introduction
    1. IDE’s
    • Overview
    • Examples
    1. VISUAL STUDIO
    • Advantages of Visual Studio IDE
    • Starting with Visual Studio
    • Debugging with Visual Studio
      • • Set breakpoints
      • • Add variables to a watch window
    • Conclusion..............................................................................................................................
    1. Why should you use an IDE
    1. Merge-sort algorithm using Visual Studio IDE
    • What is merge-sort algorithm...............................................................................................
    • How does it work
      • • Divide the list into n-lists
      • • Merge the lists:
    • Efficiency
    • Implementing merge-sort algorithm in Visual Studio..........................................................
    • Coding standards used
    1. PROGRAMMING PARADIGMS.......................................................................................
    • • Types of programming languages
      • o Imperative
      • o Declarative
    1. Procedural paradigm
    • 7.1. Advantages of procedural programming
    • 7.2. Disadvantages of procedural programming
    • 7.3. Conclusion
    1. Object-Oriented Programming (OOP)
    • Features of OOP:
      • ➢ Encapsulation
      • ➢ Inheritance.................................................................................................................

programming languages: the developer can stick to master one language or multiples ones using the same environment. To be noted that adhering to a coding standard will help not only the individual to create more robust, easy to maintain and debug code, but also the community of developers. Imagine like every developer in the world will speak the same language! Will be exploring the benefits of using IDE’s, although not everyone is happy using it.

2. IDE’s

Overview

An integrated development environment (IDE) is a software for building applications that combines common developer tools into a single GUI. (redhat team, 2022) This will allow developers to code faster because there is no need for other software to be installed and configured. Most features of IDEs are meant to save time, like intelligent code completion and automated code generation, which removes the need to type out full character sequences. (redhat team, 2022). It is possible to develop applications without an IDE, or for each developer to essentially build their own IDE by manually integrating various utilities with a lightweight text editor like Vim or Emacs. For some developers the benefit of this approach is the ultra- customization and control it offers. (redhat team, 2022) Some of the features of an IDE are:

  • source code editor : a text editor used to write code; it can have different features such as auto-completion, syntax highlighting with visual cues, tab spacing, checking for bugs while writing.
  • automation tools : compiling source code in binary code;
  • debugger : a feature that shows how the program will actually run; it helps visualize the bugs in the code.

Examples

The most common example of IDE’s are: Visual Studio, Eclipse, IntelliJ, NetBeans, PyCharm. In this assignment we are going to focus on Visual studio.

3. VISUAL STUDIO

Visual Studio is the Integrated Development Environment (IDE), created by Microsoft. It is used for creating computer programs, websites, mobile apps. You can use it to write code in a variety of programming languages: C#, Python, C++, Visual Basic, Javascript, etc. Is the best IDE for students because is free!

Advantages of Visual Studio IDE

  • supports multiple operating systems;
  • accurate coding: with Visual Studio, users are provided with live coding assistance regardless of the programming language they are utilizing. The Platform provides autocomplete feature for better speed while coding. The built-in-intellisense provides hints and description of APIs. (Karla, 2021)
  • debugging: Host of tools in Visual Studio IDE makes it easier to debug the code. Finding bugs and diagnose it can be a challenge for most of the developers. Visual Studio platform gives debugging support for all included languages. The process can be done locally, remotely, and in the middle of production. (Karla, 2021)
  • testing: Visual Studio IDE comes with the app testing platform that enables developers to make certain they are ready to deploy high-quality products. They can

easily do the testing in their preferred language and test framework with limited efforts. (Karla, 2021)

  • collaboration: Through Visual Studio IDE you can easily collab with your teammates in a same project. This IDE helps the developers to share, push and pull their code with their teammates. (Karla, 2021)

Starting with Visual Studio

  • download and install Visual Studio After you downloaded and installed Visual Studio from Microsoft website, you can start creating your own projects.
  • create your first project Open Visual Studio and choose ‘Create a new project’. Next step is to choose the programming language you are using to create your project. We are using python for this assignment. Figure 1 Visual Studio project menu Fig. 1 shows the GUI (Graphical User Interface) that we will work on. We will mention some of the Visual Studio features. On the top screen, we have various menus presented (see Fig. 2): o File - you can Save files, open new files and so on; o Edit – Copy/Paste, Undo; o View – you can select which window to open; o Git – to create git repository; o Project – to add files or folders to current project; o Debug – to start the debugging process; the code will be executed and any errors will be shown on the Output window.

On the bottom of the page, we have the output window, where the Visual Studio shows the outputs, compiler warnings, error messages and debugging information. (geeksforgeeks, 2019) – See Fig. 4 Figure 4 - Output window On the left we have the properties area, where additional information about the current project will be shown (Fig. 5). Figure 5 - Properties area

Debugging with Visual Studio

Most of the time, when developers write their code, it will contain errors. It can make the program to crash or the output can be different then what was expected. Instead of looking and trying to find the error in the source code, a debugger will save us time and effort. Debugging means to run your code step by step in a debugging tool like Visual Studio, to find the exact point where you made a programming mistake. (microsoft, 2021) When you run your program without debugging, the errors (if any) or incorrect results will be shown after the code will be executed. With a debugger tool, you can monitor everything as it happens. You can pause it, you can set breakpoints to have a better understanding where the error is within the code or you can jump over. To start the debugging process in Visual Studio, you can press F5, right click on the code editor, or you can select it from the top menu, Debug – See Fig. 6.

Figure 6 - Debugging process When you choose to run your program, you can start it without debugging if you really want to. The program will run the code line by line until finished. The output will be shown at the end.

  • Set breakpoints When you start the debugging process, you can set breakpoints anywhere on the code. this will help examine it in detail at runtime. The debugger will stop at the first breakpoint. After you check everything is ok, pressing F5 will continue debugging. Fig. 6 shows an example using breakpoints.
  • Add variables to a watch window This window will allow you to set a variable or a function to keep an eye on. While debugging, right click on a variable and choose ‘Add Watch’.

5. Merge-sort algorithm using Visual Studio IDE

What is merge-sort algorithm

Merge sort is one of the most efficient sorting algorithms. It works on the principle of Divide and Conquer. Merge sort repeatedly breaks down a list into several sub-lists until each sub-list consists of a single element and merging those sub-lists in a manner that results into a sorted list. (interviewBit, 2022)

How does it work

The merge-sort method is using recursion: a recursive function will call by itself until a case will be met. The unsorted list will be split. Then, the two halves will be split again. And so on, until each list will have a single element (that is the base case). We will go thru an example to have a better understanding of the method:

  • Divide the list into n-lists The last lists will have a single element. Because of that they are sorted. Figure 8 - Divide (interviewBit, 2022)
  • Merge the lists: The elements in the both merging lists are compared: the smallest value will be the first element in the merged list (if user want to sort it in ascending order. This process is repeated until one list will remain – this will be the sorted list.

Figure 9 - Merging (interviewBit, 2022)

Efficiency

What is “Big-O” notation A running program consumes resources such as time (seconds) and space (bits):

  • Time Complexity;
  • Space Complexity. When comparing algorithms, we pay attention to the cost: the differences in time and space. Big-O tells us how a cost of running a program (algorithm), scales with respect to n for large values of n , e.g. linearly, quadratically, logarithmically, etc. The slower the cost rises with n, the better, so long as we are dealing with large values of n. (Cox, 2022) Time Complexity : “Time Complexity is defined as the number of times a particular instruction set is executed rather than the total time is taken. It is because the total time took also depends on some external factors like the compiler used, processor’s speed, etc.” (geeksforgeeks, 2019) Space Complexity : Space Complexity is the total memory space required by the program for its execution. Both are calculated as the function of input size(n). In Fig. 10 is presented a list with most common Big-O notations from the fastest to the slowest:

Implementing merge-sort algorithm in Visual Studio

Let’s see how we can implement this algorithm in Visual Studio.

  • Run Visual Studio Open Visual Studio, choose ‘Create new project’ and from drop-down list select ‘Python application’. Give it a name and a storage location and hit ‘Create’.
  • The code editor will open The main code will be written in this window. Visual Studio has the feature of recognizing the different paragraphs in our code: o writing comments are turned into green color; o declaring functions: Visual Studio assigns blue color and automatically uses TAB spaces for function’s code. o in case of a miss-spelling, the code lines after the error will be highlighted in red. Below is an example of merge-sort algorithm written in Visual Studio 2012:

10.01.

merge-sort algorithm V 1

the program creates a list with 5000 elements arranged in a descending order;

using the merge-sort algorithm, it will arrange the list in an ascending order.

create an empty list

data = [] #add 5000 elements to the list in descending order - this will take the longest time to sort the list for i in range(5000, 1, - 1): data.append(i)

create a recursive function to split the list in halves untill the list will have

only one element def mergeSort(nums): if len(nums) > 1: # split into two sublists m = len(nums) // 2 nums1, nums2 = nums[:m], nums[m:] # add halves of the elements mergeSort(nums1) #call the function to halve the list on and on mergeSort(nums2) #call the function to halve the list on and on

merge the sorted pieces back into original list

merge(nums1, nums2, nums) #this function will take two lists(each one will be sorted) and will merge them into lst def merge(lst1, lst2, lst3):

these indexes keep track of current position in each list

i1, i2, i3 = 0, 0, 0 # all start at the front n1, n2 = len(lst1), len(lst2)

Loop while both lst1 and lst2 have more items

while i1 < n1 and i2 < n2: if lst1[i1] < lst2[i2]: # top of lst1 is smaller lst3[i3] = lst1[i1] # copy it into current spot in lst i1 = i1 + 1 else: # top of lst2 is smaller lst3[i3] = lst2[i2] # copy it into current spot in lst i2 = i2 + 1 i3 = i3 + 1 # item added to lst3, update position

Here either lst1 or lst2 is done. One of the following loops will # execute to

finish up the merge.

Copy remaining items (if any) from lst

while i1 < n1: lst3[i3] = lst1[i1] i1 = i1 + 1 i3 = i3 + 1

Copy remaining items (if any) from lst

while i2 < n2: lst3[i3] = lst2[i2] i2 = i2 + 1 i3 = i3 + 1 mergeSort(data) print(data) Table 1 – merge-sort algorithm

  • After you finish writing the code, save the file.
  • Create breakpoints

Coding standards used

Is very important that a programmer will follow a coding standard on all his projects. Image if you are part of a team and you are trying to debug someone else’s work. Without knowing convention used, will be very difficult to manage that. It is important to adhere to a coding standard, especially if you are part of a team. It will make it easily readable and maintaining the code will be much more efficient. (Sengayire, 2019) The aspects that need to be taken into account when using coding standards are:

  • file and folder naming: all the files should be named accordingly, using version control. When you update your code, is a good idea to save it as a different version;
  • naming conventions: sets up how the variables, methods, classes should be named. Here, we find different styles: camelCase, PascalCase, snake_case);
  • formatting and indentation: the code should be written using standard indentation;
  • commenting and documenting: makes it easier to read and understand the code;
  • classes and functions: specifies how classes and functions behaves;
  • write as few lines as possible;
  • don’t repeat the code: try to use repetitive tasks;
  • avoid deep nesting: try not to use too many nesting levels;
  • testing: what tools are used for testing. (Sengayire, 2019) In the merge-sort algorithm (see table 1), the coding standard is: ➢ the comments at the beginning highlights the date program was created and the version number; ➢ the variables are written in lowercase; ➢ the methods are named using camelCase (joined words with the least one starting with capital letter); ➢ wrote as few lines as possible; ➢ using ‘TAB’ indentation.

6. PROGRAMMING PARADIGMS

  • What is a programming language Programming means giving a set of instructions to a computer to execute. A programming language represents the necessary tools for a human so he can write instructions to a computer. Computers only know binary: ‘0’ and ‘1’. (CodeAcademy, 2021) Programming languages are human-readable: we can understand and write code which later on will be compiled in machine readable code: 0s and 1s. (bbc, 2020)
  • Types of programming languages Today there are a lot of programming languages. They are becoming more and more general and all-purpose, but still, they have their own specialties, with advantages and disadvantages. Programming languages can be classified in few types, as presented in figure 1 below: (wate electronics, 2021)

Figure 13 - Programming languages classification (wate electronics, 2021) The way of programming is called a programming paradigm. Because there are hundreds of programming languages available, they need to follow some strategy of writing code – paradigm. A programming paradigm is not a programming language, is the way in which you write code. (Vasu, 2020) o Imperative Programming with a sequence of commands that update state. It shows step by step how computation takes place. (ray, 2022) o Declarative Programming specifying the result you want, without the need to know how you get it. Control flow is implicit: the programmer states what the result will look like, not how to be obtained. Example: using queries in Microsoft Access to obtain information from a table. The programmer will specify the result, without the need to write how to get there: (ray, 2022)

7. Procedural paradigm

Procedural paradigm is one of the imperative programming techniques. It is based on procedure calls, where statements are encapsulated into functions (code is split in smaller chunks- procedures/subroutines). It is a step-by-step list of instructions which will be executed by a computer. The programming languages using procedural paradigm are known as top-down languages (the flow of the program will be from the top all the way to the bottom). (Hari, 2022). Usually, the programming languages uses heavy loops, multiple variables to lead to the desired result. The variables used are either local or global. Locally means they are used inside a function, it cannot be accessed outside of it. Global variables can be used and shared anywhere within the program. (wate electronics, 2021) In figure 2 we can see how the code is split into smaller manageable parts called functions or procedures. The priority goes to functions, rather than data. These functions can be later re- used in the program. They are created to do a specific task. (lightbringer, 2019) Example of procedural programming languages: C, C++, Python, Pascal.

Figure 15 - OOP (Mosh, 2021)

Features of OOP:

➢ Encapsulation Encapsulation represents a fundamental feature in OOP. Basically, all the data an object has (attributes and methods) are binding together into a class. Is mainly used to hide ‘sensitive’ data from user. (Obydullah, 2020) In figure 4, we have a good example of using encapsulation: variables and methods are encapsulated into a class. Figure 16 - Encapsulation (Obydullah, 2020) ➢ Inheritance The process of creating a class using proprieties and characteristics of other class is called inheritance. When we speak about inheritance, two classes are in our mind – see fig. 5 :

  • Parent class : the class which will use proprieties and methods from to create another class;
  • Child class : the class created using methods and proprieties from a parent class. (Learn Simpli, 2019)

Figure 17 - Inheritance in OOP (Learn Simpli, 2019) ➢ Abstraction In OOP, abstracting means extracting relevant data from an object to be used. The reason is that we want to remove unnecessary data to reduce program complexity. (Learn Simpli,

  1. The question a programmer asks is what user want , not how user gets it. We are hiding the implementing details from a user and only showing the required interface. (Software testing, 2022) Figure 18 - Abstraction in OOP (Software testing, 2022) In figure 6, is represented a diagram where the two innermost layers are not shown to outside world. The outermost layer is presented to the end user to access the object’s functionalities. (Software testing, 2022) ➢ Polymorphism In OOP, polymorphism represents the ability of an object (or a variable/method) to take multiple forms. (Learn Simpli, 2019) In figure 7, the parent class Person has the method called ‘learn()’. The child classes all inherited this method, but with different behaviours. (Btec SmartClass, 2022)