Programming Languages and Frameworks

Programming is at the core of software engineering — the mystic art which I have discussed here. Programming is the process of instructing your computer machine to perform a task, be that as simple as a calculation task, a multithreaded graphical application, or a data science project. They can all be programmed by a programmer, so that a computer can easily follow the steps necessary and provide the end user with results.

Some might argue, and emphasis on the generations of languages, the level of language and how simpler/neater a language might be. Sadly, I am not one of them. Because once we dig deeper into the discussion, it becomes impossible to reach out, because it starts with a low-level language, → goes to high-level language → and then compiled languages, → interpreted languages, and so on and so forth. Instead of writing that here, I can give you an overview of the concepts in a separate chapter where they will make more sense and will not push you off the site. Secondly, I will introduce you to the concepts of the language from the perspective of a developer/programmer of that particular language. Then of course, who would want to miss the object-oriented programming and the competition with a functional programming language?

Programming Languages

A programming language is a language (code, script... you name the term) in which the instructions for a computer are written. In most common and easy to understand way, a programming language is the bridge between human commands, and computer processing. A language provides an easy way for a programmer to instruct a computer to perform a task. Computer best follows the instructions that are fed into it, and a programming language allows programmers to write "logical" code, and not the code that compiles and executes. Every programming language has,

  1. Syntax — that defines the structure of language
    • Syntax is used to write the programs, in a structured format
    • Many language orientations are developed and they have their own syntax
      • C#, C++ and Java being object-oriented, follow a similar language syntax
      • Python (not a pure functional, but for sake of example), Haskell, F# are functional in nature and have a similar syntax
    • Syntax of a language also defines the features and options a language has
  2. Semantics — meaning of an expression in the language
    • Semantics tell the compiler, or runtime whether an expression is valid or not
    • Semantics are the practices that ensure a program has a logical correction and not just a valid syntax
    • They are the rules that a language has, over the syntax-conditions.

These are the main two elements of a programming language, that each must understand before continuing with a language selection, and development in that language. They are controlled by the level of the language, as well as the orientation that a language has. For instance, take a look at the following two snippets (apologies for taking you directly to a language, directly!),

// C# program
Person p;
p.Name = "Afzaal Ahmad Zeeshan"; // Error, p is uninitialized

That language in expression is because language knows, that this is syntactically correct but semantically incorrect as the p is uninitialized.

// C++ program
person p;
p.name = "Afzaal Ahmad Zeeshan";

Although both are syntactically accurate and should work (it also depends on the type of name in C++ case, but most typically C++ recommends using std::string only), but the C# program shows an error, same would be the true for C++ if we consider the pointers there — C# does that pointer thing for us, internally.

Keeping all the differences aside, the following features are included in almost every programming language,

  1. Expressions
  2. Symbols
  3. Modules
  4. Libraries

What they support for a programmer is the ability to write the programs, in a structural format which makes them easy for a team of programmers to manage, update and debug. At the same time providing the ability to translate them back in the machine language (which is the natural language of a computer). With these structures and concepts, programming languages support high-level features, which abstract away the low-level details of them, and allow programmers to write the logic, more than managing the low-level details. Language translator, takes care of the translation of source code written by the programmer and converting it to the executables.

Expressions

Expressions are the statements, that return or evaluate a value, or switch the control of flow. Now I am not sure, if this is exactly the definition you would hear from your teacher, or from any other book but this is what I believe it is. An expression in a programming language allows the programmers, to create variables, update/modify the variables, issue commands on them as well. However, not only that, it also allows them to control the flow of program execution.

But this is highly language-oriented, in that a programming language might support one feature, and other may/may not. Take a look at the following 2 samples,

// C#, similar in C++ and Java too. 
// Note that, this is not a scope or a function, but example of valid statements and invalid one.

int a = 25; // Valid, stores 25 to the variable named, a

AnotherFunction(); // Valid, takes the control to that module -- AnotherFunction

return 0; // Valid, as in it takes the control back to the caller

4 + 5 // Valid operation, but invalid expression, what to do with the value 9? Where does it go?

"Afzaal Ahmad Zeeshan"; // Invalid, what to do with "Afzaal Ahmad Zeeshan" value? 

And like I have already mentioned above,

a programming language might support one feature, and other may/may not

If you execute the same command of, 4 + 5 in a Python interpreter, or a JavaScript console, you will get the result 9, instead of the invalid expression error. Such as,

// Python, for instance
> 4 + 5
=> 9

> "Afzaal Ahmad Zeeshan"
=> "Afzaal Ahmad Zeeshan"

Then, specifically, there are many language-based expressions, that are only valid in the context of that particular language but at their core, it is always an expression.

Symbols

Symbols are the names, identifiers of your variables, module blocks and other information that a linker must know before linking to your program at execution. They are the placeholders, for the memory addresses of each variable, or module block. Every language has its own way of implementing a symbol table, a symbol table is the table which gets generated when you build a project or a source file, and it contains the symbols for your source code.

Symbol table is used to load up the variables and code blocks in the memory when your program starts to execute. A symbol table does not contain the static memory address (while it can, if programmer intends), but instead it contains the placeholders that get filled by the linkers as your program gets ready to execute, and your program then uses those memory addresses to store the data, call modules, and perform other tasks.

Modules

Modules are blocks of code, programs, or even libraries and their definition belongs to the programming language context, some programming languages do not even use the term module and have their own special keyword or naming convention to appropriately convey the meaning there.

Modules are typically programs, or part of programs with a specific functionality. For instance, in a C++ application it can be a separate program with its own executable file, (.cpp) and a definition (.h), and other programmers can include the header file to program their own applications and then linker does the job of linking both components (your code and the code they wrote) before running, and things just work. In high-level languages, they can come in different shapes and sizes, and even a separate project or resource, or it can be a subproject inside your own project.

Their benefit is that they distribute the code on the basis of their functionality. It lets you work with different features and services, separately and without having to introduce bugs in other parts of your project.

Libraries

Libraries are reusable code snippets, developed by the programmer, or other programmers within the community. Libraries are special kind of built programs, that allow others to reuse the same code by calling their names. Remember, the symbols? The purpose of symbol is also to allow others to link to your source code, and call the code from your binaries. Libraries are of two types,

  1. Dynamic libraries
  2. Static libraries

It is the responsibility of a linker program, to link these libraries to the output and depending on the type of the library, they can be linked before execution or after execution, on an as-needed basis.

Dynamic libraries

Dynamic libraries are those, that can be linked to the program at the runtime. They do not require to be inserted in the code itself, and they can be loaded by the framework, runtime or the linker when the program starts to execute. Common examples of dynamic libraries are the Windows operating system's DLL files.

Static libraries

Static libraries are those, that are copied inside the code before the native code is generated. Unlike dynamic libraries, they are available inside the source code and do not need to be checked for availability. Their downside is that they increase the size of the executable. There more difference will be explained in the chapter itself.

Programming Frameworks

Now that we know the basics of programming languages, the programming frameworks are the frameworks, or platforms built on top of those languages that abstract away some basic low-level details and provide high-level dialects that can be used by programmers to develop the logic and the software applications. Almost every programming language has some programming frameworks developed on top of it, that provide the basic functionality to a specific set of programmers of that language.

General categorization of programming frameworks include,

  1. Scientific study groups
  2. Graphical applications
  3. Web frameworks
  4. Memory managers
  5. Image processing
  6. Machine learning

The list is just merely a subset of the total categories, and more are always counting as new research groups open and new language frameworks are adopted for each language given. Programming frameworks support the basic functionality of each of the categories, for instance a framework for image processing would contain the modules for,

  1. Image loading and reading
    • Reading the image files
    • Framework must know the format of images, pixel-depth
    • Not necessary, but must support every format, raw, or JPEG, PNG etc.
  2. Image exploration, as in reading it as a matrix
    • Image manipulation as matrix
    • But must not burst out of memory easily
  3. Image filtering
    • Must provide services to filter the images, such as blurring etc.
  4. Image operations
    • Framework should come with basic operations such as edge detection, noise reduction etc.
  5. Image updating, or editing
    • It must support graphics controls, to add some drawing objects, such as marking lines on the image etc.
    • Just like reading, framework should provide services to store the images back, in any format expected.

Same is the case for other frameworks, such as machine learning frameworks or graphical application development frameworks. There are many types of frameworks, available out there, some are free and some proprietary and some are community-led open source projects that are out there for developers to help them in their processes.

PL

Programming Languages

Learn the basics of programming languages, how they are built, how they are used to develop software and some best practices.