Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » Programming Paradigms and Useful Features

This thread is locked; no one can reply to it. rss feed Print
 1   2   3   4 
Programming Paradigms and Useful Features
Chris Katko
Member #1,881
January 2002
avatar

I've given up trying to counter someone's rapidly changing stances. ::)

Meanwhile, I beat the human campaign for Warcraft 2 in a day. It's amazing how crude the game is by today's standards. 9 unit selection max, terrible AI, completely scripted single player missions that feel completely scripted, two teams that are identical except for their graphics set (and four spells if you want to be a nitpicker), tiny maps, and a very shallow tech tree. The unit AI is so stupid that you'll lose a battle that you should win by shear numbers, because your units are too stupid to continue attacking without you specifically helping them. And if you play on the fastest speed (which I do because otherwise the game is boring), the combat is so quick that you don't have time to micromanage them all while the AI gets to update its units every clock tick so they always get a targeting advantage. Oh, and the pathfinding is atrocious. It will literally just "give up" if the pathfinding graph is too long, so you have to help them get there by moving them half or quarter of the way each time. Oh, and don't forget no unit queuing. Man, is that annoying. You'll find yourself building multiple unit factories just so you can que a unit on each one--not because you need them faster, but constantly coming back to the factory every 3 seconds a unit is created and selecting another is terrible. Oh, and no default waypoints sucks. We've become so used to unit factories having a default location. Warcraft 2, they poop out next to it and that's all you can do.

It really makes me appreciate how much Age of Empires 2 murdered the competition and changed the scene. It's hilarious how far everyone thought Age of Empires (1) was just "Microsoft ripping off Warcraft and Civilization." (Actual quote) When now AOE2 is lauded as one of the greatest games ever made.

I still to this day haven't noticed any new RTS game come up with a feature that Age of Empires didn't already implement wonderfully.

[edited]

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

bamccaig
Member #7,536
July 2006
avatar

The bit that distinguishes GUIs from CLIs is that the computer recognizes millions upon millions of inputs that mean nothing to it, and thousands upon thousands more that are duplicates. I.e., there are x * y pixels on your screen and depending on your mouse's resolution they can all be clicked, but in practice any given screen only has a select few meaningful "clicks". I assert that the amount of effort required by our brains to aim a mouse is substantially more than typing a command, even for a lamer. It isn't really very difficult to learn how to use well documented commands. It's quite difficult to figure out how to use unintuitive, poorly documented commands; but then the same is true of GUIs. Not only is the GUI much more exhausting to use, but it's also much more exhausting to program, debug, and test. GUIs are substantially more complex than CLIs, and even TUIs; that complexity necessarily introduces more programming errors.

Arthur Kalliokoski
Second in Command
February 2005
avatar

OTOH, any particular command line based program only has a set amount of "options" via getopt() or whatever. The power of the command line is based upon pipes, redirection and scripts.

They all watch too much MSNBC... they get ideas.

bamccaig
Member #7,536
July 2006
avatar

OTOH, any particular command line based program only has a set amount of "options" via getopt() or whatever. The power of the command line is based upon pipes, redirection and scripts.

The number of subcommands and complexity of parameters available to a command line program is equivalent to, if not greater than, the number of inputs available to a graphical program. After all, at the end of the day graphical programs are implemented on top of command line programs. Even if that weren't the case there's no reason that a command line interface (in theory) ever has to accept fewer subcommands than a graphical interface.

Chris Katko
Member #1,881
January 2002
avatar

The power of the command line is based upon pipes, redirection and scripts.

There is no real reason graphical applications can't have pipes, redirection, and scripts.

VST audio programs have been chaining data together and linking GUI controls to MIDI sources since the 90's.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Arthur Kalliokoski
Second in Command
February 2005
avatar

There is no real reason graphical applications can't have pipes, redirection, and scripts.

Well, sure, if you're going to go to the trouble of programming them in yourself, instead of letting a shell do it.

They all watch too much MSNBC... they get ideas.

bamccaig
Member #7,536
July 2006
avatar

Well, sure, if you're going to go to the trouble of programming them in yourself, instead of letting a shell do it.

In Linux a program is a program. There is no fundamental difference between command line programs and graphical programs. All of the standard interfaces are still available for you (and if the program is launched from the GUI via a shortcut or something I imagine the standard streams are opened as /dev/null). In Windows things are a little bit different because Microsoft as a company is incompetent. Still, I think that things mostly work normally. You may need to link your program a certain way, and/or may need to code in the creation of a console window... Yes, it's far from sensible, but it's Microsoft... In any case, the actual interfaces are still standard. You just may need to coerce Windows to let you use them.

Thomas Fjellstrom
Member #476
June 2000
avatar

With new storage technologies like memristors, we could store ALL of our stuff "in rom" except its not ROM, it's non volatile storage as fast as RAM is. So everything will load and save stupid fast, and no more waiting for boot, it'll already be booted since everything is running from non volatile media.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Chris Katko
Member #1,881
January 2002
avatar

and no more waiting for boot,

Until you have a system crash and have to reset your whole HDD! ;D

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Thomas Fjellstrom
Member #476
June 2000
avatar

Until you have a system crash and have to reset your whole HDD! ;D

Hehe, well I assume there would be an option to "ignore" current state, and reload all processes.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

pkrcel
Member #14,001
February 2012

Striker said:

They bought Amiga and it was a flop.

Okay, I offically give up.

With new storage technologies like memristors

Let's only hope then M$ and pther evil companies will not be all that much more wasteful :P

I don't see any need to distinguish GUI from CLI. They are functionally identical and feature overlapping characteristics. The key difference is their level of abstraction, but this difference is one of tradition and not definition.

Command line is KING when in need for "direct access", if you let me call it that...but I think there is need to distinguish between GUI and CLI.

Also, I don't get WHY there should not be GUIs....seems we think "computers" are only those tools with a keyboard and a mouse....

It is unlikely that Google shares your distaste for capitalism. - Derezo
If one had the eternity of time, one would do things later. - Johan Halmén

Striker
Member #10,701
February 2009
avatar

Pkrcel, i am disappointed that such simple facts cause you to "give up". 8-)

Slartibartfast
Member #8,789
June 2007
avatar

I find that keyboard driven GUIs are superior to both mouse driven GUIs and CLIs. They have the advantages that a GUI provides (discoverability and immediate and obvious/visible consequences to your actions), while operating as quickly, or even faster than a CLI[1].

References

  1. You can't deny that for example hitting alt+up is much quicker than typing "cd .." and hitting return, or that immediately seeing what is in a directory is not quicker than typing "ls" and reading the output.
bamccaig
Member #7,536
July 2006
avatar

You can't deny that for example hitting alt+up is much quicker than typing "cd .." and hitting return, or that immediately seeing what is in a directory is not quicker than typing "ls" and reading the output.

Except most of those things are not "discoverable" from the GUI. For example, I had no idea Alt+Up would move up a directory (and I don't know which file explorers support that). It would be fine if you learned a shortcut for every single function, but most software has too many functions for the available shortcuts (there's a very good reason that vi is modal and emacs is horrid :P).

In any case, there's no reason that a command line file explorer couldn't also support that same shortcut. In fact, your command shell could even be modal and allow shortcuts like that too. Essentially, everything a GUI can do a CLI can do better (except for graphics). >:(

Slartibartfast
Member #8,789
June 2007
avatar

bamccaig said:

Except most of those things are not "discoverable" from the GUI.

They are if it is a well designed GUI :)
Something like CTRL+F is a classic example, since it is both discoverable (generally whatever button you click to "Find" usually has the shortcut written on it), easily memorable, and consistent across all applications.

Quote:

For example, I had no idea Alt+Up would move up a directory (and I don't know which file explorers support that).

I think all of them do. Definitely Explorer(Windows) and Thunar(XFCE).

Quote:

It would be fine if you learned a shortcut for every single function, but most software has too many functions for the available shortcuts (there's a very good reason that vi is modal and emacs is horrid :P).

And you don't enter anything into the commandline in vi to move the cursor, because not everything needs to be controlled by the command line

Quote:

In any case, there's no reason that a command line file explorer couldn't also support that same shortcut.

Indeed, and then it would stray further from being command line driven and into being keyboard driven. Then you could also add some GUI magic to make things easier (for example, an icon near files so you can immediately tell what kind of file they are, or maybe a small thumbnail next to the image so you know what is in it without opening it) and end up with a pretty nifty program :)

Quote:

Essentially, everything a GUI can do a CLI can do better (except for graphics).

Except graphics are a huge part of usability, one example is the one I gave earlier (Explorer immediately shows you the contents of the current directory), but there are others. Everything is another good example[1], since Everything shows you everything that matches your query immediately (and fits in the screen), as soon as you started entering your query you know how good it is, and if you need to refine it you don't need to enter another command line, you simply continue typing your query. Additionally, once you found your result, you can navigate to it with the keyboard and hit enter to open the relevant file. Had I used a commandline I'd have to enter another command for the relevant program to open the file as well as enter the previously found path by hand.

References

  1. Everything is a program the indexes your HD and allows extremely quick searches in several ways. It is similar to "locate" on Linux except it indexes in real time so it responds to changes in real time making it x2 as nice just because of that :)
bamccaig
Member #7,536
July 2006
avatar

Perhaps I should have been a bit more strict in my terminology because it isn't clear that I mean text-based (i.e., text terminal) programs. I personally don't require a command shell only. Interactive, visual programs are great. Vi is an example. The point is, the text-based interface keeps things simple. There's no question where focus is. The keyboard always inputs to the right place. Etc. It's simpler, but it can do everything a GUI can. Graphics are completely unnecessary and generally don't add any value that cannot be achieved in plain text. I would know because I use a text interface for 99% of what I do on a computer. A well designed text-based program can be discovered just as easily as a GUI.

Chris Katko
Member #1,881
January 2002
avatar

Hey guys, I'm going to de-rail this thread by asking this question:

What methods, paradigms, langauge features have you seen that you find either useful, or wish the general public knew about?

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Kibiz0r
Member #6,203
September 2005
avatar

Chris Katko said:

Something totally irrelevant

I wish more people were interested in having alternatives to Null. It's an outdated concept, and it speaks more to the low-level value of a pointer than the implicit meaning we give it in context.

Depending on the context, Null can mean:
- This variable hasn't been initialized; nobody has decided what the value should be yet, so it is Null by default.
- The variable has been initialized, but the value isn't known at time of initialization, so it is left Null until the value is known.
- The value is known, but the value is "no value", so Null is deliberately assigned like a placeholder for "None".
- There was an error in calculating the value, so the value can't be known, so Null is a signal to fail gracefully.

I'd love it if a language came along that had specific kinds of Nulls for these four cases, especially if you still got the old Null behavior by default but you could opt in to being more specific.

I actually saw a talk where a guy implemented these in Ruby, and it was pretty interesting. The errors you get from relying on a more-specifically-null value really tell you a lot more about where to start debugging.

bamccaig
Member #7,536
July 2006
avatar

That reminds me of VB's Empty, Null, Nothing nightmare. :'( Please don't tell me you're encouraging VB-ness.

Striker
Member #10,701
February 2009
avatar

The paradigma "form follows function" means more than only to speed up.

It means, the most important is the purpose of the program. Some programs have evil purposes, like viruses. Many are only time waster, like games, although you can say some are training for quick reaction or brain jogging. And there are technical, office and learning programs you need for serious work.

After Vedanta philosophy the best programs are those whose intention is to serve God. Such a program could be about herbs and healing plants. To show how senseful nature has created healing plants for all purposes together with the humans. Bear in mind that most modern pharma products are nothing but isolated active ingredients of plants. But in plants you have a natural combination which makes it easier for the body to handle without byeffect. And through byeffects of medication more people die than through car accidents.

Many programmers want to program something, but they don't know what. The result often is a time waster for the user. If you make a program that makes people realise God you are going in the direction of heaven. Thats the most important paradigma.

Arthur Kalliokoski
Second in Command
February 2005
avatar

#SelectExpand
1#include <stdio.h> 2 3int main(void) 4{ 5 long long int i; 6 for(i=0; i<9000000000; i++) 7 { 8 printf("God "); 9 if( !(i & 15)) 10 { 11 printf("\n"); 12 } 13 } 14 return 0; 15}

They all watch too much MSNBC... they get ideas.

Fishcake
Member #8,704
June 2007
avatar

I found out a few years ago that you can "simulate" named parameters in C++ via the Builder pattern. Useful if you have an object with lots of variables to construct it:

FooBuilder builder;
builder
    .setName("Foo")
    .setDescription("Lorem ipsum dolor sit amet")
    // ...

Foo foo = builder.create();

Chris Katko
Member #1,881
January 2002
avatar

That uses, Method Chaining, yes?

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

J-Gamer
Member #12,491
January 2011
avatar

That uses, Method Chaining, yes?

Those functions will return a reference to this. So yes, that's the wiki definition of method chaining.

append: This is not a language feature, but then it kind of is since it's parsed by a meta object compiler: Qt's signal/slot mechanism.

" There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo
"If your body was a business, thought would be like micro-management and emotions would be like macro-management. If you primarily live your life with emotions, then you are prone to error on the details. If you over-think things all the time you tend to lose scope of priorities." - Mark Oates

Kibiz0r
Member #6,203
September 2005
avatar

bamccaig said:

Please don't tell me you're encouraging VB-ness.

Totally! Who doesn't love Visual Basic?

But for real, if you could do all of the things you normally do with Null, but also infer more about why something is null based on what "kind" of Null it is, wouldn't that be nice?

 1   2   3   4 


Go to: