Data is usually associated with programming and in the modern information world is presented in three logically equivalent versions: data described and used in a program in a programming language; data in database systems; data in distributed information systems. Modern programming has given relative freedom only to the first variant of information formalization. The second two options are more or less reliable forms of providing information and relationships between its components.
Data past and present
The fundamental position of programming languages is the exact description of data and algorithms. Computers don't "present" any chance of uncertainty: there is something to be acted upon, and there is a command that performs that action.
The modern concept is based on a much higher foundation: there is a given, and what exactly it will be is determined at the place of its use. In any case, at the time of use, the data is automatically checked and converted to the correct type. A modern programmer is not obliged to take care of their preliminary description and observance of type compatibility in the algorithm.
Transition process:
- from typed data and its mandatory description before use;
- to untyped data and freedom from any obligation to describe and use it.
In fact, we can recognize the relative relaxation of formalization requirements - it is available only in the environment of modern programming tools. At runtime, the type of each datum is fixed, and the command sequence is well-defined.
Types and Modeling
Mathematics and physics, trade and production, economics and other areas where numbers are used, have always operated with data and did not attach any importance to the concept of type. The fact that numbers could be integers or fractions didn't really matter.
Each specific formula or specific action could give an integer, infinite fraction, real or complex number. Until now, there are such wonders of the mind as infinitely small and infinitely large. Moreover, these miracles even have properties.
There is still no freedom in programming. Everything must be strictly formalized. The concept of data is, first of all, a type:
- integer;
- boolean;
- char;
- string and so on.
Names of types may differ in different programming languages, but there is always an integer or real number, boolean value, symbol,line. There are still relics and specific ideas: unsigned integer, code, byte, word, double word, fixed length string.
The concept of data in a data system has no freedom. The SQL language - "international" (there is a dialect for every modern database) - does not tolerate any inaccuracies not only in data, but also in sql queries. An error in the request is a guarantee of the absence of a result. There is no need to talk about violations of descriptions at all.
Modeling information processes and data representations is the only sure way to build a structure that can evolve and adapt to changing conditions.
Dynamics of original
Natural information is continuous change. To give a formal description and concept of a data model in a specific subject area means to solve three problems:
- define what data is here;
- formalize the relationship between them;
- describe processes for changing data and relationships.
An example of a data set of a simple algorithm in JavaScript - a reduced copy of the model of even the most solid database management system.
It's just that in the second case, experts and specialists, when designing data structures, tables and relationships, usually do not see (it is really difficult to cover a large amount of natural information) the essence of things, and a cumbersome, undeveloped set of heaps of data is obtained, while in subject area source information circulates freely and easily.
Staticpossible
Common JavaScript practice is the code included in the page and the functions assigned to events on its tags. Either way, page tags define the data that a given web resource accepts, modifies, or creates.
If you concentrate your handler code very carefully on element events, and not on the page code as a whole, this is the best way out. Ideally, when the code does not introduce new data or fix the available data, but focuses on what exactly it has at a particular moment in time.
In fact, if you define the concept of "data" as a minimally static description of the source information and follow it, then this means you have a chance of success.
With regard to databases, things are much more complicated. Any JavaScript code is "providing" the page with functionality. Any database is a collection of tables, relationships between them, stored procedures, queries and functionality available from the outside.
Static is the trouble of any algorithm. The modern concept of data is static: a number, a string, a character, and so on. When processing or when writing to a database table, everything turns out smoothly. But when does the original acquire a different dimension or meaning? Option one: change the sign, but connections and requests may immediately fall in.
Statics and objects
Defining the concept of "data" as an object changes the situation dramatically. The object has its own structure. Here you can use any description of any variables. Role will not play. An object has methods through which data is available. Since everythingused in the field of programming, that is, three basic methods: read, write, change. You can add more to compare, search, clone, etc.
The subject area imposes a range of properties on each data. Thus, it turns out that the concept of data is transformed into a kind of description that can be changed dynamically. Static inside an object gives dynamics outside of it.
Changing the combination of static descriptors inside an object, you don't have to worry about the dynamics of its relations with other objects.
Programming and presentation of data
What is data? The public consciousness is already accustomed to information technology, works in the clouds and has containers in virtual spaces. Now, not only professional programmers and users, but also ordinary people are competent in matters of information and its use.
But what is programming? To this day, public opinion gives the following definition to this concept and its concepts:
- Information and data are the basic concepts used in computer science.
- Data is a certain way received and recorded observations relative to the surrounding reality.
- They are simple and complex (structures), primary and secondary.
- A database is a collection of independent materials presented in a systematic way so that they can be found, modified and used.
How objective is this? Authoritative authorsthink so. Real practice tends to ensure that each subject area determines its correct data system and gives every opportunity to build a good dynamic model.
It is not uncommon for a customer (consumer) to impose his own opinion on a programmer (database designer) on how and what to do. From the point of view of programming, any desire of the customer can be fulfilled with the utmost precision.
Need Oracle to solve the problem of budgeting for the maintenance of rural water supply (building 21 in the village) - good. MySQL is needed to organize a tracking system for mail items for all post offices in Russia - everything will work too.
You can always compose any algorithm and provide access to any representation of information within the definition of the concept of data, which is established by the developer of the database management system or programming language. The question is different: how to do it with minimal costs in maximum dynamics?
Databases, examples
A simple base is created without a model. The basic concepts of data and communication are small, the functionality is very simple. For example, for a higher education institution you need:
- table of teachers;
- group table (key and group number);
- general table of students (group keys are used).
The dean wants to know the progress of the teachers. Teachers table has fields:
- surname;
- name;
- patronymic;
- supervised group number.
The student table has fields:
- surname;
- name;
- patronymic;
- date of birth;
- GPA (for all subjects);
- group number.
There can be at least two options for sampling: using the name of the teacher, you can go to the group number and see all the students and their average scores, or by the last name of the teacher and the last name of the student, you can see the average score of the last one.
Even in such a simple version, problems are guaranteed and something will have to be changed. Situation: the teacher fell ill, another month replaces him, which means he supervises two groups. There is only one field under one group number in the teacher table.
To solve the problem, you need to add a duplicate field. And if two get sick, then add three fields. So the table of teachers starts to grow from scratch.
There is another option: replace the numeric field of the group key with a symbolic one. Then, each time you select, you will have to convert the string into a sequence of keys, and one sql query will turn into several.
A more promising example is not to make tables, but to make objects. Then the teacher is an object, and he can have several supervised groups. But it is always one object. The teacher object has a unique key, but can have multiple supervised groups. The group also has a unique key. A student too.
All three positions are not only available within the task, but can be further developed.
Object-oriented bases
Information industry leadersoffer classic relational databases. They are tested by life, they work, they are safe, reliable and, in case of problems, they allow you to restore information.
Object-oriented databases (OODB) began to be developed in the mid-1980s and, according to authoritative authors, are promising to this day. But so far, apart from the fundamental theories and conceptual provisions, there is not a single OODB that has achieved the same rating and distribution as MySQL, MS SQL Server or Oracle in all its diverse incarnations.
But what if the definition, the concept of data, types, attributes, classes, hierarchies is proposed by a developer whose rating is insufficient to create a community of programmers who profess the mentality of this OODB? We'll have to rely on our own strength.
More than thirty variants of OODB have been created in the Linux environment. But where is the guarantee that the created database will not require more functionality? The Windows environment does not offer much guarantees in this area.
Object-oriented solution
However, there is a solution. Using MySQL as an example, you can show how standard relational tables turn into an object-oriented model of the problem being solved.
There is no database here, but there is an environment for forming your own system of objects. The power of MySQL is used only as relational memory for tables from info rows. The logic of use is determined by the developer himself. In particular, there is an is_cache table. It has everythingseveral basic fields:
- owner_code;
- session_code;
- h_code;
- a_surprise;
- a_contents.
The rest of the fields carry service functions. This table stands at the input of any request and records its arrival. What the database model will work out is determined by its developer. What will fit in the content field (a_contents) is determined by the objects of the model created by the developer.
There are four things in this idea: hit, hit session, hit history code, and specific content. What is a call, what system of objects should be built - is determined by the developer. What is meant by a session (work process) is determined by the developer. The history code is the ability to rollback on requests.
The tables here have nothing to do with the subject area. There is a call controller (is_cache), there is logging (is_customs), there is a call history (is_histories). The remaining tables are determined by the task being solved.
In fact, this solution suggests creating your own OODB based on the built domain database model and the problem being solved. There is a huge plus here - this is your own concept of data, your own model of their presentation and the relationship between them. There is a foundation here - a great relational database. There will be no problems looking for something and misunderstanding something.
Model: object system + DBMS
It is almost impossible to change anything in information technology. The real information revolution is still far away. professional consciousnesssoftware developers are not going to change the classical traditions. But there is still a way out of the situation.
Using reliable modern database management systems as the basis for creating an environment for the existence of your own model, you can achieve noticeable success.
In any case, you will have to build a view or a data model to solve the task, but you need to do it correctly: let it be a system of objects, and a good DBMS be its environment.