Programming language geek-out

Non-spam and Anime things that don't fit in C&C. Also where talk that you don't want to turn into spam goes. So No Spam allowed

Re: Programming language geek-out

Postby Cheb » Sun Jun 15, 2014 1:59 am

Why? I mean did you loose the sourcecode or something? Otherwise you add another "something" and recompile it/run it.

Sorry, I meant "two instances in the same program". As, well, if you had a nice system of viewports and menus, then suddenly you have to adopt 3d monitors and Oculus Rift. Thus, you need two such systems, one for each eye and... oopsie. :evil: You'll have to remake the system into a class anyway, moving all global variables into fields and so on.

For a real example, I deliberately made chepersy a monolitic procedural mess. I'm very sorry now, as it doesn't allow for parallel operations in different threads. Remaking it into a class would require a lot of effort, too :(

A better real example, the input/window manager system in my game engine is a class. The Windows and Linux versions have different implementations descending from the same abstract base class. If I want to switch the Linux version from the ages old X-windowing system to, say, GTK+, I only have to add an implementation. Then it could even be switched on the program startup, depending on the settings. The same as it already does choose between DirectSound and OpenAL in the windows version. Classes too.

Modularity is such a great thing :roll:



I've never needed the extreme compactness nor speed of assembly or machine code. I cannot argue though that if you can code in it, it is by far the single best approach to a one off program

Not anymore. Todays CPUs are so complex (with layers, like in onions and ogres) that a decent compiler will *always* outperform a human.

I only use assembly language for specific tricks the compiler wouldn't understand. Like bit scan, or the fastest hardware timer available:
Code: Select all
pushf
rdtsc
mov dword[Result], eax
mov dword[Result + 4], edx
popf
Proud owner of 1.5 kilograms of Germanium transistors
Cheb
User avatar
Moon Senshi
Posts: 1549
 

Re: Programming language geek-out

Postby PCHeintz72 » Sun Jun 15, 2014 2:21 am

Cheb wrote:Not anymore. Todays CPUs are so complex (with layers, like in onions and ogres) that a decent compiler will *always* outperform a human.

I only use assembly language for specific tricks the compiler wouldn't understand. Like bit scan, or the fastest hardware timer available:
Code: Select all
pushf
rdtsc
mov dword[Result], eax
mov dword[Result + 4], edx
popf

True... I should have been more specific, I meant small simple one off programs. Also, in line assembly, or specific efficient assembly subroutines, was not something I was concerning when making that post either, though that is another valid use.

While I abhor inefficient code... realistically these days a balance must be maintained between ease of programming and speed/efficiency . The issues is as time goes on, programmers are becoming more and more isolated from the hardware, say by API levels and abstraction layers and things like Java and NET, while that actually makes programming much easier or at the least not more difficult, and more multiplatform, it actually makes programming truly efficient code much harder.

Consider the simple generic old standby example of hello world. how it is done in a graphical environment may be almost as easy as 30 years ago even if the exact command is not the same... but it is *not* nearly as simple behind the scenes. what the compiled code has to do to get that message to appear is far different and more complex than the old compiled command to output it to the screen in say DOS Basic or DOS Pascal, since it is being routed through tons of the aforementioned API's and layers, etc....

Additionally, outputting that example can actually be done more ways than previously, since you can do it as say a warning, a help prompt, a input response, a pop up, etc.....
PCHeintz72
User avatar
Prism Power Senshi
Posts: 2736
 

Re: Programming language geek-out

Postby Té Rowan » Sun Jun 15, 2014 4:12 pm

I first learned generic BASIC (though I didn't have a computer to run anything on) followed by ZX Floating Point BASIC (ZX81), Z80 assembler, ZX Colour BASIC (ZX Spectrum), SuperBASIC (on the Sinclair QL), Turbo Pascal and 8086 assembler in roughly that order. Been trying to pick up some phrases in C, Python, Javascript, IMP 77, FontForge script and microEmacs macro. The last sees a lot of use in maintaining and adding to my fanfic library.

I find I rarely need to code anything nowadays save for such ultra-special-purpose stuff as that converter I mentioned in OP.

I note that when you really need maximum smoke, assembler still rules. Looks to me that the All-Beating Compiler is an AI-complete project.

Edit #1: Not many things beat
Code: Select all
10 PRINT "Hello, world!"
for brevity. And, yes, there are quite a few BASIC interpreters and compilers available, both freely and for free.
A government is the only known vessel that leaks from the top. (James Reston)
Té Rowan
User avatar
Prism Power Senshi
Posts: 3034
 

Re: Programming language geek-out

Postby Té Rowan » Wed Jun 18, 2014 3:29 pm

While I am not really an OO programmer, I have experienced how powerful OOP (Object-Oriented Programming) can be. And, no, it was not C++ that taught me this, but Advsys, an OO Lisp (or Scheme -- I consistently muddle them up) dialect for writing text adventure games.
A government is the only known vessel that leaks from the top. (James Reston)
Té Rowan
User avatar
Prism Power Senshi
Posts: 3034
 

Previous

Return to Other Talk

Who is online

Users browsing this forum: No registered users

cron