Programming Application & framework Tutorial Article

Programming Application and framework
                                                                                                                     
    Tutorial 01 – Introduction to the frameworks 
Q &A 


                                 
(01). Compare and contrast declarative and imperative paradigms? 



 Imperative programming:
  • Imperative programming is a programming paradigm that describes computation in terms of statements that change a program state. each step affects the global state of the computation.
  • HOW we want to do something
  • focuses on describing how a program operates.
  •  Imperative programming,tell compiler to what you want to happen step by step.

Example:
Table<int> collection = new Table<int> { 1, 2, 3, 4, 5 };

Imperative programming languages Example:..................
 C++, Java, and PHP.

  • Imperative -> how you want it done
Imperative Real World Example:

1.  Check out the book.
2. Find Book Organization System (Card Catalog - Old school)
3. Research how to use Card Catalogs (You forgot too, right)
4. Take a book to the check-out system.
5.  Go into Library

A programming language that requires programming discipline such as C/C++, Java, COBOL, FORTRAN, Perl and
 JavaScript. Programmers writing in such languages must develop a proper order
of actions in order to solve the problem,
 based on a knowledge of data processing and programming

Example:
Imperative - specify both what and how
int x; - what (declarative)

x=x+1; - how




Declarative...

  • With declarative programming, on the other hand, you write code that describes what you want, but not necessarily how to get it (declare your desired results, but not the step-by-step.
example:
# Declarative
small_nums = [x for x in range(20) if x < 5]

# Imperative
small_nums = []
for i in range(20):
    if i < 5:
        small_nums.append(i);
  • One benefit of declarative programming is that it allows the compiler to make decisions that might result in better code than what you might make by hand.
  • Declarative  is a programming paradigm that expresses the logic of a computation(What do) without describing its control flow(How to do)
Examples: of declarative domain-specific languages (DSLs) include
 CSS, regular expressions, and a subset of SQL (SELECT queries, for example)
 Many markup languages such as HTML, MXML, XAML, XSLT


  • Declarative -> what you want to be done, not how to do it
  • With declarative programming, you write code that describes what you want, but not necessarily how to get it.
Example:
 HTML describes what should appear on a web page,
 not how it should be drawn on the screen
Declarative Real World 
Example:
1. Librarian, please check me out a copy of Moby Dick. 

(Librarian, at their discretion, chooses the best method for performing the request)

(02). Discuss the difference between procedural programming and functional programming?

   Procedural programming...


  • Procedural programming is a type of imperative programming in which the program is built from one or more procedures.
There's a way of transforming sequential logic into functional logic called continuation passing style.
 Procedural programming paradigm helps to structure the code using blocks called procedures, routines, sub-routines, functions, methods.

  • A procedure can implement a single algorithm using the control structures
  • Provides modularity and code reuse
  • Use the imperative approach
  • Has side-effects
  • Execution of a code block changes the state of the system.
Class action {
 x = 10; 
show(){
   print(this.x); 
  }                                                                                          action a = new action();
  add (x) {                                                                             a.show(); //10
  this.n = this.x + y;                                                               a.add(20);
                                                                                              a.show();//30
 this.n = this.x + y;
   }                                               
 }

Procedural:
  • The output of a routine does not always have a direct correlation with the input.
  • Everything is done in a specific order.
  • Execution of a routine may have side effects.
  • Tends to emphasize implementing solutions in a linear fashion
  • Procedural programming focuses on the statement.

                       


Functional programming...

Functional programming focuses on expressions
Origins from Lambda calculus

  • Note: the term “function” has nothing to do with the functions in languages like C/C++.
  • No side-effect = referential transparency
  • “Function” uses a mathematical meaning, similar to ”expression” or “formula”
  • The output of a function only depends on the inputs
  • The global state of the system does not affect the result of a function
  • Similar inputs always provide the same output
  • Execution of a function does not affect the global state of the system
Print(“Hello”)
Use a declarative approach

  • describe what the program must accomplish
  • Does not describe how to accomplish the task as a sequence of the programming language primitives
  • This helps to minimize side-effects
const sum = x => y => x + y;
print(sum(35) (5)); // 40

A functional language (ideally) allows you to write a mathematical function, i.e. 
a function that takes n arguments and returns a value.
 If the program is executed, this function is logically evaluated as needed

(03). Explain the Lambda calculus and Lambda expressions in functional programming?


Lambda calculus is a framework developed by Alonzo Church in the 1930s to study computations with functions.
The syntax of Lambda Calculus(variables)(function application)(function creation)
Lambda calculus includes three different types of expressions, i.e.,
E :: = x
| E1 E2
| λx.E
Where λx.E is called Lambda abstraction and E is known as λ-expressions.

(04). What is meant by “no side-effects” and “referential transparency” in functional programming?  

Referential transparency...
        An expression is called referentially transparent if it can be replaced with its corresponding value without changing the program's behavior. ... Some programming languages provide means to guarantee referential transparency. Some functional programming languages enforce referential transparency for all functions.



No side-effect.....
In computer science, an operation, function or expression is said to have a side effect if it modifies some state variable value(s) outside its local environment, that is to say, has an observable effect besides returning a value (the main effect) to the invoker of the operation



 (05). Discuss the key features of Object Oriented Programming?


 Abstraction class:
Abstractions refer to the act of representing essential features without including background details or explanation. They are commonly known as Abstraction Data Type(ADT).
Encapsulation:
The wrapping up of data and functions into a single unit is known as encapsulation. Data encapsulation is a striking feature of a class. The data is not accessible to the outside world, and only those functions which are wrapped in the class can access it. These functions provide the interface between the object's data and the program.
Inheritance:
Inheritance is the process by which objects of one class acquire the properties of an object of another class. The class whose members are inherited is called the Base class and the class that inherits those members is called Derived class. It supports class of hierarchical classification.
The concept of inheritance provides the ideas of reusability. This means we can add essential features to an exciting class without modifying it.
Polymorphism:
Polymorphism is another OOP concept. Polymorphism means the ability to take more than one form. An operation may exhibit different behaviors in different instances.

(06). How the event-driven programming is different from other programming paradigms?  


Event programming seems to be similar to how hardware buses work.
 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.


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.




  • Focus on the events triggered outside the system
  • User events (Click, drag/drop, key-press, etc.) 
  • Schedulers/timers •Sensors, messages, hardware interrupts 
  • Mostly related to the systems with GUIs, where the users can interact with the GUI elements
  • An internal event loop (main loop) is used to identify the events and then call the necessary handlers 
  • Can be seen as inverting the control to the event machine 
  • The event machine calls your code as the events trigger


In an Event Driven Language (Kernel, JavaScript), there is no pre-set flow, no distinct start, and end of a program.
 A programmer cannot know which function will be called at what time
Event-driven programs execute based on the events performed on the program. So, if the key is pressed, the program will execute some set of instructions. Otherwise, it will be in an idle state.

If you mean languages like c, c++ as traditional language, then they are procedural languages.

It means they will execute different sets of instructions based on the procedure that has been mentioned in the program itself. Like, the program will go to the next state if and only if it has a value in some specific variable.                          

(07). Compare and contrast the Compiled languages, Scripting languages, and Markup languages?
Compiled languages...

Compiled Languages Computers do not actually understand the code we write. We need to translate our human-readable code to machine-readable code. Our code needs to be translated into bits and bytes that can be executed by computers. This translation process is called compilation. Languages that require compilation are called compiled languages. C, C++, and Java have compiled languages.


Some executables can be directly run on the OS (C on Windows)
 Some executables use virtual runtime machines (JAVA, .NET)
Some languages that are commonly considered to be compiled:
  • Ada.
  • ALGOL. ALGOL 60. ALGOL 68. SMALL.
  • BASIC. Visual Basic. PureBasic.
  • C++ Objective-C. Swift. C# (to bytecode) Java (to bytecode)
  • CLEO.
  • COBOL.
  • Cobra.
  • Crystal.

Scripting languages.....
Languages that not require compilation are called scripting languages. Perl, PHP, Python, and Ruby are scripting languages. Those languages rely on our source-code all the time. Scripting languages didn’t have a compiler or a compilation process. Those languages used interpreters to translate our source-code to machine executable code on the fly
    • Java. ...
    • JavaScript. ...
    • C# ...                                                           


    • C++ ...
    • Python. ...
    • PHP. ...
    • Ruby on Rails.

Markup languages........
A language designed to format text. It does the transition of raw text into structured documents by using markup tags into the raw text. The text given inside the tags is structured by the browsers depending on the markup. Programming languages are compiled. But in the markup language is just interpreted by the browser.

Few Markup Languages are HTML.XML, XHTML, and MML


  • There is no execution process for the markup languages 
  • The tools who have the knowledge to understand the markup languages can render(generate) the output 
example:
 HTML, XML,XHTML

(08). Discuss the role of the virtual runtime machines?  
A virtual machine (VM) is an operating system (OS) or application environment that is installed on software, which imitates dedicated hardware. The end user has the same experience on a virtual machine as they would have on dedicated hardware.
 The virtual machine function is a function for the realization of the virtual machine environment. This function enables you to create multiple independent virtual machines on one physical machine by virtualizing resources such as the CPU, memory, network, and disk that are installed on a physical machine.
Best virtual machines...
    • Parallels Desktop 13.                           
    • Oracle VM Virtualbox.
    • VMware Fusion and Workstation.
    • QEMU.
    • Red Hat Virtualization

(09). Find how the JS code is executed (What is the runtime? where do you find the interpreter?)  

Execution context (EC) is defined as the environment in which the JavaScript code is executed. ... Functional execution context (FEC): Functional execution context is defined as the context created by the execution of code inside a function. Each function has it's own execution context. It can be more than one.

Runtime Environment.

Each browser has a JS Runtime Environment. ... AJAX, the DOM tree, and other API's, are not part of Javascript, they are just objects with properties and methods, provided by the browser and made available in the browser's JS Runtime Environment. Also in the runtime environment is a Javascript Engine that parses the code

Interpreter...

A program such as C++ or Java needs to be compiled before it is run. The source code is passed through a program called a compiler, which translates it into bytecode that the machine understands and can execute. ... Instead, an interpreter in the browser reads over the JavaScript code, interprets each line, and runs it.

(10). Explain how the output of an HTML document is rendered, indicating the tools used to display the output?



  • Step 1: Start with content. As a starting point, we’ll write up raw text content and see what browsers do with it.
  • Step 2: Give the document structure. You’ll learn about HTML element syntax and the elements that give a document its structure.
  • Step 3: Identify text elements. You’ll describe the content using the appropriate text elements and learn about the proper way to use HTML.
  • Step 4: Add an image. By adding an image to the page, you’ll learn about attributes and empty elements.
  • Step 5: Change the page appearance with a style sheet. This exercise gives you a taste of formatting content with Cascading Style Sheets


(11). Identify different types of CASE tools, Workbenches, and Environments for different types of software systems (web-based systems, mobile systems, IoT systems, etc.)?

     Computer-aided software engineering (CASE) used to save labor works and instead of that, it provides a set of tools that we can use to software development. 

CASE tools - Simply those are software applications which we are used to automating the Software Development Life Cycle. We can divide Case tools into the main three categories, based on the use of the software in SDLC(Software Development Life Cycle),
  • Upper - support analysis and design sectors
  • Lower - support coding, testing, and maintenance sector.
  • Integrated - also known as I-CASE and support from requirement gathering to coding throughout the SDLC.
Upper and lower CASE tools are named as so, because of where the sections they used are in the Waterfall Model.


Examples:- Flow Chart Maker, EPF Composer, Trac Project, Doxygen, Accept 360, Animated Software Design, Git,  Eclipse, Mockup Builder, Fontello, SoapTest, Bugzilla

CASE workbenches - Those are set of integrated tools, that used in specific software life cycle stage. CASE tools used widely in the globe to support analysis & design, programming and testing.

·         The integration method can be separated into two categories, 

  • Public: the consumer can add their own tools to a workbench. open workbench.
  • Proprietary: Adding third-party tools is prohibited. closed workbench.
The advantages of open workbenches,

  • New tools can be included
  • The outputs of the tools can be transfer to other systems, Example:- Style management system
  • More complex tools can be deploy
  • vary of tool makers can be used
Types of Workbenches,
  • Programming
  • Analysis and design
  • Testing
CASE Environment - An environment is a set of CASE tools or workbenches that cooperate to help the complete software process. Each tool that responsible for a specific task or a specific part of the life-cycle that assigned to them

CASE environments classified as,


  • Toolkits
  • Fourth-Generation
  • Language-centered
  • Integrated
  • Process-centered
There is CASE Environment Reference model and it includes following five levels,

  • Data repository services
  • Data integration services 
  • Task management 
  • Message services 
  • User interface services 

By considering following facts we can use that CASE Tools,Workbenches and Environments to Web-Based Application development, Mobile app development and any other development in efficient way. It will produce a well structured Application.

(12). Discuss the difference between framework, library, and plugin, giving some examples?


This Video will show the difference between framework and library


Framework...
In a framework, all the control flow is already there and there are many predefined white spots that we should fill out with our code
A framework is normally more complex. It defines a skeleton where the application defines its own features to fill out the skeleton. 

The framework will provide you with hooks and call-backs so that you build on it; it will then call your plugged-in code whenever it wishes, a phenomenon called Inversion of Control.
A framework can contain libraries. A framework will usually include many libraries to make your work easier
  • The framework is a collection of libraries, tools, rules, structures, and control, to build software systems
At development time,
  • Create the structure of the application 
  • Place your code in necessary places 
  • You may use the given libraries to write your code 
  • You can include additional libraries and plugins 
At runtime,
  • The framework will call your code (inverse of control)


Library...
library performs specific, well-defined operations. A library is just a collection of class definitions. The reason is it simply code reuse, in other words, gets the code that has already been written by other developers. The classes and methods normally define specific operations in a domain-specific area. 

 A library will usually focus on a single piece of functionality that you access using an API. 

You call a library function, it executes some code and then the control is returned to your code.

Advantage...
Advantages of frameworks over libraries are flexibility and extensibility. By definition, a framework provides you with the necessary means to extend its behavior. You often can even subclass the framework classes and provide complete new functionality.
Disadvantage...
The disadvantage of frameworks is that the temptation to add more and more functionality creates many bloated frameworks that result in immobility and needless complexity.

Plugin...

A plugin is a software addon that we installed that on a program, it increases its usability. For example, if you need to play a game on a website, you may wanted a plugin to play it because your browser haven't the tools to play the game.
  • Plugins provide specific tools for development
At development time,

  • The plugin (source code files, modules, packages, executables, etc.) is placed in the project, 
  • Apply some configurations using code 
At runtime,
  • The plug-in will be invoked via the configurations



Difference between JDK and JRE?
JDK...

1. Allows depending and running java program.

2.Consists of JRE and other development tools.
examples...
javac, jar, javap
JRE...
1.only allows running java programs
2.consist of JVM, class libraries and other supporting files
example...
java,rt.jar, javaw


Why we should have to edit path after installing?
  • Because we need to give the path for VM WARE (after the open a virtual machine)

Why we need to set JAVA_HOME?

  • If you installed java JDK then that's the JAVA_HOME.
  • where the java run time environment(JRE)is stalled in your computer...
What is the different is path and JAVA_HOME?
the path is already you create a folder for an installed to Java JDK.
JAVA_HOME is a place of you before installing by Java JDK.

JAVA IDE's and a comparison of them?
  • Popular IDE for JAVA...
example...
Eclipse
NetBeans
BlueJ

Comments

Popular posts from this blog

Tutorial 02 – Industry Practices and Tools 1 Article

THE CLIENT-SIDE DEVELOPMENT

RESTful Web services