Tuesday

Ruby Delegates, Time Dilation, Delphi Navigation

 
 Programming
 
 
From Scott Orgera, your About Programming Editor
 
Follow us on:
 
 
Entering the dog days of summer is certainly no reason to slow down our learning progress, and this week we take a look at a wide array of programming topics. Enjoy!
 
 
Ruby: Dynamic Method Invocation
Ruby is very loosely coupled, compared to compiled languages like C and C++. In compiled languages, you usually have to know the name of the method (or member function, or normal function) that you want to call before the program will even compile. Once compiled, may compilers even strip away all names, or at least mangle them to be convenient to the compiler, linker or runtime linker. There's no practical way, without adding significantly more code, to call a method you don't know the name of at runtime. In contrast, Ruby is much more flexible. It has no real concept of "compile time" and all method invocations are resolved at runtime. This gives you the ability to call methods you don't quite know the name of when writing the program. READ NOW

Ruby: Delegates
Many languages have the concept of a delegate. But to understand what a delegate is we should take a look at its predecessor, the function pointer. Function pointers store the address of a function in a compiled language (C, for example). Not only that, but they store the type of function it's pointing to, including its parameters and return type. They're useful for callback functions, where one part of the code finishes an action and then calls the unknown function using the function pointer. It's a method of decoupling code, the code that calls the callback function has no idea what the callback function does. READ NOW

JavaScript: Faster Loading Web Pages
Having any JavaScript in your Web page will slow down the loading of the page. The reason for this is that Web browsers will not download any other file required by the page while a JavaScript file called from a script tag in your page is downloaded and run. The logic behind this is that the JavaScript can change what the page needs to download, and therefore there is no point in continuing downloading other files until the JavaScript is downloaded and run in order to find out. READ NOW

PHP: Time Dilation Calculation
If you are at all interested in special relativity, then you will probably end up calculating gamma (time dilation) at some point. The Greek letter gamma is used to represent the value for the time dilation experienced when you move relative to another object. The time dilation that you experience increases dramatically as you approach the speed of light. READ NOW

 
ADVERTISEMENT
Featured Articles
More from About.com
Sign up for Shareables!
An every-morning rundown of the day in history, with headlines and trends produced by your pals at About.com. Click here to sign up! It's free (of course) and we think you'll like it!
Want More From About.com?
Check out our social channels tailored to every interest!
Sign up for more free newsletters on your favorite topics

You are receiving this newsletter because you subscribed to the About.com Programming newsletter. If you wish to unsubscribe, please click here.

If you would like to unsubscribe from all newsletters sent from About.com, please send an email to optout@about.com with "Unsubscribe" as the subject line.

Contact Information:
1500 Broadway, 6th Floor
New York, NY, 10036

Privacy Policy © 2014 About.com