|
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
|
|
|
|
|
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));
}
|
|
|
|
|
What does the DocumentInformation class/struct look like?
Keep Clam And Proofread
--
√(-1) 23 ∑ π...
And it was delicious.
|
|
|
|
|
It's just a data object with about 10 other properties. None of the getters or setters have any hidden side effects. My guess is that they thought they were going to have to use the object to do some kind of data lookup, but didn't switch it to an integer when they didn't have to.
|
|
|
|
|
I guess the author thought, that for some reason the variable name (DocumentID) must be the same as in the command string he assigns it to. Why someone would think that is beyond me.
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|