Docsity

Programming ( Code Java and some IDE), Summaries of Programming Languages

Toggle sidebar
bg1
1
PROGRAM TITLE: PROGRAMMING
UNIT TITLE: PROGRAMMING
ASSIGNMENT NUMBER: 1
ASSIGNMENT NAME:BOOK MANAGEMENT SYSTEM
SUBMISSION DATE: ……………………………………….
DATE RECEIVED: 7/12/2021
TUTORIAL LECTURER: NGUYỄN NGỌC TÂN
WORD COUNT: 3179
STUDENT NAME: NGUYỄN TUẤN MINH
STUDENT ID: BKC12345
MOBILE NUMBER: 0985296959
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12

Partial preview of the text

Download Programming ( Code Java and some IDE) and more Summaries Programming Languages in PDF only on Docsity!

PROGRAM TITLE: PROGRAMMING UNIT TITLE: PROGRAMMING ASSIGNMENT NUMBER: 1 ASSIGNMENT NAME:BOOK MANAGEMENT SYSTEM SUBMISSION DATE: ………………………………………. DATE RECEIVED: 7/12/ TUTORIAL LECTURER: NGUYỄN NGỌC TÂN WORD COUNT: 3179 STUDENT NAME: NGUYỄN TUẤN MINH STUDENT ID: BKC MOBILE NUMBER: 0985296959

Summative Feedback: Internal verification:

Preface

Technology is now a very important and indispensable part of life.

Technology makes our lives easier, helps us study, helps us work, and so

on. So have we ever wondered where those technology applications are

made from and what foundations are the mainstays for that application?

Today I will explain to you so that you can somewhat understand

programming, their methods.

The research and development team I work with has been tasked

with further investigating the best way to build more efficient, secure

software. I was asked to investigate programming paradigms and the

advantages and disadvantages of using different programming language

approaches.

I will create a report that includes findings from research on the

characteristics of programming paradigms - procedural, object-oriented,

and event-driven programming.

I will explain the characteristics of procedural programming,

object-oriented programming and event-oriented programming. And I

will also give explanations about procedural programming, what objects

and events are, as well as their characteristics and relationships.

Next I will compare and contrast the procedural, object-oriented,

and event-driven models used in the given source code of an application.

Finally, I will critically evaluate the source code of a procedural,

object-oriented, and event-driven model-driven application, in terms of

code structure and characteristics.

To start getting into the details we need to understand what is a programming model? Programming model also know as Programming Paradigm is a way of classifying programming languages based on their characteristics. Programming languages can be classified into many programming paradigms. Some common programming models: ‣ Imperative programming is a programming paradigm that uses statements to change the state of a program. ‣ Procedure-oriented programming executes groups of statements in procedures/functions. ‣ Object-oriented programming implements code that creates objects to abstract objects. ‣ Declarative programming in which the programmer declares the properties of the desired result, but does not compute it. ‣ Functional programming: The desired result is to be declared as the value sequence of the application function. ‣ Logical programming: based on mathematical logic in relationships and inferences. ‣ Mathematical programming where the desired result is the solution of optimization problems. And what will our exposure to different programming languages bring us? ‣ That is to give us more understanding of other languages, know how they work, and be able to apply many languages to solve problems, very simple to implement. ‣ But besides that, there are also some difficulties that make us confused, sometimes we do not know which language to use to solve it quickly, some languages are still quite difficult to learn as well as difficult to read programs, some language, the security is not high, parallel programming is not possible, … Now, let's dive deeper into popular programming paradigms like procedural programming, object-oriented programming, event-oriented programming, and more.

‣ Procedure-oriented programs focus on manipulation instead of data, which can cause problems in some data-sensitive cases ‣ Data is displayed for the entire program, making the data security not very good. Example: II. Object Oriented Programming (OOP)?

1. What is Object Oriented Programming(OOP)?

‣ Object-oriented programming (OOP) is a programming paradigm based on the concept of classes (classes) and objects (objects). It is used to organize a software program into simple, reusable source code blueprints (often called classes) that are used to create individual copies of objects. Since OOP is a programming paradigm, there are many object-oriented programming languages including: C++, C#, Java, and Python… ● Object:

  • Objects in OOP consist of 2 main components: ‣ Attributes: are the information and characteristics of the object ‣ Methods: are the behaviors that the object can perform
  • To make it easier to imagine, we have a real-life example of an object that is a car. This object will have: ‣ Attributes: color, wheels, trunk, rearview mirror ‣ Methods:carry people, move... ● Class:
  • Class is an abstraction of the object. Objects with similar properties will be grouped into a class. The class will also include 2 pieces of information: properties and methods.
  • An object will be considered an instance of the class.
  • Continuing the example in the object section above, we have a smartphone class consisting of 2 components: ‣ Attributes: color, wheels, trunk, rearview mirror ‣ Methods:carry people, move...
  • Objects of this class can be: Audi, Nissan, Volvo, Ferrari…

2. Features of Object Oriented Programming?

● Encapsulation ‣ Encapsulation is simply understood that data and related functions/methods are "packed" into classes for easy management and use, allows hiding information and the internal processing properties of the object. Other objects cannot directly affect the data inside and change the state of the object, but must go through public methods provided by that object.This property helps to increase the security of the object and avoid unintentional data corruption. *** Example:**

Advantges Disadvantages

  1. Inheritance increases reusability. When a class inherits or derives another class, it can access all the functionality of the class it inherits from.
  2. Reusability improves reliability. We only need to test and debug with the superclass code, we don't need to test each subclass.
  3. When code is reused, development and maintenance costs are reduced.
  4. Subclasses will conform to a standard interface.
  5. Inheritance helps to limit code and supports code extendsibility
  6. Programmers have favorable conditions to create class libraries
    1. Inherited functions work slower than normal function, because it is implemented indirectly (taken from parent class) and not directly.
    2. Normally, the member data in the superclass is not used. This can lead to wasted memory.
    3. Inheritance increases the connection between the base class and the derived class. A change in the parent class affects all subclasses.
    4. Using Inheritance incorrectly can lead to erroneous workarounds later on. ● Polymorphism ‣ Multiforming is an action that can be performed in many different ways. This is a feature of the said to be the cannot out of the power of the set up object. In simpler terms: Polymorphism is a concept where two or more classes have the same methods but can implement different methods. ‣ Programmers can take advantage of Polymorphism in OOP in the following cases:
    • When subclasses need to use the superclass's method to supplement another method.
    • When a class needs to have multiple methods with the same name but different parameters (parameters). *** Example:**

‣ Why need to use Polymorphism?

  • In general, if programmers take advantage of Polymorphism, it will bring many benefits in the software development process. Those benefits could be:
  • Programmers do not have to rewrite existing code or classes. After a piece of code or class is successfully instantiated, it can be reused thanks to Polymorphism.
  • Programmers can use a single name to store variables of different data types (float, double, long, int, …).
  • Programmers can develop more Abstraction from simple pieces of code. You can refer to this content in related articles. ● Abstraction ‣ Abstraction in Java is a property that does not express concrete, but only names the problem. It is a process that hides the inner workings and exposes only the essential features of the object to the user. ‣ We have two methods to implement abstraction 1. Abstract class ‣ In abstract class there are 2 types of methods:
  • Abstract method (which is an empty method that does nothing)
  • Normal method (is still has logic to return data or perform some action, it is used for general purposes) *** Example: Output:**

declare abstract class. an interface.

  1. Example: public abstract class Shape { public abstract void draw(); } Example: public interface Drawable { void draw(); } *** Some of the benefits of Abstraction include:** ‣ Simple, high-level user interface. ‣ Complex codes are hidden. ‣ Improve security, protect data from being exposed. ‣ Software maintenance is easier. ‣ Updating (changing) the code will have very little effect on the Abstraction. III. Event-Driven Programming

1. What is Event-Driven Programming? ‣ In computer programming, event-driven programming is a programming paradigm in which the flow of a program is determined by events such as user actions (clicks, key presses, etc.) ), sensor output, or messages from programs or streams. Event-driven programming is the dominant paradigm used in graphical user interfaces and other applications (e.g. JavaScript web applications) that focus on performing certain actions in response to input. user input. The same is true for programming for device drivers (e.g. P in the USB device driver stack).

1. Pros and cons of procedural programming

● Advantages

‣ Serves the user with the quickest and most accurate responses and this usually translates into better user experience and business gains. Also, the whole focus of software development is on the actual people using the app and their actions, so it will produce better and more intuitive products for the end-users. ‣ It’s very intuitive, flexible and naturally well-suited to applications whose control flow are based, not on its structure, but rather on internal or external events. ‣ It can be practiced with any programming language.

● Disadvantages

‣ Since it offers the most value for GUI applications, some other use cases might not benefit from it. ‣ Some critics are also saying that event-driven programming is complex to master and not worth the trouble when your application is very simple and small. Example:

IV. The relationships between programming procedural, object-oriented and event-driven programming. ‣ Procedural paradigm is your looking at the process needed to solve a problem. I do A, then I do B, and then I do C. There’s a definite process and the flow of the data is highly predictable. ‣ Object oriented is looking at the actors and creating objects to represent those actors. For example, an emulator for a movie line queue. You’ve got people, the line, and a ticket booth. So, you build objects around those actors. ‣ Event driven, is used when you have spontaneous moments that need to be taken care of. You can add event handlers to both procedural and object oriented paradigms. So, as a stand alone, it’s not a complete paradigm. For instance your procedural report writer could have an event to handle out of paper. Or the object oriented program could have an event to handle when lightning hits a person standing line for the movie. ‣ Events are more a feature to add to other stuff.

VI. Critically evaluate the source code of an application which implements the programming paradigms, in terms of the code structure and characteristics. ‣ Computer programming languages permit us to give instructions to a computer in a language the computer understands. At a basic level, computers only understand binary language (1's and 0's), which makes no sense to humans. There are many programming languages in the computer world. ‣ In general, a computer program consists of the following components:

1. Program Structure The general type of a program, there is always a structure or format in which the programmer develop programs. A well-organized program uses suitable information structures and formats. 2. Variable Declaration A variable is used to store values at run time or time of execution. Some programming languages give flexibility to the programmer to avoid variable declaration, but a good programming language must have a proper variable declaration method. 3. Looping structures Looping in computer programming is used to repeat statements, under a given condition. There are many types of loops with minor difference in different computer programming languages. Loops will keep executing until the exit condition is met. 4. Control structures A control structure is a slab in computer programming that examines variables and chooses the execution direction in which to go, based on given parameters or conditions. 5. Sentence structure In computer programming, when a programmer writes a program they use programming notation in an expository. Thus, it is important that the notation has a sentence structure that can be easily expressed. VII. Analysis of some reviews of suitable IDEs ● What is IDE? ‣ An Integrated Development Environment (IDE for short) is an application that fully facilitates programming. ● Tools included in the IDE include: ‣ Code editor ‣ Compiler ‣ Debugger ‣ Build automation tools: ‣ Class Browser ‣ Object Browser ‣ Class Hierarchy Diagram ● **Some popular IDEs for java programming

  1. Eclipse** ● Main features of Eclipse IDE: ‣ Support for Java 8.0 and 9.0 + ‣ Help you organize, edit your code with quick validation, enhanced editing, cross-referencing, code suggestions.

‣ Built-in static code analysis ‣ Smart code five code completion and quick editing.

2. JDeveloper ● Features of JDeveloper: ‣ JDeveloper simplifies the development of Java-based applications by addressing each step of the application lifecycle. ‣ It mainly provides an integrated development framework with many features and some intuitive development tools. ‣ This JDeveloper has the ability to integrate with the Oracle Application Development Framework (Oracle ADF) to further simplify application development. 3. BlueJ ● BlueJ's top feature: ‣ Has a clutter-free interactive interface that is easy to use and test. ‣ Suitable for beginners to learn Java programming. ‣ Use boxes to represent classes. ‣ Multi-platform ‣ Easily check object values, call methods on objects, and pass objects as parameters.