vendredi 24 avril 2020

Is it possible to make the entire program without any hard-coded parts?

Usually when we want to make a program that can be modified without re-compiling process, we read data and configurations from a file.

But this means that somewhere in the code, we must hard-code the file location of datas or config file.

For example)

public class Program
{
    public static void Main()
    {
        AppData appData = ReadAppData("app.data");
        AppConfig appConfig = ReadAppConfig("config.txt");
        Program = new Program(appData, appConfig).Run();
    }
}

In this case, two strings - "app.data" and "config.txt" - are hard-coded because it is impossible to read files without specifying the file location.

Of course, we can reduce it to one file - for example, we can read only "app.data" and get the configuration file location from that file, but we still cannot remove all hard-coded parts in our program.

So my question basically is, Is it possible to make the entire (useful) program with 0 hard-coded parts theoretically? Or in other words, Is it possible to make the entire (useful) program only with soft coding?

Please don't give me answers like "Do not do that."

Aucun commentaire:

Enregistrer un commentaire