Sunday, 29 November 2026

Relational Database & ORM support plan for 'Ola' Programming Language.

Introduction.

Sometimes a library is enough, but still... a support on language-syntax-level can make a tool more elegant, cheaper, faster and easier to use in practice.


Basic Idea.

I have an idea to explore: Support for Relational Databases integrated with ORM (Object-Relational Mapping) tool, on the Language Syntax Level, planned for 'Ola' Programming Language we intend to create.

This support is planned to consist of three parts:
- Each of most popular relational (sql) databases will have a driver,
- There will be standarized configuration file that will 'bind' a driver with 'Ola' Programming Language's inner mechanisms,
- There will be support on language-syntax-level as well.

Syntax-level support will handle object graphs by default (with their state set, of course), so it's no need to use separate, additional ORM tools like Hibernate for java.

That way, when we need to migrate to another RDBMS solution from current one, all we need to do is to switch driver and edit configuration file. One of design goals is to ensure that code won't need to be changed in any way, when we do that. Moving the actual data still needs to be done properly, but perhaps this can be automated too.


Changing Versions of Persisted Data.

What about changing code of classes for objects stored in object graph?

Is code typing and versioning enough? Perhaps there could be 'backward compatibility brackets'?

Like: Data in Class Person version 9 is backward compatible with data stored in Class Person in
versions: 2-4, and 6.

Perhaps there can be tools that will help to automate updating data in relational database, from version 'x' to version 'y'.

Perhaps such updates can be executed automatically as a part of project compilation and build, when 'improper version' is detected. Perhaps this can be a part of CI/CD (Continuous Integration / Continuous Deployment) practices - for Internal Testing Environment and/or for Production Environment.

Perhaps there should be a way to migrate data to previous versions too (from 'y' to 'x'), and tools for overall management of data version changes, and for view/management of 'historical data'.

Fractional Data Type for Precise Calculations.

Errors accumulation, floating point numbers, and precise fractions.

When we perform even simple calculations on floating point numbers, we often see error accumulation. This can be really bad when we calculate partial results in a loop.

We can, however, store numbers as fractions - as a numerator and a denominator. Such numbers are precise, and we can divide numerator by denominator only once, at the end of our calculation. That way we can have a floating point result, with only minimal error.

This is not replacement for 'Numerical Methods' course, it's just a simple way to make simple calculations precise in easy, quick, and inexpensive way. It can be combined with 'Numerical Methods' still, I think.

We can use a very long integer data type, as for example: BigInteger class in java, or int type in python too.


Expression tree.

When we have an expression string, consisting of parentheses, numbers, and 5 basic operations, we can parse it and build expression tree. Then we may calculate it from bottom to top, from leaves to root.

These 5 basic operations are:
- Addition,
- Subtraction,
- Multiplication,
- Division,
- Power.

Expression trees can also be constructed using other ways, including calling constructors to create tree node objects ( our tree's node can be either number for leaf node, or operation for non-leaf node ), and linking these with setter accessor methods.


Addition and Subtraction.

First we find common denominator by multiplying denominators of our operation, multiply nominators by 'opposite' denominators, then add or subtract resulting nominators.

Then we 'reduce' resulting fraction so it uses least possible denominator.


'Reduction' Algirithm:

We repeat:
1. We perform factorization of both numerator and denominator, to get list of prime factors in each,
2. If we have same prime factor(s) in numerator and denominator, we remove these from both lists until our factor lists are consisting of unique integers,
3. If/when the lists of prime factors have only unique integers, we end our loop.


Multiplication.

We multiply numerator by numerator, and denominator by denominator. Then we 'reduce', as explained above.


Division.

We switch places of numerator and denominator in second fraction of our division (written on the right), then multiply, as explained above.


Power.

We rise both numerator and denominator to power of n, where n is integer number, then we 'reduce' result, as explained above.


Next Challenge.

Next challenge is finding a way to calculate roots of fraction, where the result is also a fraction.

For example: finding a power of 2/3 of a fraction number fn, where result is written as precise fraction.


Java Library Code on GitHub.

/ PLANNED TO BE DONE, PLEASE DO NOT HURRY ME /.
/ BUILDING EXPRESSION TREE IS TO BE INCLUDED, BUT WITHOUT PARSER FOR NOW /.

/ DO NOT WORRY, I CAN HANDLE WRITING PARSER(S) ... I'VE DONE THIS BEFORE /.


'Ola' Programming Language.

We plan to use both unbounded integer numbers and fractional numbers as built-in data types in 'Ola' Programming Language we intend to create.


A Fraggle.
-=- A 'MULP' Fraggle (Wembley). -=-
-=- Fractional Data Type Mascot. -=-

('MULP' is mnemonic for: 'Multiply with Precision').

Monday, 16 November 2026

Privacy, and Magical Power of words in the Internet.

What I think about privacy in modern times?

I think that in modern times privacy is fiction, not only in the internet.

Is it true that our smartphones spy on us?

I am learning to live without privacy.

Law regulations (RODO in Poland) won't change much but are still good, can be useful to quell worst of mistakes, abuses and exaggerations - and this is important.

... and to quote myself: 'since times of regular expressions, words in the internet have magical power'.

/ Regular Expressions date to Alan Turing and earliest days of Computing, were present far before the Internet was built /.

Computer scripts/programs can automate tracking and following internet activities of various people and groups, sending SMS messages to right people as an answer to occurance of various events happening in the internet, for example.

So, for example, when someone uses suspicious word(s) like 'terrorism' or 'trading bodies' on facebook, scripts can react and inform someone responsible to wake up, look, and decide how to proceed, if at all. Police can be sent, something else can happen, or whole thing can be ignored.

So, it's possible that after writing a few words in the internet / not only facebook /, world around you will change very quickly, and perhaps very unsubtly too.

Saturday, 14 November 2026

Low Level vs. High Level Programming.

Low Level programming (C and Assembler in this case) is long, tedious and difficult, but it can be very fast and precise even if it's easy to make a lot of errors in process. It can allow to use the most from the hardware it's designed for.

However, it's scientifically proven that the less lines of code, the less errors. Using Higher Level programming languages usually results in less lines of code.

High Level programming (Java for example) is easier and faster to use, cheaper too (programmers are paid for their work hours). Less errors and larger, quite complex systems are now practically possible. It's easier to keep up with reality changes (for example when Laws are modified and/or when markets change), modifying or rewritting code to make it answer better to new reality needs. Programmers can optimize many things, including their own costs and work time.

Faster production time can also make the difference. Not only faster reaction time to changing market needs, but also Solution Pioneer status. Pioneer solutions, new solutions released before competition, can give Market Leader benefits.

Sometimes we do not require software to be very fast. It doesn't matter much whether the internet browser displays a web page in half of a second or less. There are delays associated with internet traffic too, afterall. In these cases, it's not worth the extremally larger money costs and much longer production time of the web page software construction and maintenance.

In other times software speed can be crucial, for example when weapon control systems of fighter jet plane lock-on on enemy fighter planes. Various fights and their parts are often the race against the time.

--
C is higher abstraction level programming language than Assembler.

While Assembler programs can be faster, can take advantage of the specific hardware design nuances, and while Assembler code can be smaller and fit in faster Processor Caches (which can make it even more lightning-fast), programming in C is not much slower and has one great advantage: when processor and/or other hardware changes, code written in C can be just recompiled without many or sometimes even without any changes. C compilers can automate optimization for new hardware.

After hardware changes, adapting and optimizing Assembler code for new hardware is seriously harder and longer process than when using C compiler.

--
In practice, it's often possible to write parts of a program in one language, and other parts in other language(s). Code parts written in C, for example, can be linked with code parts written in Assembler.

For combining Java code with code in other languages, one can use the JNI mechanisms.

Thursday, 16 April 2026

Factorization Tree & Computations.

I had idea in Mind, idea about storing numbers in computer memory in form of numerator and denominator / pl: 'licznik i mianownik' /, in an attempt to simplify precise calculations.

I wrote some code to factor numbers, to find prime factors of a number / pl: 'rozkład liczby na czynniki pierwsze' /.

But this code does more than just determining if number is prime, and if not - finding prime factors of this number. It stores paths and partial calculations, it gives not only one solution, but all of possible solutions, that perhaps can be used and reused in creative ways.

Then I had another idea - what if numbers were stored in such form, in form of factorization tree. Perhaps adding trees, or other operations on factorization trees would allow for some swift, abstract calculations.

Then I remembered Geometry with Linear Algbera, and neutral elements of operations on structures such as Groups, Rings and Fields / pl: 'Grupy, Pierścienie i Ciała' /.

What kind of FactorizationTree would be a neutral element of FactorizationTrees' Addition?

How about Multiplying FactorizationTrees?

I'll admit that most of this is just musings and considerings, I admit that I let my imagination run wild this time.

This blog has a place for ideas exploration, after all.

I might need to research following topics:
- Abstract Algebra / also known as Modern Algebra /,
  / Downloaded an ebook in .pdf file format /,
  / Polish edition of this book was published by WNT: 'Wydawnictwa Naukowo-Techniczne',
    my favourite scientific & technical books publisher;
      mostly that's why I chose this book over others, looked at table of contents list too;
      WNT-published books are often recommended by Warsaw University as well;
    Ebooks are more eco-friendly than printed books, and a smartphone is enough to read these /,
- Group Theory,
- Ring Theory,
- Field Theory,
- Inverse element / pl: 'element odwrotny' /,
- Binary operation / pl: 'działanie binarne' /,
- Homomorphism / pl: 'homomorfizm' /,
- Isomorphism / pl: 'izomorfizm' /.

Sunday, 1 March 2026

'SOLID': Five Principles for Object-Oriented Software Quality.

In Object-Oriented Programming & Design, SOLID is a mnemonic acronym for five principles intended to make source code & design more understandable, flexible, and maintainable.

This means faster software construction/modification/debugging and lower overall project's costs (programmers are paid for their work-hours).

Software engineer and instructor Robert C. Martin introduced the basic principles of SOLID design in his 2000 paper: 'Design Principles and Design Patterns about software rot'. The SOLID acronym was coined around 2004 by Michael Feathers.


1. Single responsibility principle.

Every class should have only one responsibility, which means that a class should be responsible for only ONE 'thing'.

Importance:

Maintainability: When classes have a single, well-defined responsibility, they're easier to understand and modify.
Testability: It's easier to write unit tests for classes with a single focus.
Flexibility: Changes to one responsibility don't affect unrelated parts of the system.


2. Open–closed principle.

The open–closed principle (OCP) states that software entities should be open for extension, but closed for modification.

In other words, when we define a subclass, we can ask for less or same (less or same preconditions, as defined in class/method contract), and/or provide more or same (we still must provide what is defined in contract at the minimum, but we can also provide more).

Importance:

Extensibility: New features can be added without modifying existing code.
Stability: Reduces the risk of introducing bugs when making changes.
Flexibility: Adapts to changing requirements more easily.


3. Liskov substitution principle.

LSP requirement states that we must ensure that it's possible for a class to be replaced by any of its children (subclasses). Children classes inherit parent's behaviours, MUST NOT break the contract defined for the parent's class.

Importance:

Polymorphism: Enables the use of polymorphic behavior, making code more flexible and reusable.
Reliability: Ensures that subclasses adhere to the contract defined by the superclass.
Predictability: Guarantees that replacing a superclass object with a subclass object won't break the program.


4. Interface segregation principle.

The interface segregation principle (ISP) states that no code should be forced to depend on methods it does not use. ISP splits interfaces that are very large into smaller and more specific ones so that clients will only have to know about the methods that are of interest to them.

Importance:

Decoupling: Reduces dependencies between classes, making the code more modular and maintainable.
Flexibility: Allows for more targeted implementations of interfaces.
Avoids unnecessary dependencies: Clients don't have to depend on methods they don't use.


5. Dependency inversion principle.

The dependency inversion principle (DIP) states to depend upon abstractions, not upon concretes.

Importance:

Loose coupling: Reduces dependencies between modules, making the code more flexible and easier to test.
Flexibility: Enables changes to implementations without affecting clients.
Maintainability: Makes code easier to understand and modify.


See also:
> [ Design by Contract ],
> [ A few thoughts on code quality... ],
> [ Software Development & Quality ].

Wednesday, 17 December 2025

Occam's Razor.

In Philosophy, Occam's Razor is the problem-solving principle that recommends searching for explanations constructed with the smallest possible set of elements.

Attributed to William of Ockham, a 14th-century english philosopher and theologian, it is frequently cited and translated as:

'Entities must not be multiplied beyond necessity'.


... although Occam never used these exact words. Popularly, the principle is sometimes paraphrased as:

'Of competing theories, the simplest is to be preferred'.


Also, this philosophical razor advocates that when presented with competing theories, one should prefer the theory that requires the fewest assumptions.

So, in practice, when we have a set of competing theories, we should first select theories with least assumptions, then choose the simplest one from them.


Sources:
- Occam's Razor on Wikipedia,
- my own thinking.