




















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
How to use visual studio IDE's
Typology: Assignments
1 / 28
This page cannot be seen from the preview
Don't miss anything!
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.
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:
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.
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!
easily do the testing in their preferred language and test framework with limited efforts. (Karla, 2021)
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
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.
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)
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:
Figure 9 - Merging (interviewBit, 2022)
What is “Big-O” notation A running program consumes resources such as time (seconds) and space (bits):
Let’s see how we can implement this algorithm in Visual Studio.
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)
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(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):
i1, i2, i3 = 0, 0, 0 # all start at the front n1, n2 = len(lst1), len(lst2)
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
finish up the merge.
while i1 < n1: lst3[i3] = lst1[i1] i1 = i1 + 1 i3 = i3 + 1
while i2 < n2: lst3[i3] = lst2[i2] i2 = i2 + 1 i3 = i3 + 1 mergeSort(data) print(data) Table 1 – merge-sort algorithm
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:
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)
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)
➢ 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 :
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,