REALbasic
Encyclopedia
Realbasic is the object-oriented dialect of the BASIC programming language used in Real Studio
REAL Studio
Real Studio is a programming environment developed andcommercially marketed by Real Software, Inc of Austin, Texasfor Mac OS X, Microsoft Windows, 32-bit x86 Linux and the...

, a programming environment, developed and commercially marketed by Real Software
REAL Software
Real Software, is a privately held, privately financed vendor of software development tools, based in Austin, Texas.-Products:Real Software's cross-platform development tool, Real Studio is available in four editions: Real Studio Personal Edition, for hobbyists and students, Real Studio...

, Inc of Austin, Texas
Austin, Texas
Austin is the capital city of the U.S. state of :Texas and the seat of Travis County. Located in Central Texas on the eastern edge of the American Southwest, it is the fourth-largest city in Texas and the 14th most populous city in the United States. It was the third-fastest-growing large city in...

 for Mac OS X
Mac OS X
Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...

, Microsoft Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

, 32-bit x86 Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

 and the web
World Wide Web
The World Wide Web is a system of interlinked hypertext documents accessed via the Internet...

.

Language features

RB is a strongly typed language with minimal automatic type conversion, which supports single inheritance and interfaces
Interface (computer science)
In the field of computer science, an interface is a tool and concept that refers to a point of interaction between components, and is applicable at the level of both hardware and software...

, class
Class (computer science)
In object-oriented programming, a class is a construct that is used as a blueprint to create instances of itself – referred to as class instances, class objects, instance objects or simply objects. A class defines constituent members which enable these class instances to have state and behavior...

 methods
Method (computer science)
In object-oriented programming, a method is a subroutine associated with a class. Methods define the behavior to be exhibited by instances of the associated class at program run time...

 and class properties, automatic memory management via reference counting
Reference counting
In computer science, reference counting is a technique of storing the number of references, pointers, or handles to a resource such as an object, block of memory, disk space or other resource...

, and operator overloading
Operator overloading
In object oriented computer programming, operator overloading—less commonly known as operator ad-hoc polymorphism—is a specific case of polymorphism, where different operators have different implementations depending on their arguments...

. A very important feature is the ability to extend (not just inherit
Inheritance (computer science)
In object-oriented programming , inheritance is a way to reuse code of existing objects, establish a subtype from an existing object, or both, depending upon programming language support...

 from) existing classes, like Objective-C Categories. This considerably reduces the need for the Abstract Factory Pattern
Abstract factory pattern
The abstract factory pattern is a software design pattern that provides a way to encapsulate a group of individual factories that have a common theme. In normal usage, the client software creates a concrete implementation of the abstract factory and then uses the generic interfaces to create the...

, which complicates using Application Frameworks in Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

 and C++
C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...

. Realbasic also includes delegates
Delegation (programming)
In object-oriented programming, there are two related notions of delegation.* Most commonly, it refers to a programming language feature making use of the method lookup rules for dispatching so-called self-calls as defined by Lieberman in his 1986 paper "Using Prototypical Objects to Implement...

, introspection, and namespace
Namespace (computer science)
A namespace is an abstract container or environment created to hold a logical grouping of unique identifiers or symbols . An identifier defined in a namespace is associated only with that namespace. The same identifier can be independently defined in multiple namespaces...

 support, which allows modules to contain classes, interfaces and other modules.

Framework features

As described in the language reference, its built-in framework supports (Real Software 2008):
  • dictionaries
    Hash table
    In computer science, a hash table or hash map is a data structure that uses a hash function to map identifying values, known as keys , to their associated values . Thus, a hash table implements an associative array...

    ,
  • declaration
    Declaration
    Declaration may refer to:* Declaration , specifies the identifier, type, and other aspects of language elements* Declaration , when the captain of a cricket team declares its innings closed...

    s to external libraries (dll, dylib)
  • Visual Basic
    Visual Basic
    Visual Basic is the third-generation event-driven programming language and integrated development environment from Microsoft for its COM programming model...

     datatypes compatibility,
  • full Unicode
    Unicode
    Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems...

     support,
  • regular expression
    Regular expression
    In computing, a regular expression provides a concise and flexible means for "matching" strings of text, such as particular characters, words, or patterns of characters. Abbreviations for "regular expression" include "regex" and "regexp"...

    s,
  • application programming interface
    Application programming interface
    An application programming interface is a source code based specification intended to be used as an interface by software components to communicate with each other...

     calls to compiled C
    C (programming language)
    C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....

     libraries on all supported platforms,
  • ActiveX
    ActiveX
    ActiveX is a framework for defining reusable software components in a programming language-independent way. Software applications can then be composed from one or more of these components in order to provide their functionality....

     and basic OLE
    Object Linking and Embedding
    Object Linking and Embedding is a technology developed by Microsoft that allows embedding and linking to documents and other objects. For developers, it brought OLE Control eXtension , a way to develop and use custom user interface elements...

     support (on Windows); COM
    Component Object Model
    Component Object Model is a binary-interface standard for software componentry introduced by Microsoft in 1993. It is used to enable interprocess communication and dynamic object creation in a large range of programming languages...

     objects are not fully supported,
  • Notification icons
    Taskbar
    In computing, a taskbar is a bar displayed on a full edge of a GUI desktop that is used to launch and monitor running applications. Microsoft incorporated a taskbar in Windows 95 and it has been a defining aspect of Microsoft Windows's graphical user interface ever since. Some desktop environments,...

     (on Windows),
  • Windows registry
    Windows registry
    The Windows Registry is a hierarchical database that stores configuration settings and options on Microsoft Windows operating systems. It contains settings for low-level operating system components as well as the applications running on the platform: the kernel, device drivers, services, SAM, user...

     (on Windows),
  • cooperative threads
    Thread (computer science)
    In computer science, a thread of execution is the smallest unit of processing that can be scheduled by an operating system. The implementation of threads and processes differs from one operating system to another, but in most cases, a thread is contained inside a process...

    ,
  • scripting language
    Scripting language
    A scripting language, script language, or extension language is a programming language that allows control of one or more applications. "Scripts" are distinct from the core code of the application, as they are usually written in a different language and are often created or at least modified by the...

     embedded in Realbasic programs through RBScript
    RBScript
    RBScript is a scripting language which is similar to, and shares many features with, REALbasic. They are both object oriented, support modules and use almost identical datatypes...

    ,
  • XML
    XML
    Extensible Markup Language is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards....

     parsing and generation,
  • console and service
    Daemon (computer software)
    In Unix and other multitasking computer operating systems, a daemon is a computer program that runs as a background process, rather than being under the direct control of an interactive user...

     application support (Professional & Enterprise editions only)
  • Apple events
    Apple events
    Apple events are the canonical message-based interprocess communication mechanism in Mac OS, first appearing in System 7 and supported by every version since then, including Mac OS X. Apple events describe "high-level" events such as "open document" or "print file", whereas earlier OS's had...

     (on Mac),
  • Address book
    Address Book
    Address Book is an address book for Apple's Mac OS X. It features various syncing features and integrates into the rest of the OS.-Features:*Exports and imports cards to and from vCard 3.0 format....

     (on Mac),
  • Keychain (on Mac),
  • Spotlight
    Spotlight (software)
    Spotlight is a system-wide desktop search feature of Apple's Mac OS X operating system. Spotlight is a selection-based search system, which creates a virtual index of all items and files on the system. It is designed to allow the user to quickly locate a wide variety of items on the computer,...

     (on Mac),
  • QuickTime
    QuickTime
    QuickTime is an extensible proprietary multimedia framework developed by Apple Inc., capable of handling various formats of digital video, picture, sound, panoramic images, and interactivity. The classic version of QuickTime is available for Windows XP and later, as well as Mac OS X Leopard and...

     (on Mac and Windows),
  • sound,
  • real-time 3D graphics
    3D computer graphics
    3D computer graphics are graphics that use a three-dimensional representation of geometric data that is stored in the computer for the purposes of performing calculations and rendering 2D images...

    ,
  • serial communications
    Serial communications
    In telecommunication and computer science, serial communication is the process of sending data one bit at a time, sequentially, over a communication channel or computer bus. This is in contrast to parallel communication, where several bits are sent as a whole, on a link with several parallel channels...

    ,
  • sockets (both TCP, UDP and IPC
    Inter-process communication
    In computing, Inter-process communication is a set of methods for the exchange of data among multiple threads in one or more processes. Processes may be running on one or more computers connected by a network. IPC methods are divided into methods for message passing, synchronization, shared...

    ),
  • SSL
    Transport Layer Security
    Transport Layer Security and its predecessor, Secure Sockets Layer , are cryptographic protocols that provide communication security over the Internet...

     (Professional edition only),
  • HTTP, POP3
    Post Office Protocol
    In computing, the Post Office Protocol is an application-layer Internet standard protocol used by local e-mail clients to retrieve e-mail from a remote server over a TCP/IP connection. POP and IMAP are the two most prevalent Internet standard protocols for e-mail retrieval. Virtually all modern...

    , SMTP
    Simple Mail Transfer Protocol
    Simple Mail Transfer Protocol is an Internet standard for electronic mail transmission across Internet Protocol networks. SMTP was first defined by RFC 821 , and last updated by RFC 5321 which includes the extended SMTP additions, and is the protocol in widespread use today...

     and SOAP
    SOAP
    SOAP, originally defined as Simple Object Access Protocol, is a protocol specification for exchanging structured information in the implementation of Web Services in computer networks...



The framework functionality can also be extended by creating plugins using the Plugin SDK provided by Real Software. Plugins are created using C/C++ with a variety of supported compilers, including Xcode
Xcode
Xcode is a suite of tools, developed by Apple, for developing software for Mac OS X and iOS. Xcode 4.2, the latest major version, is available on the Mac App Store for free for Mac OS X 10.7 , and on the Apple Developer Connection website for free to registered developers Xcode is a suite of tools,...

, Microsoft Visual Studio and gcc
GNU Compiler Collection
The GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain...

. Plugins can support any platform Realbasic supports, but are not required to support all platforms.

Example code

This is an example of operator overloading for a hypothetical Complex class which permits to sum a real
Real number
In mathematics, a real number is a value that represents a quantity along a continuum, such as -5 , 4/3 , 8.6 , √2 and π...

 to a complex number
Complex number
A complex number is a number consisting of a real part and an imaginary part. Complex numbers extend the idea of the one-dimensional number line to the two-dimensional complex plane by using the number line for the real part and adding a vertical axis to plot the imaginary part...

, and to sum two complex numbers:


Function Operator_Add (rhs As Single) As Complex
Dim ret As New Complex
ret.Real = Self.Real + rhs
ret.Imaginary = Self.Imaginary
Return ret
End Function

Function Operator_Add (rhs As Complex) As Complex
Dim ret As New Complex
ret.Real = Self.Real + rhs.Real
ret.Imaginary = Self.Imaginary + rhs.Imaginary
Return ret
End Function


The same function can be defined to accept Double
Double precision
In computing, double precision is a computer number format that occupies two adjacent storage locations in computer memory. A double-precision number, sometimes simply called a double, may be defined to be an integer, fixed point, or floating point .Modern computers with 32-bit storage locations...

 datatype values.
This code shows how to use the Complex class to sum a real with a complex number:


Dim First As New Complex (0, 1)
Dim Second As New Complex (1, 1)
Dim Sum As Complex
Sum = First + 5.0 + Second
// Sum will be (6, 2)
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK