1

Topic: Question presentation "Saving . The data in the text file" (Pascal)

2

Re: Question presentation "Saving . The data in the text file" (Pascal)

Hello, _hum _, you wrote: __> in what variant all the same it is better to state a question to Consider both variants, to show a difference, pluses/minuses. __> what approach conceptually more widespread (it would be desirable to give to students on an example of Pascal general idea about the most fundamental  and programming maxims which allows them to master then easily other imperative language instead of to be guided  specificity of the language)? In languages with strict typification coercion and type conversion is fundamental enough concepts deserving detailed reviewing.

3

Re: Question presentation "Saving . The data in the text file" (Pascal)

Hello, _hum _, you wrote: __> What approach conceptually more widespread (it would be desirable to give to students on an example of Pascal general idea about the most fundamental  and programming maxims which allows them to master then easily other imperative language instead of to be guided  specificity of the language)? I do not know, how there with it in Pascal, but it is normal when use any autoconversion, on road from the program in the text file of a special difference is not present, and here at file reading, if in a file there are errors well to have distinct diagnostics, instead of " the data at file reading xxx.txt". And distinct diagnostics is difficult for receiving, without writing the parcer. But if the library parcer is made, why and is not present?

4

Re: Question presentation "Saving . The data in the text file" (Pascal)

Hello, _hum _, you wrote: it is necessary to give Explicit conversion. As the decimal symbol can be a miscellaneous. Or even conversion in the Roman record

5

Re: Question presentation "Saving . The data in the text file" (Pascal)

Hello, _hum _, you wrote: __> What approach conceptually more widespread (it would be desirable to give to students on an example of Pascal general idea about the most fundamental  and programming maxims which allows them to master then easily other imperative language instead of to be guided  specificity of the language)? At first, it is necessary explicitly to let know that the data on a disk is stored in a type of a dial-up byte, and data storage in the form of the text with necessity of the subsequent conversion it is simple the file organization in a format convenient for reading . Secondly, it is explicitly necessary to give reading with conversion since there can be different writing formats of the data, from the literal text, to necessity manually  any XML. And here it is desirable to show that saving in a file is necessary not only for the program, but also for a data interchange. Depending on that students know, it is possible for them to give, for example, the job  any data set, to save in CSV a format, and then to open  and to construct the schedule. In the third, yes, it is necessary to tell that the world is not necessary on a place and on the majority of typical operations already there are 100500 ready library functions which yield at once result in the necessary format. Beginning from conversion of a line in number and finishing, besides, analysis any XML, or  the document. I think that so will be most correct.

6

Re: Question presentation "Saving . The data in the text file" (Pascal)

Hello, _hum _, you wrote: __> What approach conceptually more widespread (it would be desirable to give to students on an example of Pascal general idea about the most fundamental  and programming maxims which allows them to master then easily other imperative language instead of to be guided  specificity of the language)?  in a current type to speak about such things as saving of the data in a file in such type will be extremely harmful to students. For they solve low-level and simultaneously the dedicated task. If to speak about concepts such concept, as serialization is spread. It is the high-level concept. Depending on a serialization variant, is  serializations in a binary format (at you it is point 1) and in a string format (at you it is point 2). Both variants are spread. The first variant normally works faster and demands less overhead charge, but the format is unreadable for the person. The second variant accordingly on the contrary. Serialization can become in a file, be transferred on a network, serialization generally in storage for this purpose, that managed the code  with unmanaged - a file only a variant can become. Therefore it is impossible for students to impart such concept, as saving in a file. It is bluntly low-level . It is necessary to impart such concept, as serialization, and the general-purpose serialization everything. And separately it is necessary to consider operation with files. Thus considering such concepts, as flows of input of an output. And probably such things to consider later. And for practical tasks simply to write or find (I do not know, whether there are such for pascal) support libraries . With methods that that like persist (pathToFile, referenceToElementToPersist) and restore (pathToFile, referenceToElementToPersist). And let at once get used to high-level concepts and to use libraries. And with files further let learn to open, close, pass to the arbitrary index, to read in  as an array byte and as the line etc. But let is not mixed by concept of serialization and a file. Otherwise then a horse-radish you will disaccustom to the such. As most likely by that moment when students should learn to high-level concepts, they most likely already to visit occupations and will not walk generally in institute, and will perform what draft operation on . And the majority and do not learn to program normally as a result, and programming at them and will associate with pascal, arrays and here such spaghettis.

7

Re: Question presentation "Saving . The data in the text file" (Pascal)

Hello, _hum _, you wrote: __> If speech about 1st course of technical college and teaching on Pascl programming bases in what variant all the same it is better to state a question on saving of numeric data (for example, the data of an array of integer numbers) in the text file - __> 1) with usage by explicit conversion of numeric data in string and it is reverse, like __> 2) with autoconversion When studied I, in the first semester there was Pascal, and in second Si. On Pascal, used file of... And conversion to a text type (like with autoconversion, but already I I do not remember), and on Si - and saving in a binary type and in text. I think, for educational tasks, it would be quite good to make to students independent conversion from a line in number and it is reverse. But - in separate operation, and in this concentrates on operation with files and to show different lines of thought. And then there will be for students more challenging tasks - to save in one file the data of different types and reading of this data from a file?

8

Re: Question presentation "Saving . The data in the text file" (Pascal)

Hello, _hum _, you wrote: __> If speech about 1st course of technical college and teaching on Pascl programming bases in what variant all the same it is better to state a question on saving of numeric data (for example, the data of an array of integer numbers) in the text file - __> 1) with usage by explicit conversion of numeric data in string and it is reverse __> 2) with autoconversion Both, but to specify a shared problem - in particular that the first is more floppy in respect of data structure analysis in each line, but demands slightly more handwork; the second normally suits only a format with a principle "all is divided by gaps or transfers of lines" and normally does not allow to inscribe, for example, a field of the arbitrary text without . The example on restrictions of the second - a problem saw recently - in the input data the description of the directional graph in a type arrives: a line, in which peak "whence" and the list of peaks "where" for this "whence"; The list comes to an end with the line feed, no explicit length at it is present. For a C I showed the approach with a cycle from getchar () on passes and ungetc () +scanf () when came across the number beginning. For Pascal the analog ungetc () does not exist, and a choice between conversion of sequence of digits to number manually and reading of a line entirely with the subsequent partition on gaps. __> what approach conceptually more widespread (it would be desirable to give to students on an example of Pascal general idea about the most fundamental  and programming maxims which allows them to master then easily other imperative language instead of to be guided  specificity of the language)? Here it is impossible to answer, because in "the big" real world "more widespread" is neither the first, nor the second, and other approaches - binary formats, JSON, XML, and so on, many of them frankly grammar on a construction. Input-output of formats considered here - partially basis on which other methods, partially approaches which are not scaled further are under construction. __> the item with. By the way, and with ++ the variant of autoconversion at flows of input-output and file is registered in the standard? Yes. For example, a type construction cout <<i where i - whole, formats it in the text according to a current mode of an output flow. Similarly for the input.

9

Re: Question presentation "Saving . The data in the text file" (Pascal)

Hello, Pzz, you wrote: Pzz> I do not know, how there with it in Pascal, but it is normal when use any autoconversion, on road from the program in the text file of a special difference is not present, and here at file reading, if in a file there are errors well to have distinct diagnostics, instead of " the data at file reading xxx.txt". And distinct diagnostics is difficult for receiving, without writing the parcer. To the parcer here there are many the intermediate steps which yield quite satisfactory result. For example, it is possible to read a position in a file and to deduce "an error on N character". It is possible to read, besides, 10-20 characters before and after and to deduce this piece of the text around. It is possible to conduct count of number of a current line. And so on... Pzz> but if the library parcer is made why and is not present? It does not build grammar analysis, for students of this level such still absolutely early. In the beginning it is necessary hardly  cones on input from separate  fields.

10

Re: Question presentation "Saving . The data in the text file" (Pascal)

Hello, elmal, you wrote: E> And with files further let learn to open, close, pass to the arbitrary index, to read in  as an array byte and as the line etc. But let is not mixed by concept of serialization and a file. Otherwise then a horse-radish you will disaccustom to the such. As most likely by that moment when students should learn to high-level concepts, they most likely already to visit occupations and will not walk generally in institute, and will perform what draft operation on . And the majority and do not learn to program normally as a result, and programming at them and will associate with pascal, arrays and here such spaghettis. Such file input-output is means about the same plan that sortings: at low practical value this powerful didactic means, changeovers to which are not invented till now. To pass to the generalized serialization, knowing about input-output, just easier. And here to train on serialization it is impossible - it turns to representation about magic storage somewhere in an astral without moral readiness to understand its problem.