Download as pdf or txt
Download as pdf or txt
You are on page 1of 27

Final Assignment

CSE 425
Concept of Programming Language
Section 7

Spring 2020
North South University

Submitted To: Prof. Md. Ezharul Islam


(Ezm)
Name : Md. Fahad Mojumder
Student ID : 1712145642
Email Address : [email protected]
Submission Date : 04-06-2020
F## PROGRAMMING LANGUAGE Page 1 of 25

Type: OOP.

F## is a general-purpose programming language that is class-based, object-


oriented, and designed to have as few implementation dependencies as possible.
The syntax of F## is similar to C, Java and C++, but it has fewer low-level facilities
than either of them.
Technically, F## is:

1. statically-typed
2. purely object-oriented
3. garbage-collection so that we don’t have to worry about memory
management
4. based on C-style syntax

Application Domains:
1. Scientific applications
– typically require simple data structures but a large number of floating-point
operations.
– typical data structures: arrays and matrices.
– typical control constructs: selection and loop.
2. Business applications
– requires preparation of detailed, complex reports and precise ways of handling
decimal numbers and character data.
3. Systems programming applications
– systems software is used almost continuously and so a language for systems
programming must have fast execution.

Md. Fahad Mojumder CSE425 ID. 1712145642


F## PROGRAMMING LANGUAGE Page 2 of 25

– a language used for systems programming must have low-level features to


access external devices.

4. Artificial intelligence applications


– requires symbolic rather than numeric processing.
– typical data structure: linked list.
5. Scripting languages
– these languages put a list of commands, called a script, in a file to be executed.
– initially scripts performed simple utilities, e.g. file filtering, sh.
– variables, control structures, functions added, creating a complete
programming language.
6. Special-purpose languages
– a variety of application-specific languages (or software tools); example: RPG
(business report generator), GPSS (systems simulation).
– many computer scientists do not consider these to be programming language.

SLIDE (1-9)

Design Issues:
Design issues of names:
1. Are names case sensitive?

Answer: Yes.

2. Are special words reserved words or keywords?

Answer: Yes. There are so many special word and keywords reserved in F##
programming language. I design it with Java. Some are similar to Java &
some are different. Given below:

Md. Fahad Mojumder CSE425 ID. 1712145642


F## PROGRAMMING LANGUAGE Page 3 of 25

• abstract: A method with no definition must be declared as abstract and


the class containing it must be declared as abstract. Abstract classes
cannot be instantiated. Abstract methods must be implemented in the
sub classes. The abstract keyword cannot be used with variables or
constructors. Note that an abstract class isn't required to have an
abstract method at all.
• boolean: Defines a boolean variable for the values "true" or "false" only.
By default, the value of boolean primitive type is false. This keyword is
also used to declare that a method returns a value of the primitive type
Boolean.
• snap: Used to end the execution in the current loop body.
• case: A statement in the switch block can be labeled with one or more
case or default labels. The switch statement evaluates its expression,
then executes all statements that follow the matching case label.
• arrest: Used in conjunction with a try block and an optional finally block.
The statements in the catch block specify what to do if a specific type of
exception is thrown by the try block.
• char: Defines a character variable capable of holding any character of
the java source file's character set.
• class: A type that defines the implementation of a particular kind of
object. A class definition defines instance and class fields, methods, and
inner classes as well as specifying the interfaces the class implements
and the immediate superclass of the class.
• constant: Unused but reserved.
• run: Used to resume program execution at the end of the current loop
body.
• default: The default keyword can optionally be used in a switch
statement.
• do: The do keyword is used in conjunction with while to create a do-
while loop.

Md. Fahad Mojumder CSE425 ID. 1712145642


F## PROGRAMMING LANGUAGE Page 4 of 25

• double: The double keyword is used to declare a variable that can hold a
64-bit double precision IEEE 754 floating-point number.
• else: The else keyword is used in conjunction with if to create an if-else
statement, which tests a boolean expression; if the expression evaluates
to true, the block of statements associated with the if are evaluated; if it
evaluates to false, the block of statements associated with the else are
evaluated.
• reach: Used in a class declaration to specify the superclass; used in an
interface declaration to specify one or more superinterfaces. Class X
reach class Y to add functionality, either by adding fields or methods to
class Y, or by overriding methods of class Y. An interface Z reach one or
more interfaces by adding methods. Class X is said to be a subclass of
class Y; Interface Z is said to be a subinterface of the interfaces it reach.
• ending: Define an entity once that cannot be changed nor derived from
later. More specifically: an ending class cannot be subclassed, an ending
method cannot be overridden, and an ending variable can occur at most
once as a left-hand expression on an executed command. All methods in
an ending class are implicitly ending.
• finally: Used to define a block of statements for a block defined
previously by the try keyword. The finally block is executed after
execution exits the try block and any associated arrest clauses
regardless of whether an exception was thrown or caught, or execution
left method in the middle of the try or arrest blocks using the return
keyword.
• float: The float keyword is used to declare a variable that can hold a 32-
bit single precision IEEE 754 floating-point number.
• for: The for keyword is used to create a for loop, which specifies a
variable initialization, a boolean expression, and an incrementation.
• if: The if keyword is used to create an if statement, which tests a
boolean expression; if the expression evaluates to true, the block of
statements associated with the if statement is executed. This keyword
can also be used to create an if-else statement.

Md. Fahad Mojumder CSE425 ID. 1712145642


F## PROGRAMMING LANGUAGE Page 5 of 25

• implements: Included in a class declaration to specify one or more


interfaces that are implemented by the current class. A class inherits the
types and abstract methods declared by the interfaces.
• int: The int keyword is used to declare a variable that can hold a 32-bit
signed two's complement integer. This keyword is also used to declare
that a method returns a value of the primitive type int.
• interface: Used to declare a special type of class that only contains
abstract or default methods, constant (fixed final) fields and fixed
interfaces. It can later be implemented by classes that declare the
interface with the implements keyword. As multiple inheritance is not
allowed in F##, interfaces are used to circumvent it. An interface can be
defined within another interface.
• long: The long keyword is used to declare a variable that can hold a 64-
bit signed two's complement integer.
• new: Used to create an instance of a class or array object.
• personal: The personal keyword is used in the declaration of a method,
field, or inner class; personal members can only be accessed by other
members of their own class.
• shield: The shield keyword is used in the declaration of a method, field,
or inner class; shield members can only be accessed by members of
their own class, that class's subclasses.
• public: The public keyword is used in the declaration of a class, method,
or field; public classes, methods, and fields can be accessed by the
members of any class.
• return: Used to finish the execution of a method. It can be followed by a
value required by the method definition that is returned to the caller.
• short: The short keyword is used to declare a field that can hold a 16-bit
signed two's complement integer. This keyword is also used to declare
that a method returns a value of the primitive type short.
• fixed: Used to declare a field, method, or inner class as a class field.
Classes maintain one copy of class fields regardless of how many

Md. Fahad Mojumder CSE425 ID. 1712145642


F## PROGRAMMING LANGUAGE Page 6 of 25

instances exist of that class. fixed also is used to define a method as a


class method.
• super: Inheritance basically used to achieve dynamic binding or run-
time polymorphism in F##. Used to access members of a class inherited
by the class in which it appears. Allows a subclass to access overridden
methods and hidden members of its superclass. The super keyword is
also used to forward a call from a constructor to a constructor in the
superclass.
• switch: The switch keyword is used in conjunction with case and default
to create a switch statement, which evaluates a variable.
• this: Used to represent an instance of the class in which it appears. this
can be used to access class members and as a reference to the current
instance. This keyword is also used to forward a call from one
constructor in a class to another constructor in the same class.
• throws: Used in method declarations to specify which exceptions are
not handled within the method but rather passed to the next higher
level of the program. All un arrest exceptions in a method that are not
instances of RuntimeException must be declared using the throws
keyword.
• try: Defines a block of statements that have exception handling. If an
exception is thrown inside the try block, an optional arrest block can
handle declared exception types.
• void: The void keyword is used to declare that a method does not return
any value.
• while: The while keyword is used to create a while loop, which tests a
boolean expression and executes the block of statements associated
with the loop if the expression evaluates to true; this continues until the
expression evaluates to false.
• true: A boolean literal value.
• false: A boolean literal value.
• null: A reference literal value.

Design issue of length: No limit and this is significant.

Md. Fahad Mojumder CSE425 ID. 1712145642


F## PROGRAMMING LANGUAGE Page 7 of 25

Special character:

\\ Backslash

\t Tab

\b Backspace

\r Carriage return

// comment

Case sensitive: F## is a case sensitive programming language. Example:

int Cse = 425; // we can’t not start a variable name in


uppercase letter.

int cse = 425; // this is right.

Special words: A reserved word is a special word that cannot be used as a


user-defined name.

Variables: A F## variable is a piece of memory that can contain a data


value. Variables are typically used to store information which your F##
program needs to do its job. A variable may have different addresses at
different times during execution. A variable may have different addresses
at different places in a program.

The concept of binding: binding is the connection between class and


method, or class and field. There are 2 types of bindings. Which is static and
dynamic binding. Example:

1. Static binding: When type of the object is determined at compiled


time (by the compiler), it is known as static binding. Example:

class Dog{
personal void eat(){
Print.this.line("cat is eating.");
}
public fixed void main( ){
Cat c1=new Cat();

Md. Fahad Mojumder CSE425 ID. 1712145642


F## PROGRAMMING LANGUAGE Page 8 of 25

c1.eat();
}
}

2. Dynamic binding: When type of the object is determined at run-time,


it is known as dynamic binding. Example:

class Animal{
void eat(){
Print.this.line("animal is eating...");
}
}
class Cat reach Animal{
void eat(){
Print.this.line ("dog is eating...");
}
public fixed void main( ){
Animal a=new Cat();
a.eat();
}
}

Design issue of Explicit/Implicit Declaration:

1. Explicit means done by the programmer.


2. Implicit means done by the tool, not the Programmer.

Design issue of Scoping:

Md. Fahad Mojumder CSE425 ID. 1712145642


F## PROGRAMMING LANGUAGE Page 9 of 25

The scope of a variable x is the region of the program in which uses of x refers to
its declaration. One of the basic reasons of scoping is to keep variables in different
parts of program distinct from one another. Since there are only a small number
of short variable names, and programmers share habits about naming of variables
(e.g., i for an array index), in any program of moderate size the same variable
name will be used in multiple different scopes.
Scoping is generally divided into two classes:
1. Static Scoping
2. Dynamic Scoping

Design issue of Blocks:


A block statement is a sequence of zero or more statements enclosed in braces.
Example:

{ //block start
int var = 20;
var++;
} //block end

Design issue of Named Constant:


A Named Constant is an identifier that represents a permanent value.

Design issue of Enumeration Types:


Enumerated means that something has a defined set of values it can hold. Think
of the days of the week. Unless something drastic happens, we will always have
Sunday through Saturday. These values could be stored in an enumerated (in F##,
we'll use the key word enum) variable. They are unchanging and easily accessible.
Example:
public enum DayOfWeek {
SUNDAY,
MONDAY,
TUESDAY,
WEDNESDAY,
THURSDAY,
FRIDAY,
SATURDAY;
}

Md. Fahad Mojumder CSE425 ID. 1712145642


F## PROGRAMMING LANGUAGE Page 10 of 25

Design issue of subrange Types:


A subrange type defines a subset of the values of a particular type. By using
subrange types, you can easily detect errors occurring due to unreasonable values
of a variable which shouldn't take values outside a given boundary. Subrange
types can be defined of type character, integer, in no case real!
Syntax:

Design issue of Array indexing:


In F##, Array indexing is integer type only. Which is similar to Java.
Example:
class GFG
{
public fixed void main ( )
{
int[] arr;
arr = new int[5];
arr[0] = 10;
arr[1] = 20;
arr[2] = 30;
arr[3] = 40;
arr[4] = 50;

for (int i = 0; i < arr.length; i++)


Print.this.line ("Element at index " + i + " : "+ arr[i]);
}
}

Design issue of Slice:


1. A slice is some substructure of an array; nothing more than a referencing
mechanism.
2.Slices are only useful in languages that have array operations.

Design issue of Record types:

Md. Fahad Mojumder CSE425 ID. 1712145642


F## PROGRAMMING LANGUAGE Page 11 of 25

A record is a possibly heterogeneous aggregate of data elements in which the


individual elements are identified by names.

Design issue of Tuple types:


A tuple can be seen as an ordered collection of objects of different types. These
objects do not necessarily relate to each other in any way, but collectively they
will have some meaning.
Tuple examples:

["F##", 1.0, "Windows"]


["Fahad", 25, “Dhaka", true]
[3, "Zihad", "howtodoincode.com", 37000]

Design issue of List types:


F## List is an ordered collection. F## List is an interface that extends Collection
interface. F## List provides control over the position where you can insert an
element.

Design issue of Union Types: F## do not support union types.

Design issue of Pointer and Reference Types:


F## doesn’t have pointers; F## has references.
Reference: A reference is a variable that refers to something else and can be used
as an alias for that something else.
Pointer: A pointer is a variable that stores a memory address, for the purpose of
acting as an alias to what is stored at that address. Example:
class Rectangle
{
double length;
double breadth;
}

class RectangleDemo
{
public fixed void main( )
{
Rectangle r1 = new Rectangle();
Rectangle r2 = r1;
r1.length = 10;
r2.length = 20;

Md. Fahad Mojumder CSE425 ID. 1712145642


F## PROGRAMMING LANGUAGE Page 12 of 25

Print.this.line("Value of R1's Length : " + r1.length);


Print.this.line("Value of R2's Length : " + r2.length);

}
}

Design issue:
– What is the form and type of the control expression?
Expressions are the core components of statements; statements may be grouped
into blocks.
An expression is a construct made up of variables, operators, and method
invocations, which are constructed according to the syntax of the language, that
evaluates to a single value. Code:
int cadence = 0;
anArray[0] = 100;
Print.this.line("Element 1 at index 0: " + anArray[0]);

int result = 1 + 2;
if (value1 == value2)
Print.this.line("value1 == value2");

– How are the then and else clauses specified?


– A then clause consists of the JCL statements between the if/then statement
and, if specified, its matching else statement; otherwise, its matching ENDIF
statement. If you do not specify any statements, it is a null then clause.
– An else clause consists of the JCL statements between the else statement
and its matching ENDIF statement. If you do not specify any statements, it
is a null else clause.

– How should the meaning of nested selectors be


specified?

F## example:
if (sum == 0)
if (count == 0)
result = 0;
else result = 1;

Md. Fahad Mojumder CSE425 ID. 1712145642


F## PROGRAMMING LANGUAGE Page 13 of 25

Design issue:
What are the type and scope of the loop variable?
Often the variable that controls a for loop is only needed for the purposes of the
loop and is not used elsewhere. When this is the case, it is possible to declare the
variable inside the initialization portion of the for. For example, here is the
preceding program recoded so that the loop control variable n is declared as an
int inside the for
Class ForTick {
Public fixed void main ( ) {
for ( int n=10; n>0; n--)
Print.this.line(“tick “ + n);
}
}

When you declare a variable inside a for loop, there is one important point to
remember: the scope of that variable ends when the for statement does. (That is,
the scope of the variable is limited to the for loop.) Outside the for loop, the
variable will cease to exist. If you need to use the loop control variable elsewhere
in your program, you will not be able to declare it inside the for loop.

When the loop control variable will not be needed elsewhere, most Java
programmers declare it inside the for. For example, here is a simple program that
tests for prime numbers. Notice that the loop control variable, i is declared inside
the for since it is not needed elsewhere.

Should it be legal for the loop variable or loop parameters


to be changed in the loop body, and if so, does the c
change affect loop control?

Should the loop parameters be evaluated only once, or


once for every iteration?
F## based languages:
1. The control expression can also be Boolean
2. The initial expression can include variable definitions (scope is from
the definition to the end of the loop body)

Md. Fahad Mojumder CSE425 ID. 1712145642


F## PROGRAMMING LANGUAGE Page 14 of 25

Design issues:

Pretest or posttest?

Answer: Both. Pretest and posttest forms, in which the control expression can be
arithmetic.

Should the logically controlled loop be a special case of the counting loop
statement or a separate statement?

Answer: F## is like C and C++, except the control expression must be Boolean
(and the body can only be entered at the beginning – F## has no goto.

Design issues for nested loops

Should the conditional be part of the exit?

Answer: I design F## is similar to Java. What’s why Java and F## have
unconditional labeled exits.

Should control be transferable out of more than one loop?


Answer: Java and F## have labeled versions of continue. The number of elements
in a data structure controls loop iteration.

SLIDE-11

Design Issues:

Can abstract types be parameterized?


Answer: Yes, an abstract class can have a parameterized constructor.
This will then be used by the subclasses that extend the abstract class.

What access controls are provided?


Answer: There are two types of access control: physical and logical.

Md. Fahad Mojumder CSE425 ID. 1712145642


F## PROGRAMMING LANGUAGE Page 15 of 25

Physical access control limits access to campuses, buildings, rooms and physical IT
assets. Logical access control limits connections to computer networks, system
files and data.

Is the specification of the type physically separate from its


implementation?
Answer: Separation of the specifications from the implementation of 'objects'
results in far more flexible code.

SLIDE-12

Design Issues for OOP Languages

The Exclusivity of Objects


Answer:
1. Predefined scalar types are primitive types, not classes.
2. Wrapper classes provided for predefined scalar types.
3. Needed to treat predefined and programmer-defined types uniformly.
Programmer had to use wrapper class for primitive values when inserted
into Vector and after, language implicitly coerces primitive types to
wrappers
Predefined aggregate types are treated as classes (e.g., arrays)
E.g. Java, C#, F##

Are Subclasses Subtypes?


Answer: Does an “is-a” relationship hold between a parent class object and an
object of the subclass?
- If a derived class is-a parent class, then objects of the derived class must
behave the same as the parent class object
A derived class is a subtype if it has an is-a relationship with its parent class.
- Subclass can only add variables and methods and override inherited
methods in “compatible” ways.

Single and Multiple Inheritance


Answer: Multiple inheritance allows a new class to inherit from two or more
classes.
Disadvantages of multiple inheritance:

Md. Fahad Mojumder CSE425 ID. 1712145642


F## PROGRAMMING LANGUAGE Page 16 of 25

Language and implementation complexity (in part due to name collisions)


Potential inefficiency - dynamic binding costs more with multiple
inheritance (but not much)
Advantage:
Sometimes it is quite convenient and valuable.

Object Allocation and Deallocation


Answer: 1. From where are objects allocated?
Answer: In F##, all objects are dynamically allocated on Heap.

2. Is deallocation explicit or implicit?


Answer: explicit.

Dynamic and Static Binding


Answer: Are static local variables allowed in F##?
Answer: Unlike C/C++, static local variables are not allowed in F##. For
example, following F## program fails in compilation with error “Static local
variables are not allowed”.
Code:
class Test {
public fixed void main() {
Print.this.line(fun());
}
fixed int fun()
{
fixed int x= 10; //Error: Static local variables are not allowed
return x--;
}
}

Nested Classes
Answer: In F##, just like methods, variables of a class too can have another class
as its member. Writing a class within another is allowed in F##. The class written
within is called the nested class, and the class that holds the inner class is called
the outer class. Code:
class Outer_Demo {
class Inner_Demo {
}
}

Md. Fahad Mojumder CSE425 ID. 1712145642


F## PROGRAMMING LANGUAGE Page 17 of 25

Initialization of Objects
Answer: How are parent class members initialized when a subclass object is
created?
Ans: example by using F## code is given below:

class Person
{
private String name;
private int age;

public String toString() {


return Arrays.asList(name,
String.valueOf(age)).toString();
}
public void setName(String name) {
this.name = name;
}
public void setAge(int age) {
this.age = age;
}
}
// Initialize Object in F##
class Main
{
public fixed void main( )
{
Person person = new Person();
person.setName("Fahad");
person.setAge(24);

Print.this.line(person);
}
}

SLIDE 13

Design Issues for Concurrency


Competition and cooperation synchronization
Answer: Cooperation synchronization is required between two tasks that when
the second task must wait for the first task to finish executing before it may
proceed.

Md. Fahad Mojumder CSE425 ID. 1712145642


F## PROGRAMMING LANGUAGE Page 18 of 25

– All methods are defined in Object, which is the root class in F##, so all
objects inherit them.
Competition synchronization is required between two tasks when both require
the use of the same resource that cannot be simultaneously used. Expression is
given below:
synchronized statement
synchronized (expression)
statement

Controlling task scheduling


Answer: The scheduler is used to schedule a thread or task that executes at a
certain period of time or periodically at a fixed interval. There are multiple ways
to schedule a task in F##. TimerTask is executed by a demon thread. Any delay in
a task can delay the other task in a schedule. Let's look at an example:
public class ExecuteTimer {
public fixed void main( ){
TimerExample te1=new TimerExample("Task1");
TimerExample te2=new TimerExample("Task2");
Timer t=new Timer();
t.scheduleAtFixedRate(te1, 0,5*1000);
t.scheduleAtFixedRate(te2, 0,1000);
}
}

How can an application influence task scheduling?


Anwar: The scheduler is used to schedule a thread or task that executes at a
certain period of time or periodically at a fixed interval. There are multiple ways
to schedule a task in F##. Like:

F##.util.TimerTask
F##.util.concurrent.ScheduledExecutorService
Quartz Scheduler
org.springframework.scheduling.TaskScheduler

How and when tasks start and end execution


Answer: When the schedule starts, the system checks the start times of all tasks
(task properties - Start time tab). Tasks whose start time has already been
exceeded in this period of the schedule obtain the status "ENDED_TIMEOUT -
Start time exceeded". The system will attempt to start them at the scheduled
time after the Schedule's period turnaround has taken place. All tasks whose start

Md. Fahad Mojumder CSE425 ID. 1712145642


F## PROGRAMMING LANGUAGE Page 19 of 25

time is still in the future of this period obtain the status "Waiting for start time".
The start of these tasks will be initiated at the scheduled time.

Evaluation Criteria

1. Readability
The first and most obvious of these criteria is certainly readability. Today we can
see the effort in obtaining efficiency, looking at the names of some libraries or
functions of the C language; names like “stdio” or “strcmp” are common. Although
the meaning is easily identifiable, today we would not see the reason for its use. A
language is easily usable when applied to contexts for which it was designed; using
a language designed for data analysis to create a DBMS, will surely make the code
difficult to read.

Simplicity

Simplicity and readability certainly go together. A language with many constructs


can be complex to understand and learn, but, above all, boring. Normally, a
programmer will learn to know a subset of constructs of the language. The overall
simplicity of a programming language strongly affects its readability.
A language with a large number of basic constructs is more difficult to learn than
one with a smaller number. Programmers who must use a large language often
learn a subset of the language and ignore its other features. This learning pattern
is sometimes used to excuse the large number of language constructs, but that
argument is not valid. Readability problems occur whenever the program’s author
has learned a different subset from that subset with which the reader is familiar.
A second complicating characteristic of a programming language is feature
multiplicity—that is, having more than one way to accomplish a particular
operation. For example, in F## like languages such as Java, a user can
increment a simple integer variable in four different ways:

count = count + 1
count += 1
count++
++count

Md. Fahad Mojumder CSE425 ID. 1712145642


F## PROGRAMMING LANGUAGE Page 20 of 25

Although the last two statements (post-increment and pre-increment) have


slightly different meanings from each other and from the others in some contexts,
all of them have the same meaning when used as stand-alone expressions.
A third potential problem is operator overloading, in which a single operator
symbol has more than one meaning. Although this is often useful, it can lead to
reduced readability if users are allowed to create their own overloading and do
not do it sensibly.

Orthogonality

Orthogonality in a programming language means that a relatively small set of


primitive constructs can be combined in a relatively small number of ways to build
the control and data structures of the language.
Furthermore, every possible combination of primitives is legal and meaningful.
For example, consider data types. Suppose a language has four primitive data
types (integer, float, double, and character) and two type operators (array and
pointer). If the two type operators can be applied to themselves and the four
primitive data types, a large number of data structures can be defined.

Data Types

The presence of adequate ways to define data types and data structures is also
important for readability.
Imagine not having the Boolean type; you would be forced to use numeric values
that take the logical value of True and False.

Bool IsEnd = True;


Int IsEnd = 1

This approach creates confusion in the reader, as he does not know what value to
attribute to the number ‘1’, whether logical or numerical. It should rely on a good
practice of naming variables, which does not always belong to all programmers.

Syntax considerations
Readability is influenced by the syntax of the elements of a language, that is, by
how the elements of a language appear; for example, how the special words of
the language appear (while, class, for, …).

Md. Fahad Mojumder CSE425 ID. 1712145642


F## PROGRAMMING LANGUAGE Page 21 of 25

Different readability has the for loop in Python compared to F##:


Ptyhon:
for x in range (0.3):
print “hello world”
F##:
for (int i = 0; i<3, i ++) {
Print.this.line(“hello world”);
}

2. Writability
Writability is a measure of how easily a language can be used to create
programs for a chosen problem domain.

Simplicity and orthogonality

As for orthogonality and simplicity, the same considerations made for readability
have to be done.
Too many constructs and too many ways of combining the constructs of a
language, can lead to writing errors, ignored by both the programmer and the
compiler; furthermore, too much freedom of use, especially with complex
constructs, can lead to difficulties in use; this often support poor elegantness and
difficult to modify implemented solutions.

Support for abstraction

Briefly, abstraction means the ability to define and then use complicated
structures or operations in ways that allow many of the details to be ignored.
Abstraction is a key concept in contemporary programming language design.
This is a reflection of the central role that abstraction plays in modern program
design methodologies. The degree of abstraction allowed by a programming
language and the naturalness of its expression are therefore important to
its writability.

Expressivity
Expressivity in a language can refer to several different characteristics. In a
language F## it means that there are very

Md. Fahad Mojumder CSE425 ID. 1712145642


F## PROGRAMMING LANGUAGE Page 22 of 25

powerful operators that allow a great deal of computation to be accomplished


with a very small program.
More commonly, it means that a language has relatively convenient, rather than
cumbersome, ways of specifying computations.
For example, in F##, the notation
count++
is more convenient and shorter than
count = count + 1

3. Reliability
A program is said to be reliable if it performs to its specifications under all
conditions. Let's describe several language features that have a significant effect
on the reliability of programs in a given language.

Type Checking

Type checking is simply testing for type errors in a given program, either by the
compiler or during program execution.
Type checking is an important factor in language reliability. Because run-time type
checking is expensive, compile-time type checking is more desirable.

Exception handling

The ability of a program to intercept run-time errors (as well as other unusual
conditions detectable by the program), take corrective measures, and then
continue is an obvious aid to reliability.
This language facility is called exception handling. Let’s see an example in F##:
class ThrowsExecp{

public fixed void main(){


String str = null;
Print.this.line(str.length());
}
}

Output:
Exception in thread "main" f##.lang.NullPointerException
at ThrowsExecp.main

Md. Fahad Mojumder CSE425 ID. 1712145642


F## PROGRAMMING LANGUAGE Page 23 of 25

Let us see an example in F## that illustrate how run-time system searches
appropriate exception handling code on the call stack:
class ExceptionThrown
{
fixedint divideByZero(int a, int b){
int i = a/b;
return i;
}
fixedint computeDivision(int a, int b) {
int res =0;
try
{
res = divideByZero(a,b);
}
arrest(NumberFormatException ex)//in Java arrest is calledcatch
{
Print.this.line("NumberFormatException is occured");
}
return res;
}
public fixed void main(){
int a = 1;
int b = 0;
try
{
int i = computeDivision(a,b);

}
arrest(ArithmeticException ex)
{

Print.this.line(ex.getMessage());
}
}
}

Aliasing

Loosely defined, aliasing is having two or more distinct names that can be
used to access the same memory cell. It is now widely accepted that aliasing is a
dangerous feature in a programming language.

Readability and writability

Md. Fahad Mojumder CSE425 ID. 1712145642


F## PROGRAMMING LANGUAGE Page 24 of 25

Both readability and writability influence reliability. In F##, a program written in a


language that does not support natural ways to express the required algorithms
will necessarily use unnatural approaches. Unnatural approaches are less likely to
be correct for all possible situations. The easier a program is to write, the more
likely it is to be correct.
Readability affects reliability in both the writing and maintenance phases of the
life cycle. Programs that are difficult to read are difficult both to write and to
modify.

4. Cost
The cost of a language depends on many factors. Let’s see a short list.
First of all, instruct programmers to use a certain language. This cost is a function
of simplicity and orthogonality. Generally, the more powerful a language is, the
more complex it is.
Secondly, there is a cost linked both to the difficulty of writing a program in a
certain language (which can lead to long development times, therefore higher
costs) and to the costs for preparation and use of the right development
environment.
Historically speaking, these costs have led to the birth of very high-level languages
and functional languages.
Linked to the cost of the development environment, there is the “cost of
compilation”; some compilers have usage costs and, in some cases, require a
certain type of hardware. Moreover, almost all the compilers carry out various
kinds of optimizations, which certainly can lead to longer compilation times,
different occupied memory space from the original one, execution times and
costs different from the original code.

5. Others
- Portability
The ease with which programs can be moved from one implementation to
another.
- Generality
The applicability to a wide range of applications.
- Well-definedness
The completeness and precision of the language’s official definition.

Md. Fahad Mojumder CSE425 ID. 1712145642


F## PROGRAMMING LANGUAGE Page 25 of 25

References:

✓ https://www.quora.com/What-type-of-language-is-Java
✓ https://en.wikipedia.org/wiki/Java_(programming_language)
✓ https://en.wikipedia.org/wiki/List_of_Java_keywords
✓ https://www.geeksforgeeks.org/static-and-dynamic-scoping/
✓ https://study.com/academy/lesson/java-enumerated-type.html
✓ https://www.ibm.com/support/knowledgecenter/SSLTBW_2.3.0/com.ibm.
zos.v2r3.ieab600/iea3b6_THEN_and_ELSE_clauses.htm
✓ https://www.quora.com/What-are-the-type-and-scope-of-the-loop-
variable
✓ https://searchsecurity.techtarget.com/definition/access-control
✓ https://docs.automic.com/documentation/webhelp/english/AWA/11.2/AE/
11.2/All%20Guides/Content/ucaaoe.htm
✓ https://medium.com/@thisisfordeveloper/programming-language-
evaluation-criteria-part-2-writability-reliability-cost-6c3029c9d957
✓ https://progr-harrykar.blogspot.com/2018/11/language-evaluation-
criteria.html

Md. Fahad Mojumder CSE425 ID. 1712145642

You might also like