|
Unfortunately not: the whole book is LINQ, which is not available in C (nor are IEnumerable interfaces).
And I think they should know what they are doing: the two authors are "Community Program Manager for the Microsoft C# Team" and "Senior Program Manager in the Microsoft .NET Developer Platform Team" according to "about the Author".
Now I think about it, it explains a lot about MS software, really...
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
You had me at the word "Manager".
Explains it all.
I am half a manager now, and my code has been deteriorating at an alarming rate.
|
|
|
|
|
Classic pick. The guys at Microsoft must get back to clear basics.
|
|
|
|
|
What book?
--
Kein Mitleid Für Die Mehrheit
|
|
|
|
|
The books not by Dietel & Dietel by any chance?
They seem to have written exactly one book (in c++ I suspect) then re-written if for a variety of OO languages. The VB.net book has GetValue() SetValue() methods over properties. We're currently using this as the course text
|
|
|
|
|
Now I understand why we find some of the questions we can see in the forums...
|
|
|
|
|
I hadn't thought of that!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
my student write this code, and asking me why it is not working.
String connectionString="Data Source=asd;Persist Security Info=True;User ID=system;Password=******;Unicode=True"
SqlConnection sql = new SqlConnection(connectionString);
sql.open();
it takes me a gr8 time to explain why he cant give password value ****** in a cs codefile. he just got the connectionString from database properties and think ****** is password
|
|
|
|
|
I thought you were hiding the password, then I read your explanation...
|
|
|
|
|
Bleh. Can I nominate how the whole database connection crap works in .Net as horror? I really don't like it...
|
|
|
|
|
yeah, i know,but it was a database lab, they can choose there framework as they wish.
i don't know why people like .net + oracle ,
|
|
|
|
|
errmm....net? wats wrong with it exaclty...I mean I know that connecting to databases other than Microsoft Sequel Server is horrible but tbh I mostly use Microsoft Sequel Server and the Linq To Sql Class seems to make life incredibly easy..or has nobody noticed that new class yet? :P
|
|
|
|
|
Connecting to databases other than MSSQL is not "horrible" - generally it is identical, but with different class names: MySqlConnection, or SqlCeConnection instead of SqlConnection and so forth.
While it works well, the concept of SqlConnection and SqlCommand is visually difficult, needs to be encased in using blocks, and is prone to SQL Injection attacks if you don't do it properly.
I agree that Linq to SQL does make this process easier, but it is another thing for people to learn - and not everybody does (I am only just started on learning the details of Linq myself, and I have been using .NET for a while now).
I think what the complaint was about, was the use of Oracle as the DB when there are "better" alternatives rather than the use of SQL and .NET
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
and also setup oracle server in windows is hell of a job.
|
|
|
|
|
By not working I assume you mean not compiling? due to the missing semi-colon
Besides, I would be more concerned about the hard-coded connection string and lack of error handling
Illogical thoughts make me ill
|
|
|
|
|
no it was compiling i am the one who misplaced the semi-colon.
|
|
|
|
|
My rule of thumb is "4 method parameters are fine, 6 is questionable, 8 are a problem".
Here I present you what I have to deal with:
long BunnyInitSub( BunnyType eBunnyType,
long lBunnyIndex,
CString sBunnyLabel1,
long lBunnyColor1,
bool bBunnyAutoScale1,
bool bBunnyAutoMin1,
bool bBunnyAutoMax1,
double dBunnyMin1,
double dBunnyMax1,
bool bBunnyLogScale1,
bool bOverlap,
long lBunnyPlotFirst,
bool bEnableSecondPlot,
long lBunnyPlotSecond = EASTER_LINE,
bool bEnableSubBunny = false,
CString sBunnyLabel2 = _T(""),
long lBunnyColor2 = black,
bool bBunnyAutoScale2 = true,
bool bBunnyAutoMin2 = true,
bool bBunnyAutoMax2 = true,
double dBunnyMin2 = 0,
double dBunnyMax2 = 0,
bool bBunnyLogScale2 = false );
Thank you, Visual Assist, for coping with this horror!
(No it's not Bunny in the original code. Changed to protect the nocent.)
Yes, this is more or less two times the same information. Which are, internally, stored in a struct with similar layout as the method. Serialized raw, requiring two-way-compatibility. Which, due to some mishap with "storage size optimizations" don't even have identical alignment, so can't be replaced with two instances of half the struct. Gaaaaaaah!
|
|
|
|
|
Didn't you happen to work with Excel COM API? For example Microsoft.Office.Interop.Excel.Dialog.Show has 30 parameters. Cool, isn't it? They are optional of course, but in languages like C# before 4.0 you've got to specify them all
|
|
|
|
|
Someone there has no f***ing idea how to pass object, object reference or pointer to object as a function parameter.
There is only one Ashley Judd and Salma Hayek is her prophet!
Advertise here – minimum three posts per day are guaranteed.
|
|
|
|
|
That's what I wished for: one struct per "bunny" with good initializers, and an Init method taking one or two of them.
The guy would have done better with some guidance. It's a rarely used part of the API - I've already fixed the more common parts.
What hurts most is that even without those objects, he could have folded three of the bools into the two doubles. Twice.
|
|
|
|
|
I think you should send your rule over to Microsoft. some of their developers are still using the classic rule of...
40 method parameters are fine, 20 is questionable, 10 is a problem
Illogical thoughts make me ill
|
|
|
|
|
You never worked in the kernel then...
NTSTATUS ZwCreateFile(
__out PHANDLE FileHandle,
__in ACCESS_MASK DesiredAccess,
__in POBJECT_ATTRIBUTES ObjectAttributes,
__out PIO_STATUS_BLOCK IoStatusBlock,
__in_opt PLARGE_INTEGER AllocationSize,
__in ULONG FileAttributes,
__in ULONG ShareAccess,
__in ULONG CreateDisposition,
__in ULONG CreateOptions,
__in_opt PVOID EaBuffer,
__in ULONG EaLength
);
"It is a remarkable fact that despite the worldwide expenditure of perhaps US$50 billion since 1990, and the efforts of tens of thousands of scientists worldwide, no human climate signal has yet been detected that is distinct from natural variation."
Bob Carter, Research Professor of Geology, James Cook University, Townsville
|
|
|
|
|
Still 11 < 23
Not much worse than Win32 CreateFile. My rules of thumb would get some leeway (say a +2..+4 modifier) for a C-StyleAPI, so the scratch by.
Also, it's a rule for orientation - if one in 100 methods violates that, it's fine, if one in ten does, it's a problem.
|
|
|
|
|
Top that? Easily. Here is just one of endlessly many similar static methods in an application I just replaced (including comments and documentation):
public static int DoSomethingWithBunnies(int auswahl, string artnr, string artbez, string lnam,
string lnr, string lartnr, string wg, string mkenz, string ean,
string gab, bool ges, bool bug, bool bau, bool eks, int stanort,
string uid)
{
}
Edit: It's not the number of parameters that's the problem here. Much worse that all methods are static, usually at least 1000 lines of the worst spaghetti code long and often redundant. There are at least two more versions of this particular method here with '2' and '3' added to the name with little to no apparent differences in the copied code. All without any comments except for those I added or any documentation.
"I have what could be described as the most wide-open sense of humor on the site, and if I don't think something is funny, then it really isn't." - JSOC, 2011
----- "Friar Modest never was a prior" - Italian proverb
|
|
|
|
|
I see so much "wonderful" code over here, so I'd like to put my 5 cents as well.
Once I had the "pleasure" of working with Japanese guys (I have nothing agains Japanese, put those were especially "talented"). Can you imagine a class named "Cmoag1000Helper" containing the method "getKakko"? But they created such a masterpiece. Especially I like method name. The folks around who speak Russian already have got the point, I think. For the rest of you I'll explain. The word "kakko" sounds very close to the Russian word which, when translated to English, actually means (sorry for being rude, but it's only the truth) "turd" ("sh*t", "excrements", whatever you wish to call it, the sence is the same).
So I had to work with the class that was capable of retrieving sh*t, that was just great .
|
|
|
|
|