Jump to content

"Why Do Command Lines Still Exist?" is getting it wrong

Riccardo Cagnasso
2 hours ago, Mark Kaine said:

What does this even mean, seriously (?) "computer science" ?

To be totally honest I think when people use a "cli" they're mostly doing this because there isn't anything better available, after all "computer science" is pretty old, and in some aspects hasn't evolved much.

 

I'm not saying there's no place for a cli *currently* im saying its a very outdated concept and not the future  -- at least not for anything that requires any sort of creativity. 

 

Like is that really so hard to understand,  you are just telling the computer what its supposed to do, and a cli is the most basic way to do this, but certainly not the easiest/ fastest or most natural one. Sure, there might not be a solution for every situation yet, but in the future there will be, despite being basically just "simple" turing machines computers and AI are progressing hella fast , at some point there will just be no reason to type things to communicate with a computer anymore. 

 

Yeah and it does come off as hardcore gate keeping. 

The entire problem with GUI vs CLI is also a problem between programming languages. It all comes down to precision, the more you move away from the hardware the less precise you can be with tools and languages presented to you. If you take a programming language like C++ you can solve a problem just about anyway you like. You move up the chain to something like Java and you lose some of your precision for a bit more expressiveness. Even further to python it becomes way easier to solve a problem but you cant tell the computer exactly how you want it done. Next up would be a CLI like Powershell, Bash, or CMD, Its stupidly easy to use but you can still tell the computer to some degree how you want it done. Now you move onto GUI and you're now limited to one way of solving a problem. Its completely rigid and you have zero control over it. To achieve any form of precision with the GUI you would have to start mapping combinations and permutations of commands into forms. But the problem you are left with is now you have an application that has thousands upon thousands of buttons. Good luck trying to figure that out or remember any of that. At least with a CLI or programming language you just have to have a vague idea of what you need to type and autocomplete/help functions will take care of the rest.

For an example of what I mean above:

A GUI is a bit like a single verb and noun statements. "Fill the tire". Compared to a CLI where you have more than one noun and a simple adjective in their to describe how you're filling the tire. E.g. "Slowly fill the with air tire". Then even a high level programming language where you can now be precise with how much air you're putting in. "Slowly fill the tire with air to 30PSI"

 

As far as AI goes I dont see it replacing CLI's or programming languages any time soon. It's hard enough for computers/programs to parse programming languages that have well formed grammar and very little context. But now with natural language you have very ambiguous grammar and its extremely context sensitive. Whats even more difficult is trying to decipher spoken language since even things like vocal tone and body language plays a role in the meaning of a statement. The best I see AI hitting for an extremely long time is a GUI equivalent where you have verb noun statements because at the end of the day we may call it Artificial Intelligence but its extremely dumb because its only as intelligent as the guy who programmed it.

 

With all that said I will never say that CLI is better than GUI or vice versa. Everything has a time and place, like writing this post is easiest done with an editor of some sort since I dont care about how it inserts the quotes. But when doing any non trivial task or task that I care about the result is best left to a CLI or programming language.

 

Quote

you don't really need "to write code" to program a game for example,  even if you probably could-- it would be cumbersome, take much longer and would lack visual feedback.

You will never see any self respecting game developers use any visual programming interface. Even true hobbyists would never use it except for a quick prototypes that are thrown away after they learned what they needed to learn. In the world of game engine and game programming its all about shaving clock cycles everywhere you can and being precise with how things operate. This cannot be accomplished with those visual programming languages as its completely generic components. Systems like Unreals blueprint programming are designed to essentially get people with absolutely zero skills and experience to download the software, try to make something and ultimately start purchasing code and assets off of the appstore because they don't know what they're doing lol. A significant part of any games development is even the modification of the games engine to tailor it to the needs of the game all of which is going to be low level C or C++ code and possibly even some assembly language. You can't have your cake and eat it too. You either take the easy route and have your game run like completely crap or you spend the time and do it right. There are some compromises as you typically have scripting languages that take the more expressive route but thats primarily for parts where you just need to get it done and its not in tight looping code.

Game dev studios have massive teams of programmers (A lot of it may not be inhouse but rather contractors). A significant portion of them will also never actually touch the game. Many of them will be developing offline tools that assists in game development. Stuff like team communication apps, custom version control systems, asset build systems, procedural artwork generation, engine tools etc. Then you have entire teams that will develop server software. All of these guys use text based programming languages. 

CPU: Intel i7 - 5820k @ 4.5GHz, Cooler: Corsair H80i, Motherboard: MSI X99S Gaming 7, RAM: Corsair Vengeance LPX 32GB DDR4 2666MHz CL16,

GPU: ASUS GTX 980 Strix, Case: Corsair 900D, PSU: Corsair AX860i 860W, Keyboard: Logitech G19, Mouse: Corsair M95, Storage: Intel 730 Series 480GB SSD, WD 1.5TB Black

Display: BenQ XL2730Z 2560x1440 144Hz

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, trag1c said:

If you take a programming language like C++ you can solve a problem just about anyway you like. You move up the chain to something like Java and you lose some of your precision for a bit more expressiveness. Even further to python it becomes way easier to solve a problem but you cant tell the computer exactly how you want it done.

I ran into a good example of this with a recent Discrete Math problem:

"Given a positive integer n, produce a width-n array of truth-values whose rows would be all the possible truth-value assignments for n propositional variables."

 

This is a massive pile of jargon, so here's an example for n=3:

F F F

F F T

F T F

F T T

T F F

T F T

T T F

T T T

 

If you have n variables that can be true or false, list all the possible combinations of these variables.

 

There's a lot of ways to think about this problem, but I'll skip to the solution. Just count up to 2^n - 1 in binary, starting at 0. Take the value of each bit as the truth value. Like so:

000 F F F

001 F F T

010 F T F

011 F T T

100 T F F

101 T F T

110 T T F

111 T T T

 

Fairly simple. In C, this isn't too complex to do:

bitStatus = (num >> n) & 1;

There would be some work to do with finding n in a 32 bit integer, but not too hard, and pretty close to the original idea.

In Python, though? There is, as far as I can tell, no easy way to do this with bitwise arithmetic. The above syntax works, but ints have variable length, and your behavior might not be consistent. The better (or at least easier) way to do it is this:

import itertools
def truth_table(n):
    for i in itertools.product(['F','T'],repeat=n):
        print(i)

This involves bringing in a large module for a small problem. The tradeoff of python's high-level int datatype is that you lose easy lower-level access to your data. The same concepts apply with GUI vs CLI.

The GUI is an enormously powerful tool, but it also makes abstractions that can make simple tasks harder. For example, let's say I want to change my screen refresh rate. In GUI, I need to open my settings, navigate to the proper page, find the correct item, change it, and click apply.

Now let's change the X refresh rate in bash:

xrandr -r 144

This takes seconds to type and you can even alias it if you want to. This is a lot of what I actually use the CLI for on a regular basis- functions I need quick access to but not so quick they're worthy of a keyboard shortcut. The expressiveness and flexibility of the text interface is perfect for this.

The CLI these days is best for two things, IMO: the things I describe above and really fiddly, complex tasks. Working with lots of files with data-driven names, for example, is usually quicker in CLI.

 

Computers are tools, and my goal is always to use them as efficiently as possible. Sometimes the GUI is faster, and sometimes the CLI is faster. There's no reason we can't have both, and personally you can pry my terminal out of my cold dead penguin flippers :).

it's time

 

Link to comment
Share on other sites

Link to post
Share on other sites

27 minutes ago, RollTime said:

I ran into a good example of this with a recent Discrete Math problem:

"Given a positive integer n, produce a width-n array of truth-values whose rows would be all the possible truth-value assignments for n propositional variables."

 

This is a massive pile of jargon, so here's an example for n=3:

F F F

F F T

F T F

F T T

T F F

T F T

T T F

T T T

 

If you have n variables that can be true or false, list all the possible combinations of these variables.

 

There's a lot of ways to think about this problem, but I'll skip to the solution. Just count up to 2^n - 1 in binary, starting at 0. Take the value of each bit as the truth value. Like so:

000 F F F

001 F F T

010 F T F 011 F T T 100 T F F 101 T F T 110 T T F 111 T T T

I got nerd snipped and another solution is to simply do a permutation of all of the values through a cartesian product (recursively), which can be done as a single line in python:

>>> [print(i) for i in itertools.product(['T', 'F'], repeat=3)]
('T', 'T', 'T')
('T', 'T', 'F')
('T', 'F', 'T')
('T', 'F', 'F')
('F', 'T', 'T')
('F', 'T', 'F')
('F', 'F', 'T')
('F', 'F', 'F')

 

If you still want to go with the "counting numbers" way, that's also pretty easy:

>>> [print(f"{i:03b}".replace('0', 'F').replace('1', 'T')) for i in range(2**3)]
FFF
FFT
FTF
FTT
TFF
TFT
TTF
TTT

 

But I don't get what this has to do with the message you replied to, since that's a basic problem that has nothing to do with expressiveness or how it's an example of "telling the computer exactly how you want it done."

FX6300 @ 4.2GHz | Gigabyte GA-78LMT-USB3 R2 | Hyper 212x | 3x 8GB + 1x 4GB @ 1600MHz | Gigabyte 2060 Super | Corsair CX650M | LG 43UK6520PSA
ASUS X550LN | i5 4210u | 12GB
Lenovo N23 Yoga

Link to comment
Share on other sites

Link to post
Share on other sites

22 hours ago, Mark Kaine said:

What does this even mean, seriously (?) "computer science" ?

To be totally honest I think when people use a "cli" they're mostly doing this because there isn't anything better available, after all "computer science" is pretty old, and in some aspects hasn't evolved much,  but in other aspects it has, you don't really need "to write code" to program a game for example,  even if you probably could-- it would be cumbersome, take much longer and would lack visual feedback.

 

I'm not saying there's no place for a cli *currently* im saying its a very outdated concept and not the future  -- at least not for anything that requires any sort of creativity. 

 

Like is that really so hard to understand,  you are just telling the computer what its supposed to do, and a cli is the most basic way to do this, but certainly not the easiest/ fastest or most natural one. Sure, there might not be a solution for every situation yet, but in the future there will be, despite being basically just "simple" turing machines computers and AI are progressing hella fast , at some point there will just be no reason to type things to communicate with a computer anymore. 

 

Yeah and it does come off as hardcore gate keeping. 

 

Wrinting was invented some 10000 years ago. Since then it has always been the most important way to store, transfer and manipulate informations and arguably it will always be.
We perfected microphones and voice recording, yet around 1 MILLION books are published every year in the US alone.
We also perfected camera to degree that a very nice one (compared to 10 years ago) can be bought for less than 10$, with a microphone.

You have a webcam. I have a webcam. You have high speed internet, I have high speed internet.
Why are we writing on a forum instead of having a video call? Are you an hardcore gatekepeer for command line interface with other humans?

Understand this and you will understand while CLIs are still most relevant.

Don't and you will keep the "gatekeeper" nonsense.

Link to comment
Share on other sites

Link to post
Share on other sites

On 11/14/2021 at 7:47 PM, emosun said:

Yeah horses are still around despite cars being infinitely harder to build than a horse.

Where you building your horses lol, horses are ♾ harder to build

Link to comment
Share on other sites

Link to post
Share on other sites

16 hours ago, igormp said:

I got nerd snipped and another solution is to simply do a permutation of all of the values through a cartesian product (recursively), which can be done as a single line in python:

>>> [print(i) for i in itertools.product(['T', 'F'], repeat=3)]
('T', 'T', 'T')
('T', 'T', 'F')
('T', 'F', 'T')
('T', 'F', 'F')
('F', 'T', 'T')
('F', 'T', 'F')
('F', 'F', 'T')
('F', 'F', 'F')

 

If you still want to go with the "counting numbers" way, that's also pretty easy:

>>> [print(f"{i:03b}".replace('0', 'F').replace('1', 'T')) for i in range(2**3)]
FFF
FFT
FTF
FTT
TFF
TFT
TTF
TTT

 

But I don't get what this has to do with the message you replied to, since that's a basic problem that has nothing to do with expressiveness or how it's an example of "telling the computer exactly how you want it done."

Fwiw, I also had the itertools solution in my answer.

 

As to your second point, looking back there are definitely more related problems and better points to make. What I was going for was that even though the python solution is also a one-liner, it requires using more complex tools (itertoosl) and though I haven't timed it, I'd bet money it takes a lot longer. The GUI is an abstraction that, while helpful, can also require more complicated solutions to simple problems.

 

Like I said, though, I've made better points in my time.

 

 

it's time

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×