Files
hpr-knowledge-base/hpr_transcripts/hpr4235.txt

130 lines
7.1 KiB
Plaintext
Raw Normal View History

Episode: 4235
Title: HPR4235: What Is Plain Text Programming?
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr4235/hpr4235.mp3
Transcribed: 2025-10-25 21:50:43
---
This is Hacker Public Radio Episode 4235 for Friday the 25th of October 2024.
Today's show is entitled, What is Plain Text Programming?
It is part of the series Programming 101.
It is hosted by Harry Larry and is about 8 minutes long.
It carries a clean flag, the summary is in which I go into detail about what I mean when
I talk about a plain text program.
Episode 3.
What is a plain text program?
Today, I'm going to go into more detail about what I mean when I say plain text program.
I want to emphasize that this is just me.
Others may have different ideas on this topic.
This is how I try to write plain text programs.
I will feature other people's work that I still consider to be plain text programs that
do not follow all of these guidelines.
I want to thank the hosts on the monthly HBR Community News Podcasts for inspiring me.
They had questions.
I also want to thank those making comments.
I'm new to Hacker Public Radio and it will try to be more timely responding to comments
in the future.
What is a plain text file?
Text files are usually edited in a text editor or in a word processor and saved with the
.text extension.
They consist of a string of characters.
Text files can be divided into lines using the new line character, backslash n, or the
carriage return and new line characters, backslash r, backslash n.
You don't have to type these characters, your editor puts them in for you.
Text files do not have to use the .txt extension.
Most programming files like .php or .c files are plain text.
I will only be discussing programs that are open source and that store their code in text
files.
plain text configuration files often have no extension.
For my plain text programs, I use config.insc.
There is no difference in text files and plain text files.
People often say plain text files to distinguish them from word processor files like .doc or
.odt files.
plain text programs use text files to store text like a title or a blog post.
When I talk about plain text programs, I also mean something more than this.
That's what this podcast is about.
No database?
plain text programs do not use a database like my sql or post gres.
Also the file system does not imitate a database, creating keys, indexing, etc.
The file system performs the database functions by accessing files which can be text files,
graphic files or other files.
These files can all be in one directory or in multiple directories in a single directory
tree.
If password security is required in a plain text program that runs on the internet, I make
an exception to the single tree rule to allow passwords to be stored outside of the web
space.
So the assets of plain text program access are just files in the file system.
No HTML or other markup required.
I have no rule against allowing HTML or other markup, but I do not assume that the maintainer
knows how to do this or wants to learn it.
The reason I started writing plain text programs was to avoid HTML markup.
I want to be able to type text files, save them, upload them, without being concerned
about anything except the text itself.
The text files holding the content are written in block paragraph style with a blank line
between paragraphs.
Text files are not required in a plain text program, but most plain text programs do use some
text data which should be stored in text files.
With this as a web application, links can be copied and pasted from the browser with
no additional markup required.
Other assets in the directory like .gif, jpag, or png images display automatically.
I use the file names for metadata like title, caption, or sort order.
I can also sort chronologically using the file timestamps.
If there is a hierarchy of directories, the program can use the directory name of the
child directories for the link text.
For instance, the Delta Musician's directory tree can have a table of contents at the top
level that lists the musicians in alphabetical order.
Each musician gets their own sub directory, and the name of that sub directory is used
to generate the link and the link text for that page.
And each page can use dirt-simple photogallery, and the program generates the captions from
the images file name.
All configuration is also done at a text file.
I use a well-documentedconfig.inc file that initializes PHP variables.
The maintainer of the application is never required to edit source code.
Does plain text mean there is no GUI interface?
No?
I write mostly web apps so they run in the browser interface.
Also, plain text programs do not require a GUI.
It could run in a terminal or as a crown job.
The program could play a music playlist or run a slideshow with no input at all.
What do I have to know to maintain a plain text program?
The maintainer of the program will have to be able to, one, create and edit text files
in a text editor or word processor.
Two, copy and paste links, iFrim embeds, file names, titles, etc.
Three, rename files, four, upload and download with FTP.
Executive summary.
A plain text program does not use a database like SQL.
Instead, it stores the assets in the file system and accesses them using the file system.
A plain text program does not require HTML or other markup.
Text assets are written in block paragraph format.
If the maintainer prefers to use a word processor, instead of a text editor, that's fine.
As long as the files are saved as text files with the .txt extension.
Most word processors support this.
plain text programs can support links.
If the links are copied and pasted into the text file with no markup required.
plain text programs can support iFrim embeds.
If the embed code is copied and pasted onto its own line in the text file.
All of the assets for a plain text program are stored in a single directory tree.
This is one of the main advantages of plain text programs, because it makes them easy
to back up and restore, so they are very portable.
I sometimes make an exception to this if I want to save a password on a web server outside
of the web space.
A plain text program uses the file and directory names for metadata like titles, captions,
or sort order.
The file timestamps can be used for chronological sorting.
All configuration is done by editing a well-documented text file.
The maintainer should not have to edit the program code.
The maintainer should be allowed to edit the program code.
I will only discuss open source programs that store the program itself in text files.
More questions?
I thought so.
Comment on hacker-public radio or at Gamer Plus DBN.
I will include links in the show notes.
You have been listening to hacker-public radio, and hacker-public radio does work.
Today's show was contributed by a HBR listener like yourself.
If you ever thought of recording podcasts, you click on our contribute link to find out
how easy it really is.
Hosting for HBR has been kindly provided by an honesthost.com, the Internet Archive
and our sings.net.
On the Sadois status, today's show is released under Creative Commons, Attribution 4.0 International
License.