Tuesday, August 31, 2010
Tuesday, August 17, 2010
C++: Misc notes 5
I'm sure learning about classes is a new thing for most of you, so I decided
to have you create a table class - since I think it's one of the simplest
object that i can think of. i shouldn't have put in double variables for
width and length, but I put that in their because we need those for later
when we get into inheritence.
Few more misc notes:
* When designing a class, write out what the properties of a class should
have, as well as means of manipulating and getting info from it.
* Be sure to include scope resolution operator, otherwise the ocmpiler will
complain about undefined variables and functions.
* When writing interface files, include semicolon at the end of the function
signature; in the implementation, you don't include a semicolon when writing
the body of the function in question.
That's all I can think of at the moment...
// JL
C++: Exercise: creating a small class
Let's put this info into practice:
This exercise is in two parts. The first part is creating an interface file
(.h) for a class, and the second one is creating the implementation (.cpp)
file for this class.
Spend some time coming up with design and implementation of a table class.
The class would describe a typical dining table. The member variables and
functions are:
Member variables:
* Three double variables, representing length, width and height of this
table.
* A string with the manufacturer and a string for uses of this table e.g.
dining. writing desk, etc.
* An integer to store manufacturing date, as well as an integer to store the
sitting capacity of this table.
Member functions:
* A default constructor: Set the width, height and length to zero, use null
string for manufacturer and purpose of this table and set the capacity and
manufacturing date to zero.
* Parameterized constructor 1: passes a string (uses of the table0 and an
int (sitting capacity0 to the object. The length and width must be set to
three times the capacity (in feet), height to 1 (1 meter) and manufacturer
to null string.
* Parameterized constructor 2: Same as first constructor but adds a string
for manufacturer.
* Accessors: Three of them - get_sitting_capacity to return an int,
get_manufacturer to return a string and get_table_uses to return uses of
this table.
* Mutators: three of them - set_manufacturer to set the manufacturer,
set_table-uses to set the uses of this table and set_sitting_capacity to set
how many people can sit on the table.
* Be sure to split the interface and implementation into separate files. In
the header file, include the inclusion guards; in the implementation file,
be sure to add scope resolution operator and include the .h file.
We'll improve the quality of this table class much later when we create more
types of tables on top of a base table (be prepared for inheritence...).
// JL
C++: Few misc notes on classes...
and learning new things. So, I'll take this time to go over few
miscellaneous notes on creating classes.
First, when you create the interface file (classname.h), you need to include
so-called "inclusion guards." These are actually commands to C++
Pre-Processor to not include the file again once the file has been created.
A typical inclusion guard goes like this:
#ifndef __classname_h__
#define __classname_h__
// The content of the header...
Friday, August 13, 2010
The future of blindness notetakers and other opinions...
forum.
Yesterday, some people on the GW Micro list for Braille Sense products
started talking about the future of blindness notetakers in general. (here,
a notetaker is a device used to take notes and do other tasks; in this
context, a specialized computer with Braille input/output). The core topic
was whether current blindness notetakers (herein refered to as blindness
PDA's) have any future viability, and various discussions on connection
between current mobile computing trends and blindness PDA's on the market
today. While some said that notetakers will not go away mostly because of
use of Braille I/O, others pointed out recent developments in ever changing
technical demands and needs as reasons for demise of notetakers as we know
it.
As a participant in this discussion, I cited with both sides: that Braille
system is the most effective way of communication between us (blind) and
sighted peers, but mainstream development must be taken to account when it
comes to discussing future of these devices. I went so far as declare that,
if there is no openness in platform, there will be no progress in
development (currently, the top PDA's, BrailleNote and Braille Sense does
not have an SDK). After several hours of debate, a GW Micro representative
finally stepped in, clarifying (indirectly) about the nature of the list in
question - a support forum for users of Braille Sense family.
So, here I am, composing this blog post in response to all the messages that
were sent to that particular list and observing message trends on other
lists - thus, here goes my opinions:
First, let's discuss the communication channel between users and a
manufacturer. The background is that there is a opinion that "... there is
no communication, or little messages from HumanWare ....". That, I'd say, is
not true for a number of reasons. First, Humanware does respond (mostly in
private), it's just that the messages coming from Canada has slowed down
somewhat. These days, that trend has somewhat reversed (not entirely), with
some tech support reps responding occasionally to messages on the
BrailleNote list. Second, it should be noted that almost all answers on that
particular list comes from "expert users" (including myself) who knows ins
and outs of KeySoft architecture, leading to a possible impression that the
company does not respond much. You may notice that all "hacks" and tech
information was sent by several individuals, including myself, Alex Hall,
Nicole T., Robert Cummings and other experts, with hacks and info ranging
from bug reports to most advanced info so far - changing system sounds and
finding memory leaks under keysoft.exe (which plagued models prior to Apex).
Thus, just because the company does not respond publically does not mean
that the company is not responding at all - it's just that the reps do
respond, but in this case, it's the very nature of the list that drives BN
users forward.
Second, let's ponder the thought of notetakers and programmability.
Computers are meant to be programmed in some way - which I think is the
greatest invention since 1945. Notetakers, in essence, are computers
themselves - a specialized computer, in fact. If the logic statement that
"computers are programmable" holds true, then it'd make sense that
notetakers are programmable as well. The one huge drawback is the
availability of actual tools of doing it (called SDK, or Software
Development Kit). In connection with our PDA situation, Braille Sense (more
properly called Braille Hansone (pronounced han-so-nae) in Korean) has
Contents sDK in Korean as of 2010; HumanWare does have application framework
to support writing new programs under the hood.
This leads to several questions: Will HIMS (Human Information Management
Service), the producing of Braille Sense, come up with English version of
their Contents SDK? Will GW Micro, the North American distributor of Braille
sense, work with HIMS to develop English extensions to popular contents
(which includes a handy Bible reference program for Koreans)? Will Humanware
Group, maker of BrailleNote family, release a public SDK for KeySoft? In my
view, I'd say it'll be great if there would be SDK's for both platforms so
that those who are familiar with programming can write useful software for
these devices (by the way, both were developed in C++). But that involves
time and effort, and testing is required to make sure that the documentation
for the SDK is up to date and as accurate as possible. Then you may ask,
"why don't we write a simple program using C++ for these devices?" The chief
problem is the communication method that is in use - Braille characters,
which requires special attention when it comes to input/output routines, as
well as design considerations for general embedded devices - slow
processors, low memory, specialization, etc. I'll continue to advocate for
SDK's for these platforms until it is here - for the future of these
devices.
Speaking of future of these devices, this brings me to the final opinion of
the day: connection between blindness PDA's and mainstream trends. As we
have examined, if notetakers are computers, then all things related to
current happenings with mainstream embedded systems must hold true -
changing perception, more accessible mobile technology, etc. The perception
these days, in my observation, is miniaturization and more attention on
accessibility in general, as well as being independent of cables via
Bluetooth and Wi-Fi. Also, people want more creativity and openness in terms
of development, as well as being able to keep in touch with others at all
times (almost all times, which I believe is the success behind Android
environment running on top of modified Linux kernel). With this trend in
mind, I'd say the trend for blind people would be more independent devices
using wireless means of communication i.e. having almost the same devices as
sighted peers with an added way of communicating with them via Braille
support. In my view, notetakers will be around for a while, but current
trends and changed perception on mobile tech world will cause blind and
visually impaired computer users to reconsider their options.
In closing, I'd like to leave you with a well-known phrase: a frog in a
pond. In other words, it is time for enlightenment in blindness technology
world to inform citizens that there are other choices out there, and the
full power of a computer will not be realized until useful programs come out
for the above platforms. I look forward to a day when users will be the
chief driving force behind innovation and creativity, with many creative
apps produced for the benefit of the future generation to come.
Signed: Joseph Sungwon Lee
University of California, Riverside (class of 2012)
Saturday, August 7, 2010
C++: The car class part 3: Accessors and mutators
out how to obtain properties about a given object and setting its properties
based on our input.
Note: Some of the function names may differ from those that I've declared
earlier.
Let's return to the declaration of a car - a 2008 Ford Mustang, but let's
say if we don't know what the released date of that car is. How do we find
out various properties i.e. values in a member variable for our car? This is
done through accessors. As the name implies, an accessor "accesses" the
private data of our object (encapsulated member variables) and returns
whatever information we need.
A typical accessor looks like a regular function with a return type, a
function name (with or without arguments, mostly without) and a return
value. So, for instance, if we want an accessor to tell us what the model of
our car we are dealing with is, we can say in English:
Can you return to me a string for the model of our car?
In C++, this is translated as:
string Car::get_model()
{
return model;
}
As we've seen before, since we are dealing with a member function of our own
class, we need to provide a scope resolution operator. But here, we need to
type that in right after typing the return type, then the object name
followed by the operator (::). In our context, the only thing that this
function (accessor) would do is tell me the model of our car, as seen below:
Suppose if I want to get the model of a car object called "my_car" and store
it in a string variable called car_model. I can do it using the following
code:
In English: Create a string variable called "car_model" and assign to it the
string returned by the get_model function of our car object called "my_car".
In C++ (in main):
string car_model = my_car.get_model();
Noticed something familiar? As you might have guessed, my_car is our car
object, and the "dot" operator tells us that get_model is a member function
of our car class. So, in this situation, the string variable (car_model)
would be initialized into whatever is returned by this accessor function (in
our example, a "Mustang).
Another example: Suppose I want to find out when a particular car model
(Ford Mustang) was released. To help me out here, I need to create another
accessor function to tell me of this fact, which would be appropriately
called get_release_year that would return an int of model year. Can you tell
me how you would write this accessor? To help you solve this problem, I will
not write the accessor here - it's up to you to design the accessor based on
the following: the year variable in the car object is called release_date,
and the accessor does not take any arguments. After you're done, you need to
create an int object to store whatever is returned by this accessor
function.
Now we know what the release date and the model of our car is, how do we set
our own input as a car property e.g. a different release year, different
manufacturer, etc.? This is done through mutators - to assign something from
one thing to another. Unlike accessors, we don't need to return anything
e.g. a return type of "void" would be used because all we are doing is just
assigning our own data as part of an object.
For instance, if I want to tell the computer to change the release year of a
car, I can ask the program to get my input and assign it to the release_date
property of our car class. In English, this could be done as follows:
* Create an int called year that will store the new release year of our car.
* Have the user enter the new release year, then pass it to our mutator to
be set as the new release date of our car.
A bit complicated, but I'm sure this can be done. All we need is the
following four lines of C++ code (again, scope resolution operator comes
in):
void Car::set_release_date(int & d)
{
release_date = d;
}
The code above did what it was supposed to do - get our input and assign it
to the release_date member variable of our car. But how do we make it
"interactive" e.g. get the actual input? Let's use my_car object once again
on the following C++ code:
int year; // The new release date of our car.
cout << "What is the release date of this car?" << endl;
cin >> year;
my_car.set_release_date(year);
As you can see, we are taking the value stored on "year" and assigning it to
the member variable.
Another example: Suppose if I want to change the manufacturer and model of
our car. Try to come up with your own mutator for these ones using the
following hints: the target variables are named "model" and "manufacturer",
respectively. We want to make sure that there would be two mutators - one
for each of our member variables. Create a mutator function to take a string
argument and set it to these two member variables. Then create a block of
main() that will ask the user to type a string for model and manufacturer
and set it to the member variables of our my_car object. Again, I'll not
give you my code - just want to find out if you've understood it. Don't
forget: in the mutator functions, you need the scope resolution operator...
I think that provides a general overview on accessors and mutators. I'll
come back and write few things about these two in a sec...
// JL
C++: The car class part 2: Constructors
building a class called "car."
Note: Some of the variable names may differ from what I've declared as part
of the class interface earlier.
Logically, in order for an object to exist, we need to create, or construct
it from scratch. This is what a constructor is. Here, a constructor is a
special function that instanciates, or make an object exist on a computer's
memory. It usually takes a value from input and assigns it to the member
variables of a class; in some cases, we (the class designers) need to assign
default values for our member variables for our classes (called default
constructor).
A typical constructor looks like:
class::class(type whatever, additional data)
{
member_var = value;
// Additional ones...
}
There are quite a few things here. I think this is the first time you are
not seeing a return type for a function like this. Actually, a return type
does exist, but it is not that apparent: that return type is to tell the
program we want to create an object, that's all. Also, I believe this is the
first time you are seeing double colons (::). This is called "scope
resolution operator" and is used for telling us (the programmers) where a
data or a function belongs to. For instance, if we put:
std::cout << "Hi..." << endl;
we are saying that we want to use the "cout" operator under standard
library. Similarly, if we put our class name and the double colon in front
of a print function, like:
class::print();
We are saying that we want to use the print function - a print function that
is member of an object. This becomes important later when we talk about
inheritance.
Now, let's create a default constructor for our car class - a constructor
that will be invoked when we don't supply our data when we declare a car
object. In order for this to work, we need to provide our own default values
for our car object. For instance, we can say that the default car is 2004
Ford Escape (a likely car). In order to do that, we can say:
* Create a default constructor called "car" with member variables of the car
object (model, manufacturer, date of release) provided by myself.
In C++, it would look something like:
Car::Car()
{
model = "Escape";
release_date = 2004;
manufacturer = "Ford";
}
So, for instance, if we declare something like:
Car test;
It would invoke the default constructor (the values we've just declared
above). As I've been saying: you need to provide initial values for ALL
member variables of a class.
But what if we want users to actually give us the model, manufacturer and
release date of a car? We can come up with so-called "parameterized
constructor" to take a user's input and assign it to the member variables.
In this context, it would be two strings for model and manufacturer, and an
int for released date (year), with each of them called m, n and r,
respectively. So what should this constructor do?
* Almost same function body and declaration as the default constructor
above, except that we need to provide a set of arguments.
* Here, the arguments would be user-specified properties of an object.
In C++, it would look somewhat similar to what we have up there, except:
Car::Car(int r, string n, string m)
{
model = m;
manufacturer = n;
release_date = r;
}
Sound familiar? This is exactly the same thing as the default constructor -
instanciates a car object with values obtained from the users, like:
Car my_car(2008, "Ford", "Mustang");
As we've seen, there are different ways of instanciating a class via
constructors. There are other variations of this concept, namely ones with
different parameter sets, one or more parameters missing (in that case, we
need to "fill in the blank" i.e. provide our own default values for missing
parameters) or copying one object to another (called copy constructor). The
last one will not be seen until much later.
As for declaring an object, in my case, I prefer to use parameters when
instanciating my own object of my own creation. It's really up to you to
invoke either the default or a parameterized constructor when declaring
something of your type. The next topic will be on how to obtain a member
value of an object, as well as setting something to our liking (accessors
and mutators), respectively.
// JL
Friday, August 6, 2010
First impressions of Windows 7
Thought I should write a mini report on what I've been doing lately.
Besides, hope you are enjoying the C++ notes - I'll post more about classes
and introduce you to pointers next week.
As of now, I'm composing this message on my laptop running Windows 7
Professional 32-bit. So far, it's been great - runs faster than Vista and
all my current devices - sound card, graphics and external hardware - are
compatible with this newer OS. As you may know, I'm using a screen reader on
top of the OS to work with programming and other things.
You may wonder how I got this new OS. The answer: I've installed it myself.
Surprised? I know - it is indeed possible for people who are blind or
visually impaired to install newer Windows versions on their own using a
built-in screen reader under Windows. When the installation happens, a
complete image of Windows 7 will be run during install, so I can interact
with setup environment via speech.
I could have chosen 64-bit OS for better stability and fun with more memory;
however, because of compatibility with existing programs and devices, I
chose 32-bit instead. However, I'll make clear that Win7 will be my last (or
second to last) 32-bit OS.
At least that's for now.
// JL
Thursday, August 5, 2010
C++: Creating a car object part 1: class interface
this notes series and wondering what should I do next. Well, I was like you
when I took my C++ course. Now being a amature pforgammer for about a year
or so, I'm starting to understand the "under the hood" works done by
compilers when we create custom data types - classes. So, starting from this
post, let's build a simple class - a "car" class - perhaps to use it in a
car manufacturing plant simulator or similar.
The first thing we need to think about is what member variables and
functions (methods) would this car class have. First, let's think about what
properties does a typical vehicle have: the car model, manufacturer, date of
manufacture and its type, among other things. Next, what sort of thing do we
want to do with this car? We need to find out its model and manufacturing
date, as well as have a plant worker label the car's type.
Based on that, a design of a car class comes out to be:
A class called "car":
{
* Member variables: a string to hold car's model, an int to hold its
manufacturing date, and a string to hold the type of car.
* Member functions: Useful constructors (to make the object exist),
accessors (getters) to find out the properties of a car and mutators to set
a car's property based on user input.
};
The above code is the English version of a typical C++ code for defining a
car class, which is reproduced below with comments:
class Car
{
private:
string model; // The model of our car.
int date_of_release; // The manufacturing date.
string car_type; // The type of our car.
public:
Car(); // The default constructor.
Car(string m, int y, string t); // A parameterized constructor (m = model, y
= year, t = type).
// Accessors:
int get_release_date() const;
string get_model() const;
// Mutators:
void set_model(string & m);
};
There are several things we might have seen elsewhere, but wasn't explained
in detail in code form until now. also, we have quite a new friends out
here, so I'll describe to you what they are:
* Whenever we don't want to change anything stored in a variable, we put the
keyword "const" (constant).
* Notice that I used access keywords (private and public). The private parts
are the member variables - this is called "data encapsulation" where the
outside code does not know what the internal properties does an object have
apart from the object itself.
* The default constructor does not have any arguments; however, we need to
initialize ALL members of this class to a known (or other) values as
default, which I'll show you on the next post.
The above class code is sometimes called "class interface" or class
definition, and is usually stored in a header file with the class name e.g.
car.h. The actual "body" of our class, or class implementation is stored as
a source code file e.g. car.cpp. Although it is possible to write the class
interface and implementation under one roof, it is far more easier (in terms
of maintenance) to store them separately (this is called multi-file
compilation). But when we use this method, we need to put in more extra text
to really make sure that the compiler would know what to do when
encountering a class that was defined already (called inclusion guard). The
full text of a typical .h file will be shown on the next post with few more
definitions. After this, I'll go through creating a class implementation
with comments about constructor creation.
// JL
Wednesday, August 4, 2010
Opinion: Possibility of JAWS for Windows Mobile
notetaker aurena: PAC Mate, a customized PDA hardware with Braille keys
running under Pocket PC 2002 with popular screen reader - JAWS for Windows -
written for Pocket PC operating system. This was a breakthrough, marking the
debut of Windows Mobile family of operating system for people who are blind
or visually impaired. Previously, the only PDA running on top of windows CE
(which powers Windows Mobile) used custom interface for interacting with a
user, thus usage of mainstream software was a big hit with Freedom
scientific.
The biggest advantage of PAC Mate (PAC = Personal All-purpose Computer) was
the ability to run third-party programs written for Pocket PC environment.
This meant work was being done a FS to prepare for launch of PM, including
scripting Pocket Word and other built-in programs, as well as testing
hardware and software products to be compatible with PAC Mate's initial
release. Since then, other generations of PAC Mate (after initial BNS/TNS
running under PPC 2002) followed, including PAC Mate BX/QX (launch in 2003
under windows Mobile 2003) and PAC Mate Omni, launched in 2007 using Windows
Mobile 6.0 Classic.
Although using third-party software and hardware was a big plus for PAC Mate
series, there is one huge drawback, in my opinion: too much customization of
JAWS for Pocket PC executable for built-in drivers and hardware
configuration only, which defeats the purpose of mobile computing under
today's standard - changing devices on the move to suit a person's needs.
Although dedicated hardware modules does have its benefits, under today's
rapidly changing specifications of mobile devices, it would be hard for
Freedom Scientific (in my opinion) to market JAWS for Pocket PC on a
platform that is around three years old, even though FS markets it as
running the "latest hardware specs." To understand what I mean, here's the
hardware specs for a typical PAC Mate:
* CPU: Intel X-Scale PXA255 at 400 MHz versus other ARM CPU's running at
around 600 MHz.
* RAM: 64 MB compared to 256 MB found on today's phones.
* Flash ROM: 128 MB compared to 512 MB to 8 GB found on some PDA's and
phones.
Using these specs, it'll be hard to believe that FS's strategies would work
when it comes to marketing a customized hardware. Thu my opinion of
releasing JAWS for Windows Mobile as a software product rather than as a
hardware-bound executable.
There are numerous benefits to this move. First, a user can change his or
her device depending on personal needs. Second, it'll be somewhat easier for
Freedom Scientific to port JAWS for Pocket PC to mainstream hardware
platforms, given that it utilizes generic drivers for basic hardware
configurations and making sure that scripting works as expected. Third,
it'll be useful for FS's marketing strategy to point out that JAWS would be
a universal screen reader for some of the popular platforms out there -
chiefly under HTC devices. Fourth, if generic Bluetooth stack is
implemented, it'll be easier for third-party Bluetooth Braille displays to
interface with JAWS for Windows Mobile among other devices. Despite these
suggestions, there's bound to be compatibility issues, but when thinking
about this move, I strongly support that releasing JAWS for Windows Mobile
as a software product would be more beneficial and cost effective, as
evidenced by above reasoning.
At least that's what I have. If you have any comments, please let me know...
// JL
Tuesday, August 3, 2010
C++: Meet some terms used in classes
things we can use to create rich set of custom data types. Now, let's take a
look at some terms used when talking about classes and objects.
First, the word "class" itself. In tech language, it means, " programmer
defined data type, a container containing data and functions for a specific
object." So, for instance, a computer can be a class, since a programmer
needs to create that custom data type for working with computers e.g. CPU,
RAM amount, etc. Or, a class might be everyday objects, including tables,
chairs, doors, rooms and so forth. Or it could be something specific to a
particular task, such as computer time, dates, appointments and even word
processor documents.
In order for us to work with classes, we need two things: member variables
(the properties of a given object) and functions to access and set member
variables (called member functions). Member variables could be anything,
including numbers, decimal numbers, strings or even a class that a
programmer has created. Member functions include ones to create, or
instanciate a class to existence(constructors), mutators to set member
variables and accessors to get a member variable. The mutators and accessors
are sometimes called "setters" and "getters", respectively.
In terms of syntax, a class has usual appearance of a function except that
there are no parentheses for storing arguments, and that you need to put a
semicolon after right brace(};). For instance, if I want to create a class
called "car," I have to write it as:
class car
{
// Whatever we need to put in...
};
The whole discussion of why we put in semicolon would be discussed much
later when we go into data structures.
Few more short definitions:
* Constructor: A constructor is a special member function to instanciate, or
make an object exist. There are usually two types of constructors with
variations of each of them: a "default constructor" for storing default data
for that class, and "parameterized constructor" to put necessary arguments
that a user (programmer) types when creating a variable of that class type
(after all, classes are custom data types).
* Mutator: A mutator sets something to a member variable of that class.
Usually they are "procedures" (void functions) with a prefix "set".
* Accessor: An accessor is a function to retrieve values stored in a member
variable. They have a return type and usually they are prefixed by the word
"get".
* Access keyword: An access keyword defines how much information, or data is
exposed to other programs. There are three of them: private, useful when a
programmer wants to limit access to a member variable or a function to a
given object only, public where any program and data (anyone) can access the
object and protected, which means that a child class (an inherited class
from a base class) wishes to use existing privilages of members of a parent.
The third keyword requires special attention - thus, I'll come back to it
when we build another layer of custom classes on top of a base class (called
inheritance).
* Destructor: A destructor is used to destroy an instance of an object. This
requires a keystroke in front of a constructor, which I'll show you much
later when the time arises.
And other terms, which you'll meet as time goes by. Starting from a few
posts later, I'll demonstrate an example of creating a simple class (called
car). Along that way, I'll give you some tips on creating your own classes
and have you go with building your own simple objects, declaring it under
main() and actually using it.
// JL P.S. Gotta run for CS lecture...
Monday, August 2, 2010
C++: Introduction to classes
with. Starting from this post, I'll dive into ways in which we can have our
own data types for solving various problems. Along the way, we'll
investigate how to manipulate classes, pointers and other more advanced
topics.
First of all, as this is just an introductory post, let's ask ourselves,
"what kind of data can a computer store?" Obviously it needs to work with
numbers, so an integer data type is provided. Next, we want to have a
computer work with decimals, so we use floating point (decimal) numbers, in
our case, a double number (technically called double precision floating
point numbers). However, sometimes, we want computers to store our names, so
we use characters and strings to help us out with that task. Finally
(almost), we want computers to make decisions based on user input, so we use
Boolean (tru/false) values. There is one more built-in data type called
pointer - an address of where data is stored, but we will not meet its true
form until later.
But how about if the problem we wish to tackle cannot be solved using the
above data types above? How about if we need to work with various game
scenes, a list of rooms or counting number of cars at a parking lot? What if
we want to create our own programmer-defined data types, or custom data type
that we can use for solving other kinds of issues? The answer is a perfect
"yes, it is possible to create our own data types". C++ and other
programming languages allows us to create and work with our own data types,
known as classes and objects. Any data that a computer can work with -
numbers, names, and even files - are called objects - hence, the phrase
object-oriented programming (OOP) came out, which means we can manipulate
these "objects" to help us solve problems.
So what other kinds of data we can "create"? There are millions of them,
including a desk object, a chair, a video game character or even the stars
on the solar system. Each of these data types are not defined in C++, so we
(the engineers) need to create them, or define them. For example, a "video
game character" object would have properties such as its name, various
actions it can perform and sounds it can make, if any. Similarly, a desk
would have descriptive values such as its length and width, its uses (dining
table, study desk, etc.) and who made the actual desk (the manufacturer).
All these are stored as an object, or class as private member variables
within it (we'll come back to the meaning of that statement when we visit a
"lab" i.e. exercises and examples for creating a class). Also, the various
actions that can be performed on it can be dealt with via creating member
functions (we've seen this phrase before, but we'll examine the very meaning
of that phrase shortly when we create an example class).
Now, can you think of any other objects we can create using this method? If
you have any, please leave a comment... We'll examine how it can be done, as
well as some terminology used when talking about classes starting from a few
posts later...
// JL P.S. Need to study for a homework at UCR.
UCR: UC Riverside, Unstoppable Christ's Revival
http://www.facebook.com/group.php?gid=146887048662027&v=wall
Sunday, August 1, 2010
Who is God?
ask this question at large to see people's reactions.
So what or who exactly is God? Many people say that God is just a creator, a
supreme being with supernatural powers or use descriptive language to
describe God. There are debates about this, including a notion of god's
gender, whether there is only one god or other gods, or is there such as
thing as a deity.
In my view and after my experiences, there is a God out there "somewhere."
I'd say many people believe there is no god because they canot see one. I'd
also say that people believe in many gods due to various natures surrounding
earth's events. In my case, there is one and only one god - the Jewish
thought calls him "YHWH", commonly translated into English as LORD God. This
God is one and only one who knows when the earth was created, who knows
exactly how many genes does a human have and even know when the world as we
know it would come to an end. This god, we (those who know it) call Father.
So who is this "father?" After talking with him for several years and
studying his word (bible), I came to the conclusion that the best words to
describe him are "love" and "caring." He is full of love - even loved us
(humans) to send his one and only son, so that he can die in place of us
because of our sin (John 3:16). He is also merciful - loving us a lot that
he puts us through "tests" to help us trust him more..
He is also caring for his people. Even though we do not see him, we (the
people who know him) knows his presence, because we have walked with him for
so many days and years. Besides, he gave us a human representation of him
and his word - jesus Christ of Nazareth (John chapter 1).
But how do we know God's presence even though he is a spirit? We know him
through faith and his words that teaches us who he is. Also, God is known
through people's actions and what we say - after all, the proof of one's
faith is his or her actions.
So who exactly is God? To me, he is many things, including "my creator,"
"king of kings," "the ultimate beginning and end," "my friend," "my helper,"
"my professor" and so many other words that I cannot think of. That's how I
view and know him.
Just my thoughts, that's all.
// JL