Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Крючков Фундаменталс оф Нуцлеар Материалс Пхысицал Протецтион 2011

.pdf
Скачиваний:
1
Добавлен:
12.11.2022
Размер:
3.84 Mб
Скачать

previous one. The purpose of normalization is primarily to speed up access to data and give data more integrity. These objectives may be mutually contradictory. A well normalized database is the necessary compromise between these trends. The first three normal forms are as follows.

First Normal Form (1NF) is expected to satisfy to the only requirement of atomicity: each data field should contain a single data element and no element should be duplicated.

Second Normal Form (2NF) should additionally satisfy to two more rules:

each table contains data of only one object;

each table contains a unique field or set of fields (termed the primary key) for unique identification of the entry.

Finally goes Third Normal Form (3NF) which requires all table fields, other than key-defined, to be mutually independent.

Occasionally, a designer may intentionally break the 3NF rules to improve performance of an application. This process is referred to as denormalization and is expected to conform to particular rules:

Validity of denormalization. The only purpose for which denormalization is practicable is to improve performance of an application.

Debugging and testing of the program code created to avoid problems from potential data corruption. For example, introducing a computed field requires a code to be written to accomplish this.

Complete documentation of the actions performed.

A relational database differentiates the following types of relations among tables:

One-to-one relation. In this relation each entry in the table relates to one entry in another table. Normally, if such relation exists, is makes sense to consolidate the tables. However, cases occur when this relation is realized.

One-to-many relation is used to relate an entry in one table to more than one entry in another table. This is the most commonly encountered relation type.

Many-to-many relation. Each entry in one table is related to more than one entry in another table and vice versa. Relational database rules require this relation to be presented in a dedicated table. As foreign keys, the additional table contains the primary keys of both tables. It has a one-to- many relation to the base tables, which realizes the many-to-many relation of the original table.

321

Integrity of data is a separate aspect to be ensured in the context of information security. Data integrity shall be understood as a correct and noncontradictory status of a database. This means that information in separate tables should make a whole and should not have contradictions. Relational database management systems help maintaining the integrity of data automatically without the need for a program code to be written to check the input. There are a number of procedures to keep data integral.

Thus, sharing an entity among tables and linking tables via primary and secondary keys helps avoid duplication of identical information and errors this may entail. DBMSs allow data types to be specified in particular table fields to hold down an attempted input of knowingly incorrect data with field values to be limited where possible.

Transaction support

Any change to the database in computerized NM A&C systems shall be made through transactions. Transaction is a set of database transformations which results in the database changing over from one noncontradictory state to another noncontradictory state. Transactions should meet four requirements known collectively as “ACID”: Atomicit y, Consistency, Isolation and Durability.

Atomicity means that a transaction can be performed only in full and not in part.

Consistency is the condition when no traces are left by a transaction. Aborted transactions should reset the system. This operation is called rollback.

Isolation is the notion meaning that transactions should not interact. If transactions try to handle the same data in the database, this data should be blocked for all other transactions before completion.

Durability of a transaction means that if the transaction has been completed and its goal achieved, it becomes completed even if something happens with the system.

DBMSs with transaction support should contain additional tables. Tables of independent values describe one object but at different time. These tables are used before the transaction is completed with data stored that may be required if there is a rollback.

Special transaction logs are needed to log all transactions in the database. Where in place, these logs, along with backup data copies, allow the transaction to be considered a data recovery unit. When data is

322

recovered, the DBMS reviews the transaction log data and consistently performs all transactions performed since the time of the latest data backup.

Structured query language (SQL)

Structured query language (SQL) is a high-level language for manipulation of data and objects in relational databases. Such language is the necessary condition for a database to be considered relational. Relational model was developed by IBM in the 1970s. In parallel, the original version of a structured query language appeared. The latest SQL standard was adopted in 2003.

DBMS manufacturers tend to extend the language standard by giving it extra capabilities. Normally, if successful, these changes are made part of the next language standard. Still, practically all SQL versions support base requests and functions of the standard. Following the standard helps create applications other than depending on a particular DBMS with standard requests employed to manipulate data. Dedicated mechanisms (ODBC or OLE DB) are exploited to communicate with databases, thus enabling conversion of requests to respective DBMS formats.

Use of SQL makes it unnecessary for programmers to write a great deal of routine sampling and data merger operations. This will also cut the load on the client computer as the operations done using SQL queries in the client/server architecture will be accomplished on the server.

Given below are the formats of the basic language queries enabling manipulation of data. Uses of SQL structures will be illustrated by examples.

The basic SQL command is SELECT which is a data sampling command. It has a rather complex syntax and makes it possible to compile queries for a great deal of operations to furnish the user with information from the database. Here are some examples to illustrate the language capabilities:

SELECT title, price FROM titles

WHERE рrice >= 5 AND рrice <=10

In this example, values in the titles and price fields are selected from the titles table for all entries in which the price field values lie in the interval of 5 to 10. The key words SELECT and FROM are necessary in the query because they specify the table sampled and those fields the values whereof

323

are to be supplied to the user. The key word WHERE defines the sampling condition. Where this word is absent, all table entries will be sampled from.

With the predicate in the WHERE sentence assuming the meaning of “truth”/”lie”, Boolean algebra operators can be use d to form it. In a Boolean expression, the only predicate may use any number of conditions which makes it possible to form exclusively powerful predicates. SQL may use the following comparison operators: equal to, greater than, less then, greater then or equal to, less than or equal to, not equal to. The last one looks as <>.

Apart from comparison operators, SQL distinguishes basic Boolean algebra operators which interlink a number of Boolean expressions, a Boolean expression being obtained again as the result. SQL distinguishes the following Boolean operators:

AND – logical AND. The operator takes two Boolean e xpressions (А AND B) and gives out “true” if both of them are tru e or “untrue” if otherwise;

OR – logical OR. The operator takes two Boolean expres sions (А OR В) and gives out “true” if at least one of these has the meaning “truth”;

NOT – logical negation. One expression (NOT А) is used as an argument. This operator inverts the value.

Using predicates with Boolean operators, one can give them a much greater selective power.

As stated in the discussion of the database relational model features, table fields should be independent. However, data is often needed, which can be obtained based on these fields with the aid of certain procedures: summation, averaging, etc. SQL performs these operations using aggregation functions.

COUNT – determines the quantity of rows or fields s elected by query and being other than NULL values.

SUM – computes the arithmetic sum of all selected v alues in the given field.

AVG – computes the average value of all selected va lues in the given field.

MAX – computes the greatest of all selected values in the given field.

MIN – computes the least of all selected values in this field.

Here is one example to illustrate how the aggregation function can be employed:

SELECT AVG(price) FROM titles

324

In this example, a user gets a single number that is equal to the average value of the quantities contained in the price column of the titles table.

The sampling command SELECT is capable of sampling more than one table by linking data with the aid of primary and secondary keys. Data grouping commands and some other capabilities exist. Consideration of these is however beyond the scope hereof. The literature on the query language is abundant so anyone with an interest in this will have no problems with finding the information he or she needs.

INSERT is the command used to insert data into a database. Here is one example of how values can be inserted into the F_name, L_name, U_login and U_password columns in the Users table:

INSERT INTO Users (F_name, L_name, U_login, U_password)

VALUES ('Сергей', 'Иванов', 'Sergey', 'HM235YPAH')

The key words used here are INSERT INTO followed by the table name and a bracketed list of the fields inserted. The further key word is VALUES, which is followed by the bracketed values of the data to be inserted.

UPDATE is the command used to change data in the existing rows. To illustrate this, we shall write the command to change the input name of the user with ID 1034:

UPDATE Users

SET U_login=’master’

WHERE user_id=1034

Here, the name of the table in which changes are made follows the key word UPDATE. Then, the change as such is indicated after the key word SET. Finally, the predicate that follows the key word WHERE specifies the entry for which the change in question is made.

The delete command has rather a simple syntax. One example is:

DELETE FROM Users

WHERE user_id=1002

This case displays how the entry with the data of the user with ID 1002 is deleted from the USERS table.

325

There must be an understanding that the examples given include the simplest queries to illustrate the use of SQL for manipulation of data. The language capabilities are remarkably greater and make it possible to generate complex queries to cover practically all user demands. Literature is abundant to give anyone a profound knowledge of SQL.

Many DBMSs include objects which are precompiled and optimized SQL queries. An example of these is stored MS SQL Server procedures. Such queries are highly fast to execute. A user-data interaction can be also organized such that to provide the user with access to only stored procedures and not to the data these operate. This sets up an additional data access security barrier.

Use of DBMS in computerized NM A&C systems

As of the time this chapter was being compiled, developers had a limited choice of two SQL servers certified to access security class 3. These are Microsoft’s SQL Server, version 6.5, and two Oracle DBMS versions. Being highly expensive, Oracle products have a confined application. MS SQL Server is available at a more affordable price and offers a power adequate for corporate applications at different levels. The most recent Oracle DBMS applications include the Federal Information System and a number of major operators in the industry. Most other products operate MS SQL Server 6.5 [13]. Likewise operating systems, new software products are subject to certification. Plans exist to have MS SQL Server [14] and Oracle 10 certified to access security class 3. Apart from DBMSs designed to operate in Windows OS environments, another DBMS, PostgreSQL, has been certified along with a secure Linux distributive.

7.3.3. Development tools

Development tools form the third component of base software for computerized NM A&C systems. These have two important roles in design and operation of systems. First, developers use them to create a graphic user interface (GUI). Nowadays, one cannot imagine a marketable software product without a developed and convenient interface. The second role of applied software is to ensure the integrity and security of information by program features. Depending on the type of the DBMS based on which an A&C system is built, this role may turn out to be central. Thus, MS Access, a popular DBMS, has most data integrity control functions vested in forms, that is, in applied software. In contrast, MS SQL Server realizes these

326

functions on the server. No binding certification requirements to development tools exist.

There are some requirements imposed on such tools by the industry standard. These require that tools should provide the developer with:

convenience of program development;

visual programming capabilities;

good debugging features;

a developed error handler;

support of multiwindow environments;

convenience of communication with databases.

Some of the requirements are general, though two well-defined requirements exist that limit the number of tools that satisfy to the standard. These require that visual programming and database communications should be in place.

Visual programming is to be understood as a capability to generate a user interface with the aid of readymade graphic control objects. The programmer simply gets them on the work form and defines further the functionality thereof. Systems of the kind make it much easier for anyone to form an interface and give the ability to create professionally looking program in the Windows environment even to developers with limited programming skills.

There are different ways to organize communications with databases in a software environment, still professional systems exist that incorporate dedicated objects and features enabling the user to get access to data in various formats.

Current software development systems offering such capabilities are rather many. The most sought-after systems are Microsoft’s Visual Basic and Visual С++, and Borland’s Delphi and C++ Builder.

According to a survey, in 2001 about one third of corporate developers in Russian nuclear industry employed Visual Basic and some 15% used Delphi. The existing demand for VB in domestic community of computerized NM A&C system developers is attributed chiefly to the experience of LANL experts who created CoreMAS, a product which, though not adopted to date in the industry, has been used as the model to build many Russian-developed systems. VB is also rather a simple and convenient software system various versions whereof offer ample data access capabilities.

There is one more point to application development systems to mention. While not being formally adopted in the industry standard, this has long established itself as a standard for all professional application development

327

systems by expecting each development tool to support object-oriented programming (OOP). We shall discuss the principles thereof in brief [15].

Object-oriented programming

The difference of OOP from traditional procedure-oriented programming consists chiefly in the following. In object-oriented programming, program is a set of specific objects with specific properties that act and respond to user actions. Program, in fact, turns into a process of user interaction with the program objects. When responding to any user manipulations, the program, or more precisely, the objects therein will operate in this or that way. This approach offers more flexible programming and allows one to escape a great deal of complexities involved in debugging, which comes down to testing methods and properties of the object rather than of the entire bulky program.

This leads to a question of what an object in OOP is. To answer it, let us take a brief look at the sequence of program units. An identifier defines any one value, say, color. Further, all current programming languages use the notion of record as a set of identifiers. One can create a record that contains a rectangle screen location (four numbers), a color (one number), a caption (character string) and a position - if the button is pressed or not pressed (Boolean variable). Such record gives a complete identification of the menu button in the form. Object-oriented programming goes even further. The object incorporates the procedure that realizes some action to be performed by pressing the button. This is called method and this procedure is accessible only from the object. The object so includes not only data but also a program code. Where many buttons are created, the method of each of these will relate to the parameters, that is, the properties of this very button.

Let us formulate the basic OOP-related concepts.

Object – a program unit that contains a complete descript ion of the entity programmed, including data and the program code which enables some object-inherent actions to be realized.

Object properties – define the essence of the object, e.g. appearanc e for visual objects or data source for database-related objects.

Event – an object-related action or situation. For a gra phic object, e.g., button pressing is the event that relates to the mouse click on the button. An event may result not from a user action but from an action of the program or the operating system (when time comes or the iteration process converges).

328

Method – a program module (procedure, subprogram, function ), which processes object-related events.

Class – an object template. An object with filled in prop erty values is an instance of the class.

The following concepts characterize OOP:

encapsulation – integration of data and the program code while concealing their realization methods from the user. The user access to the object is provided only via respective methods and events;

inheritance – one can create classes based on the existing clas ses with methods and properties being inherited;

polymorphism – derived objects know exactly to what method an e vent should be passed to be handled. Thus, a child may have a method which has the same name as the parent’s one but is different in properties. For example, the cool looking button and 3D–button obje cts have ”pressing” one name as their event handling method but use different pressing display graphics. Then, if the 3D–button is the child, its method will be called.

Current program development environments that take the objectoriented approach are rather many. Most of these systems use C++ as the programming language. Object Pascal is utilized by Delphi. Microsoft Visual Studio.NET includes Visual Basic 7, which has eventually been given all the properties an object-oriented programming language is expected to possess.

The choice of the software development environment shall be primarily defined by corporate or industry standards. An enterprise normally has a staff of qualified programmers who have a good command of customary development tools. A shift to new development tools is dictated by the requirement to adopt novel technologies calling for special programming patterns; employ a DBMS including development tools and change over to a new operating system.

Certification of base software on an open code basis has led to the possibility of using program development tools compatible to this environment. Java-based J2EE (Java2 Platform Enterprise Edition) can be used as the platform for such tools. We shall further dwell on the concept of program development platform and the advantages it offers to the database application developer.

Program development platforms

There are now two rival program development platforms: Sun Microsystems’ J2EE (Java2 Platform Enterprise Edition) [16] and

329

Microsoft’s .NET [17] (read as “dot net”). Both pla tforms enable creation of user applications of different architectures. To start with, these are classic client/server applications. Most current computerized NM A&C systems use exactly this architecture. Another capability provided is creation of Web–applications. This requires only a browser program, which is part of many operating systems, to install into the workstation. Web– server is where the application operates, communication with data is organized and Web-pages to be supplied to the user are formed. Finally, both platforms offer a new application development method which creates and uses Web-services. Web–services hinge on their ability to transmit data from the supplier to the consumer via a standard HTTP protocol. XML is used as the data format. The available standard data formatting and transmission facilities help create applications that do not rely on hardware platforms. The user application makes a query which is sent to a Webservice via HTTP. The query result is transformed into an XML format and delivered to the user. XML is a dedicated data markup language used to communicate data and is readily transformed into browser-viewable formats. Web–services can be referred to both from the Web–application and from a standard workstation-based application.

The two platforms are of nearly the same functionality. They differ mostly in cross-platform application transportability and capabilities to support various programming languages. J2TT is now the only program development environment with multi-platform support features. Microsoft customarily makes use of its own proprietary operating systems.

On the other hand, J2EE uses one development language, Java, while Visual Studio.NET. includes four: Visual Basic, C++, С# and Java. For an enterprise using Microsoft products for its base software, .NET offers a minimum-cost option of changing over to new technologies. Those using Visual Basic to design database applications will find it easy to switch to VB.NET-based programming of Web–services in their c ustomary program development environments.

Changing over to open-code operating systems will yet require use of other development tools and so then J2EE becomes a natural choice.

Support of application/data communications

To be able to satisfy to a major industry standard requirement in the context of future computerized NM A&C systems, development tools should possess dedicated database access features. Microsoft has developed a spectrum of object class collections that model the database structure and

330

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]