|
Unfortunately, class and instance may be unambiguous (or less ambiguous anyway), but don't generalise well as not every object-oriented language has classes.
Both JavaScript and Self support object-oriented programming in which slots (member variables) and methods are defined directly on objects.
As far as I am aware though, every object-oriented programming language supports objects that hold (ideally encapsulated) data and respond to messages (method calls, member function invocations) in some way. That pretty well sums up the role of an object. The rest is all how particular environments implement that.
I'd dispute that "most often C++ is used in a Microsoft environment". I suspect its used much, much more on Linux and (in the form of Objective C++) on Macintosh and i-Whatever platforms. Its also used in a vast number of embedded systems ranging from phones to mars rovers.
While Microsoft's MFC class library is rooted in Object, their ATL library is not. Apple use an NSObject as the root of theirs (although not every class needs inherit from NSObject).
Most C++ coding actually tends not to use class hierarchies that much - most of the C++ classes I've encountered either do not inherit anything, or from a base class that does not inherit from a common "Object" class. This becomes particularly necessary in the presence of multiple inheritance. Indeed most of the standard C++ library does not even define the base classes. For example, a library must provide a std::vector class, but that class may nor may not inherit from other classes as an implementation decision - it simply has to offer a certain interface (better described in C++ terminology as a Concept). Indeed many objects in C++ are pretty abstract - like iterators, containers, etc. which all behave similarly but have no relationship through inheritance.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
What object oriented language does not have classes? I was never able to find one.
I should have been more careful in my criteria. I was referring to the amount of code use and not lines written. Consider much of Windows and its applications are based on C++. Also consider Windows used to hold a near monopoly on operating systems. I still think C++ is used most often in the Microsoft environment. That may be changing as C# gains hold and Windows loses more of its monopoly. As far as lines written I would not even venture to guess that.
Also, do not confuse C with C++. I am sure C under any criteria is the most used language.
So many years of programming I have forgotten more languages than I know.
|
|
|
|
|
"What object oriented language does not have classes?" - I mentioned two in the post above: JavaScript and Self.
I'm not so convinced about MS's share of C++ market - witness the fact that their's is the least conformant version of C++ (compared to GCC and CLang). I think if it was still pervasive on their platform, they would have invested more effort (especially with Herb Sutter on the standards committee). I think .NET has overtaken C++, except in limited app domains such as games.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
Yes, .NET has taken over everything. As you move from VB to C++ to C# you have to relearn little. Most of the program is .NET calls. Actually all the languages Java, C#, C++, etc. are actually very small. It is all the object model/libraries that surround it that do much of the work. It is often harder to learn a new object model than the language.
Some of the standards committees add things to the language that are really part of the object libraries. They then call things that only implement the original language non-compliant. I think they need to split the language core from its supporting environment. That is how things really work. In standards committees each push their own environment and no body wins. The result is often garbage or it takes so long to approve that it is either irrelevant or obsolete.
So many years of programming I have forgotten more languages than I know.
|
|
|
|
|
Too true, I've been trying to catch up with modern C++ developments (many of these are the language) and its just got so goddamn complex I no longer know how the hell a newcomer would begin.
I was remiss earlier and neglected to provide a link to Self: Self Wikipedia[^] and Self Website[^]. It's really worth a look (although only from the point-of-view of seeing another perspective, I feel its ill-suited to modern programming). It pioneered many of the techniques we take for granted in .NET, Java and modern JavaScript - particularly in efficient VM implementation (hotspots, JITing etc.). It also introduced prototype-based programming.
I'm a little biased when it comes to defining Objects - my perspective is largely informed by the original Smalltalk definitions and I cannot help feeling that not everything since then is really progress. In particular, most later languages support something based on v-tables rather than full open polymorphism, which to my mind actually limits possibilities rather than open them up.
*Edit*
Wow - just found an awesome video on YouTube on Self - gives some real context Self Video[^]
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
modified 2-Dec-13 17:21pm.
|
|
|
|
|
My colleague found this and other horrors in a newish project.
Bearing in mind that "Id" is a nullable int and result.ID is a regular int, who in their right mind would do this (object and function names have been changed to protect the incompetent):
protected Thing populateThing(DataRow dr)
{
Thing result = new Thing();
result.Id = int.Parse(dr["Id"].ToString());
BTW, note no handling of the case when "Id" is DBNULL.
You can stop laughing now.
|
|
|
|
|
And with what did you replace it?
|
|
|
|
|
I didn't it's not my project.
My colleague was traumatised by this and many other code-crimes in the project, I'm hoping he'll recover soon ![Laugh | :laugh:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_laugh.gif)
|
|
|
|
|
I must be missing something. Doesn't dr["Id"] return an object?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
A drop down list populated from an enumeration you think? None (from FaceBook)
modified 1-Nov-13 18:25pm.
|
|
|
|
|
Nothing to see here move along.
-- The FaceBook Team
Hello World!
|
|
|
|
|
Nice... Should have "under construction"...
There are no secrets to success. It is the result of preparation, hard work, and learning from failure. Colin Powell
|
|
|
|
|
|
They might have done something better well anything but would have look better rather than keep it as nothing.
I <3 my Job
|
|
|
|
|
Are you talking to yourself?
|
|
|
|
|
He fortunately missed the recent storm that's the reason.
"When you don't know what you're doing it's best to do it quickly"- SoMad
|
|
|
|
|
There is a certain whiff of the echo chamber here.
|
|
|
|
|
If m_bHistImportRunning Then
m_lHistCounter = m_lHistCounter + 79
Me.lblHistCounter.Text = m_lHistCounter.ToString
End If
oh wait...
|
|
|
|
|
I have an expression evaluator and, amongst other things, I'm extending it with function definition goodness.
Each expression takes a data set as input - name value pair type thing - and uses it to return a value:
Egg:
data {
a % 1
b % 2
}
expression - a + b
This would take the two values and return their sum [3 for the hard of thinking]
Now I started to get clever in defining the function to allow variable arguments and it seemed to be working well until I tried to some clever re-cursiveness:
function {
# ~ allows the function to take unlimited arguments as it just represents the data:
arguments - ~
function "
# if item 1 is null return item 0
[isNull ~1] ?
~0 :
(
# clone the input [~ is everything]
data = [data.clone ~];
# remove item 0
[data.remove data "~0"];
# and call back... with ... a ... single ... argument
max = [max data];
~0 > max ?
~0 :
max
)
"
}
So it compares a number with a data set and goes boom. Who'd have thunk it!
Stupid Vilmos, very stupid Vilmos!
I am now in the process or rewriting so that I must pass a fixed number of arguments, but by using a data set the arguments are variable.
[edit]
After fixing it, I then found that running the full test lots of previously fine tests now fail, total WTE ensues. I check the code, I check the functions in the test script, I even extend the logging to try and find what I've changed. What I did was change the block name for common functions so they wouldn't be loaded...
speramus in juniperus
modified 24-Oct-13 6:26am.
|
|
|
|
|
|
public static bool checkPolTime(string SFDCStartTime)
{
string configSFDCStartTime = string.Empty;
string configSFDCAMPM = string.Empty;
int len = 0;
len = SFDCStartTime.Length;
if (len > 7)
{
configSFDCStartTime = SFDCStartTime.Substring(0, 5);
configSFDCAMPM = SFDCStartTime.Substring(6, 2);
}
else
{
configSFDCStartTime = SFDCStartTime.Substring(0, 4);
configSFDCAMPM = SFDCStartTime.Substring(5, 2);
}
string systemSFDCStartMin = string.Empty;
string systemSFDCStartSec = string.Empty;
string systemSFDCAMPM = string.Empty;
string time = DateTime.Now.ToString();
string[] splitchr = { " " };
string[] strarr = time.Split(splitchr, StringSplitOptions.None);
string s = strarr[0];
len = s.Length;
if (len == 9)
{
splitchr[0] = ":";
strarr = time.Split(splitchr, StringSplitOptions.None);
s = strarr[0];
len = s.Length;
if (len == 11)
{
systemSFDCStartMin = time.Substring(10, 4);
systemSFDCStartSec = time.Substring(15, 2);
systemSFDCAMPM = time.Substring(18, 2);
}
else if (len == 12)
{
systemSFDCStartMin = time.Substring(10, 5);
systemSFDCStartSec = time.Substring(16, 2);
systemSFDCAMPM = time.Substring(19, 2);
}
}
else if (len == 10)
{
splitchr[0] = ":";
strarr = time.Split(splitchr, StringSplitOptions.None);
s = strarr[0];
len = s.Length;
if (len == 12)
{
systemSFDCStartMin = time.Substring(11, 4);
systemSFDCStartSec = time.Substring(16, 2);
systemSFDCAMPM = time.Substring(19, 2);
}
else if (len == 13)
{
systemSFDCStartMin = time.Substring(11, 5);
systemSFDCStartSec = time.Substring(17, 2);
systemSFDCAMPM = time.Substring(20, 2);
}
}
return true;
}
Zen and the art of software maintenance : rm -rf *
Math is like love : a simple idea but it can get complicated.
|
|
|
|
|
Your code snippet is not complete. You forgot e.g. systemSFDCStartHour and systemSFDCStartMilliSecond . Also code for non-American locales is missing. You can add several hundred lines more of useless code before that return true statement, there is a lot of space for future optimizations!
|
|
|
|
|
The original plan was to finish the method while poll isn't active. It just never happened since...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is (V).
|
|
|
|
|
Nope, no redundant code in there, nope, none. Nothing to see here, move along...:TunelessWhistleSmiley:
The only instant messaging I do involves my middle finger.
English doesn't borrow from other languages.
English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.
|
|
|
|
|
I can't for the life of me figure out why someone would do this. It's not awful or subtly wrong, just kind of deranged.
DocumentInformation ldocInfo = new DocumentInformation();
ldocInfo.DocumentID = Convert.ToInt32(agmTemplateId);
if (ldocInfo.DocumentID != 0)
{
section.Items.Add(PageHelpers.CreateSidebarItem("AGM plan", "/GetFile.aspx?DocumentId=" + ldocInfo.DocumentID, true, "cmdAGMTemplate", false));
}
ldocInfo.DocumentID = Convert.ToInt32(proposalTemplateId);
if (ldocInfo.DocumentID != 0)
{
section.Items.Add(PageHelpers.CreateSidebarItem("Proposal", "/GetFile.aspx?DocumentId=" + ldocInfo.DocumentID, true, "cmdProposal", false));
}
|
|
|
|