Docsity

Programming Assigment 2 - 2020, Essays (university) of C programming

Toggle sidebar
bg1
ASSIGNMENT 2 BRIEF
Qualification
BTEC Level 5 HND Diploma in Computing
Unit number and title
Unit 1: Programming
Assignment title
Application development with IDE
Academic Year
Unit Tutor
Issue date
Submission date
Submission Format:
Format: The submission is in the form of an individual written report. This should be written in a
concise, formal business style using single spacing and font size 12. You are required to
make use of headings, paragraphs and subsections as appropriate, and all work must be
supported with research and referenced using the Harvard referencing system. Please also
provide a bibliography using the Harvard referencing system.
Submission Students are compulsory to submit the assignment in due date and in a way requested by
the Tutors. The form of submission will be a soft copy in PDF posted on corresponding
course of http://cms.greenwich.edu.vn/
Note: The Assignment must be your own work, and not copied by or from another student or from
books etc. If you use ideas, quotes or data (such as diagrams) from books, journals or other sources, you
must reference your sources, using the Harvard style. Make sure that you know how to reference
properly, and that understand the guidelines on plagiarism. If you do not, you definitely get fail
Assignment Brief and Guidance:
Scenario: You have applied for a post as a trainee with a software development company and have
been invited for an interview. You have been passed the presentation to demonstrate your problem
solving and basic programming skills. Now you are given a more challenge task to create a fully
working, secure application that has been developed using an IDE and adheres to coding standards
for a detailed business problem.
Tasks
You will discuss a suitable problem with your mentor and list the user requirements before
designing, implementing (coding) and testing a solution. You will create a report that should include:
● Introduction to your program (list of requirements and screenshots of program)
● Explain some of programming paradigms. Evaluate why and how your program use these (or
some of) paradigms.
● Explain the common features of an IDE should have and evidence of how the IDE was used to
manage the development of your code.
● An evaluation of developing applications using an IDE versus developing an application without
using an IDE.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20

Partial preview of the text

Download Programming Assigment 2 - 2020 and more Essays (university) C programming in PDF only on Docsity!

ASSIGNMENT 2 BRIEF

Qualification BTEC Level 5 HND Diploma in Computing

Unit number and title Unit 1: Programming

Assignment title Application development with IDE

Academic Year

Unit Tutor

Issue date Submission date

Submission Format:

Format: The submission is in the form of an individual written report. This should be written in a

concise, formal business style using single spacing and font size 12. You are required to make use of headings, paragraphs and subsections as appropriate, and all work must be supported with research and referenced using the Harvard referencing system. Please also provide a bibliography using the Harvard referencing system.

Submission Students are compulsory to submit the assignment in due date and in a way requested by

the Tutors. The form of submission will be a soft copy in PDF posted on corresponding course of http://cms.greenwich.edu.vn/ Note: The Assignment must be your own work, and not copied by or from another student or from books etc. If you use ideas, quotes or data (such as diagrams) from books, journals or other sources, you must reference your sources, using the Harvard style. Make sure that you know how to reference properly, and that understand the guidelines on plagiarism. If you do not, you definitely get fail

Assignment Brief and Guidance:

Scenario : You have applied for a post as a trainee with a software development company and have been invited for an interview. You have been passed the presentation to demonstrate your problem solving and basic programming skills. Now you are given a more challenge task to create a fully working, secure application that has been developed using an IDE and adheres to coding standards for a detailed business problem.

Tasks You will discuss a suitable problem with your mentor and list the user requirements before designing, implementing (coding) and testing a solution. You will create a report that should include: ● Introduction to your program (list of requirements and screenshots of program) ● Explain some of programming paradigms. Evaluate why and how your program use these (or some of) paradigms. ● Explain the common features of an IDE should have and evidence of how the IDE was used to manage the development of your code. ● An evaluation of developing applications using an IDE versus developing an application without using an IDE.

● An explanation and evaluation of the debugging process in the IDE used and how it helped with development. ● An explanation and evaluation of coding standards used in your program and the benefits to organisations of using them.

The working application produced must also be demonstrated together with the presentation.

Learning Outcomes and Assessment Criteria

Pass Merit Distinction

LO2 Explain the characteristics of procedural, object-oriented and event-driven programming, conduct an analysis of a suitable Integrated Development Environment (IDE)

P2 Give explanations of what procedural, object-oriented and event-driven paradigms are; their characteristics and the relationship between them.

M2 Analyse the common features that a developer has access to in an IDE.

D2 Critically evaluate the source code of an application which implements the programming paradigms, in terms of the code structure and characteristics.

LO3 Implement basic algorithms in code using an IDE LO4 Determine the debugging process and explain the importance of a coding standard

P3 Write a program that implements an algorithm using an IDE.

M3 Use the IDE to manage the development process of the program.

D3 Evaluate the use of an IDE for development of applications contrasted with not using an IDE.

P4 Explain the debugging process and explain the debugging facilities available in the IDE.

P5 Outline the coding standard you have used in your code.

M4 Evaluate how the debugging process can be used to help develop more secure, robust applications.

D4 Critically evaluate why a coding standard is necessary in a team as well as for the individual.

 - are; their characteristics and the relationship between them P2 Give explanations of what procedural, object-oriented and event-driven paradigms 
  • I. Programming paradigm - 1. What is programming paradigm? - 2. How many types of programming paradigm are there? - 3. Introduction of some programming paradigms - 3.1. Procedural programming Paradigm: - 3.2. Object Oriented Programming: - 3.3. Event-driven programming:
  • II. Integrated development environment (IDE) - 1. What is an IDE? - 2. Editing source code - 3. Syntax highlighting - 4. Autocomplete - 5. Building executable - 6. Debugging - 7. Coding on your computer - P3 Write a program that implements an algorithm using an IDE. - 1. Program - 2. Program result - 2.1. Show running program - 2.2. Enter what the program requires - 2.3. The program displays the result - 3. Common IDE features: - 3.1. Basic IDE features - 3.2. List of the best IDEs......................................................................................... - 3.3. The best IDE supports Java programing - 3.4. The most effective IDE supports Python programing - 4. Benefits of IDEs for programmers - 1. Debugging process:
  • P5 Outline the coding standard you have used in your code
      1. Coding standard
      • 1.1. Goal: Self-Documenting Code
      • 1.2. Coding Conventions Apply to
      • 1.3. Naming Conventions
      • 1.4. Statement Convention
      • 1.5. Layout
      • 1.6. Comment
      • 1.7. XML document comment
  • REFERENCE

ASSIGNMENT 1 ANSWERS

P2 Give explanations of what procedural, object-oriented and event-driven

paradigms are; their characteristics and the relationship between them:

I. Programming Paradigm:

1. What is programming paradigm?

o Paradigm can also be termed as method to solve some problem or do some task. o Programming paradigm is an approach to solve problem using some programming language or also we can say it is a method to solve a problem using tools and techniques that are available to us following some approach. o There are lots for programming language that are known but all of them need to follow some strategy when they are implemented and this methodology/strategy is paradigms.

2. How many types of programming paradigms are there?

o There are many types of programming paradigms, but the most important and most commonly used today are:

3. Introduction of some programming paradigms:

3.1. Procedural programming paradigm:

o This is the offspring of the imperative programming model, completely inheriting the principle of the imperative programming model. In this model you will use 3 main structures to work:

  • Sequential: Statements are executed in a certain order (Most are top to bottom, sometimes having a Goto in C is hard to control).
  • Deciding: The program runs depends on certain conditions. (If, Else is a representative keyword).
  • Loop: Statements are repeated when certain conditions are still satisfied (For, While).

o Result:

o Common structural-oriented programming languages:

  • C
  • Pascal
  • C ++

3.2. Object Oriented Programming:

o C # provides full support for object-oriented programming including packaging, inheritance and

polymorphism.

  • Packing means a group of properties, methods, and other related members that are considered a unit or object.
  • Inheritance describes the ability to create new classes based on an existing class.
  • Polymorphism means you can have multiple classes that can be used interchangeably, even though each class implements the same properties or methods in different ways.

o Classes and subjects:

  • The terms class and object describe the types of objects, and instances of the classes, respectively. Therefore, the act of creating an object is called initialization. Using the blueprint compare, a class is a blueprint and an object is a building created from that blueprint.

o To define a class:

o C # also provides types called constructs that are useful when you don't need support for inheritance

or polymorphism.

o To determine the structure:

o Class members:

  • Each class can have different class members including properties that describe class data, methods that determine the behavior of the class, and events that provide communication between different classes and objects.

o Properties and fields:

  • Fields and properties represent information that an object contains. The fields are like variables because they can be read or set directly, depending on the access modifiers applied. o To identify a field that can be accessed from within class instances:

o Properties have get and set accesses, which provide more control over how values are set or

returned. o C # allows you to create your own field to store attribute values or use dynamically deployed

attributes to create this field automatically behind the scenes and provide the basic logic for the attribute process.

o To determine an attribute is done automatically:

o In most cases you declare a method within a class definition. However, C# also supports extension methods that allow you to add methods to an existing class outside the actual definition of the class. o Constructors:

  • Constructors are class methods that are executed automatically when an object of a given type is created. Constructors usually initialize the data members of the new object. A constructor can run only once when a class is created. Furthermore, the code in the constructor always runs before any other code in a class. However, you can create multiple constructor overloads in the same way as for any other method.

o To define a constructor for a class:

o Finalizers:

  • A finalizer is used to destruct instances of classes. In .NET, the garbage collector automatically manages the allocation and release of memory for the managed objects in your application. However, you may still need finalizers to clean up any unmanaged resources that your application creates. There can be only one finalizer for a class. o Events:
  • Events enable a class or object to notify other classes or objects when something of interest occurs. The class that sends (or raises) the event is called the publisher and the classes that receive (or handle) the event are called subscribers. For more information about events, how they are raised and handled, see Events. o To declare an event in a class, use the event keyword. o To raise an event, invoke the event delegate. o To subscribe to an event, use the += operator; to unsubscribe from an event, use the -= operator. o Nested classes:
  • A class defined within another class is called nested. By default, the nested class is private.

o To create an instance of the nested class, use the name of the container class followed by the dot and then followed by the name of the nested class:

o Access modifiers and access levels

  • All classes and class members can specify what access level they provide to other classes by using access modifiers.

o The following access modifiers are available:

o Anonymous types:

  • Anonymous types enable you to create objects without writing a class definition for the data type. Instead, the compiler generates a class for you. The class has no usable name and contains the properties you specify in declaring the object.

o To create an instance of an anonymous type:

o Inheritance:

  • Inheritance enables you to create a new class that reuses, extends, and modifies the behavior that is defined in another class. The class whose members are inherited is called the base class , and the class that inherits those members is called the derived class. However, all classes in C# implicitly inherit from the Object class that supports .NET class hierarchy and provides low-level services to all classes.

o To inherit from a base class:

  • By default all classes can be inherited. However, you can specify whether a class must not be used as a base class, or create a class that can be used as a base class only. o To specify that a class cannot be used as a base class:

o To specify that a class can be used as a base class only and cannot be instantiated:

o Overriding Members:

  • By default, a derived class inherits all members from its base class. If you want to change the behavior of the inherited member, you need to override it. That is, you can define a new implementation of the method, property or event in the derived class.

o The following modifiers are used to control how properties and methods are overridden:

o Interfaces:

  • Interfaces, like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation. They are implemented by classes, and defined as separate entities from classes. An interface represents a contract, in that a class that implements an interface must implement every aspect of that interface exactly as it is defined.

o To define an interface:

o To implement an interface in a class:

o Generics:

  • Classes, structures, interfaces, and methods in .NET can include type parameters that define types of objects that they can store or use. The most common example of generics is a collection, where you can specify the type of objects to be stored in a collection.

o Common object-oriented programming languages:

  • C ++
  • C #
  • Java

o The program is written as a collection of classes and object which are meant for communication. The smallest and basic entity is object and all kind of computation is performed on the objects only. More emphasis is on data rather procedure. It can handle almost all kind of real life problems which are today in scenario.  Advantages:

  • Data security.
  • Inheritance.
  • Code reusability.
  • Flexible and abstraction is also present.

3.3. Event-driven programming:

o Event-driven programming is a programming paradigm in which the flow of program execution is

determined by events - for example a user action such as a mouse click, key press, or a message from the operating system or another program. An event-driven application is designed to detect events as they occur, and then deal with them using an appropriate event-handling procedure. The idea is an extension of interrupt-driven programming of the kind found in early command-line environments such as DOS, and in embedded systems (where the application is implemented as firmware).

o Event-driven programs can be written in any programming language, although some languages(Visual

Basic for example) are specifically designed to facilitate event-driven programming, and provide an integrated development environment (IDE) that partially automates the production of code, and provides a comprehensive selection of built-in objects and controls, each of which can respond to a range of events. Virtually all object-oriented and visual languages support event-driven programming. Visual Basic, Visual C++ and Java are examples of such languages.

o A visual programming IDE such as VB.Net provides much of the code for detecting events

automatically when a new application is created. The programmer can therefore concentrate on issues such as interface design, which involves adding controls such as command buttons, text boxes, and labels to standard forms (a form represents an application's workspace or window ). Once the user interface is substantially complete, the programmer can add event-handling code to each control as required.

o Many visual programming environments will even provide code templates for event-handlers, so the

programmer only needs to provide the code that defines the action the program should take when the event occurs. Each event-handler is usually bound to a specific object or control on a form. Any additional subroutines, methods, or function procedures required are usually placed in a separate code module, and can be called from other parts of the program as and when needed.

o In software development, event-driven programming is a programming model in which all business

logic is performed in the program source code. The program's runtime processing will be determined based on events. Events here can be:

  • Click the button on the screen.
  • Press the key on the keyboard.
  • Hover.
  • Timeout.
  • Get sensor output signal.
  • Receive messages from other programs or threads.
  • ...

o Application of event-driven programming:

  • Event-driven programming is the main model used in applications that focus on providing processes that respond to user actions.
  • In an event-driven application, there is usually a main loop that listens to events, and then triggers a call to the function callback (*) when an event is detected. In embedded systems, the same thing can be achieved by using hardware interrupts instead of a continuous main loop. Event-driven programs can be written in any programming language.
  • Syntax highlighting makes code easier to read by visually clarifying different elements of language syntax.

4. Autocomplete:

o When the IDE knows your programming language, it can anticipate what you’re going to type next! o We’ve seen statements with System.out.println() quite a bit so far. In an IDE, we might see System as an autocomplete option after only typing Sy. This saves keystrokes so the programmer can focus on logic in their code.

5. Building executable:

o Java is a compiled language. Before programs run, the source code of a .java file must be transformed into an executable .class by the compiler. Once compiled, the program can be run from the terminal. o This compilation process is necessary for every program, so why not have the IDE do it for us? IDEs provide automated build processes for languages, so the act of compiling and executing code is abstracted away, like in Code cade my lessons.

6. Debugging:

o No programmer avoids writing bugs and programs with errors. o When a program does not run correctly, IDEs provide debugging tools that allow programmers to examine different variables and inspect their code in a deliberate way. o IDEs also provide hints while coding to prevent errors before compilation.

7. Coding on your computer:

o The biggest benefit to using an IDE is that it allows you to code and run Java programs on your own computer. o Some good IDE software such as: Visual Studio, Sublime Text, XCode, etc..

P3. Write a program that implements an algorithm using an IDE:

1. Program:

2. Program results:

2.1. Show running programs: