Below you will find pages that utilize the taxonomy term “Programming”
Model-View-Controller architecture, part 1
Model-View-Controller (MVC) is one of the most common design patterns used to develop applications with graphical user interfaces (GUI), especially in object-oriented programming languages.
I summarize here three initial works on MVC from 1970s and 1980s along with my comments.
“Modern C”: Notes on chapter 7 “Functions”
These are my notes taken while reading chapter 7 “Functions” from the book “Modern C” by Jens Gustedt.
This chapter discusses structuring C program using functions; particularly, attention is given to recursion, that is, to the ability of C functions to invoke themselves.
“Modern C”: Notes on chapter 6 “Derived data types”
These are my notes taken while reading chapter 6 “Derived data types” from the book “Modern C” by Jens Gustedt.
This chapter discusses objects that consist of other objects, such as arrays, pointers, structures, and type aliases.
How to avoid subtle bugs in malloc usage in C
Whenever a computer program needs to store data of the size determined only
during the runtime, then dynamic memory allocation is required.
Memory allocation happens in the memory heap, and in C is commonly done
via a library function malloc
, which has subtle things with its usage
that I would like to discuss here.
“Modern C”: Notes on chapter 5 “Basic values and data”
These are my notes taken while reading chapter 5 “Basic values and data” from the book “Modern C” by Jens Gustedt.
This chapter discusses values of different objects that are used in a C program, and how they are represented.
Array and pointers equivalence myth
I’d like to share some knowledge about subtle thing that I have learned recently in C. It is related to the relations between arrays and pointers, and how they are often treated as equivalent to each other (for example, this is how passing an array to a function works when one of the expected arguments is a pointer). However, arrays and pointers are not equivalent to each other.
“Modern C”: Notes on chapter 4 “Expressing computations”
These are my notes taken while reading chapter 4 “Expressing computations” from the book “Modern C” by Jens Gustedt.
This chapter discusses expressions, that is, computations based on some values, such as variables and literals.
“Modern C”: Notes on chapter 3 “Everything is about control”
These are my notes taken while reading chapter 3
“Everything is about control”
from the book “Modern C” by Jens Gustedt.
This chapter explains five control block statements:
conditional statements with if
, loops with for
, while
, and do-while
,
and selection statements with switch
.
“Modern C”: Notes on preamble “Level 1 Aquaintance”
These are my notes taken while reading the preamble for the part “Level 1. Aquaintance” from the book “Modern C” by Jens Gustedt. This preamble introduces stylistic decisions that the author uses in the rest of the book.
“Modern C”: Notes on chapter 2 “The principal structure of a program”
These are my notes taken while reading chapter 2 “The principal structure of a program” from the book “Modern C” by Jens Gustedt. This chapter explains details of C grammar, distinction between declaration and definition of objects, and statements.
“Modern C”: Notes on chapter 1 “Getting started”
These are my notes taken while reading chapter 1 “Getting Started” from the book “Modern C” by Jens Gustedt. This chapter introduces imperative programming and teaches how to compile and run a C program.
“Modern C”: Notes on the book by Jens Gustedt
These are the table of contents for my notes taken while reading the book “Modern C” by Jens Gustedt, which teaches C according to new language standards, C11 and C17.
Universal initialization in C++
For my new position, I need to improve my knowledge of the C++ programming language (which I did not use basically since 2010). So I have started reading the book Discovering Modern C++ by Peter Gottschling to get up to speed with, well, modern C++.
JavaScript: functions
As any programming language, JavaScript allows to pack useful things into functions, and it is the key to good JavaScript knowledge, to use them efficiently. In this post, I describe three ways that the functions can be declared in JavaScript, talk about visibility of variables inside the functions, how to have optional function arguments with default values, how to create closures (functions, bound to outer variables), and how to use recursion.
Solving Perfect Squares problem using breadth-first search
I was learning recently about solving problems that use breadth-first search (BFS). This is a family of computer science algorithms that traverse tree data structures “by levels”. That is, starting at the root, we process all nodes on level 1, then all nodes on level 2, etc.
One typical application of BFS is to find the shortest path between the root and the given nodes.
To implement BFS, one should use the queue data structure.
Redirection of stdout and stderr to the same file
Often, when running a program in console, one needs to save all its output
to a file.
Very often, such a program writes both to the standard output (stdout
)
and to the standard error output (stderr
).
For example, by default, in a Python program the print
function writes to
stdout
and the functions of the logging
module to stderr
.
Therefore, one needs to redirect both stdout
and stderr
to the same file.