|
|
User Controls
|
New User
|
Login
|
Edit/View My Profile
|
|
|
|
ActiveMac
|
Articles
|
Forums
|
Links
|
News
|
News Search
|
Reviews
|
|
|
|
News Centers
|
Windows/Microsoft
|
DVD
|
ActiveHardware
|
Xbox
|
MaINTosh
|
News Search
|
|
|
|
ANet Chats
|
The Lobby
|
Special Events Room
|
Developer's Lounge
|
XBox Chat
|
|
|
|
FAQ's
|
Windows 98/98 SE
|
Windows 2000
|
Windows Me
|
Windows "Whistler" XP
|
Windows CE
|
Internet Explorer 6
|
Internet Explorer 5
|
Xbox
|
DirectX
|
DVD's
|
|
|
|
TopTechTips
|
Registry Tips
|
Windows 95/98
|
Windows 2000
|
Internet Explorer 4
|
Internet Explorer 5
|
Windows NT Tips
|
Program Tips
|
Easter Eggs
|
Hardware
|
DVD
|
|
|
|
Latest Reviews
|
Applications
|
Microsoft Windows XP Professional
|
Norton SystemWorks 2002
|
|
Hardware
|
Intel Personal Audio Player
3000
|
Microsoft Wireless IntelliMouse
Explorer
|
|
|
|
Site News/Info
|
About This Site
|
Affiliates
|
ANet Forums
|
Contact Us
|
Default Home Page
|
Link To Us
|
Links
|
Member Pages
|
Site Search
|
Awards
|
|
|
|
Credits
©1997/2004, Active Network. All
Rights Reserved.
Layout & Design by
Designer Dream. Content
written by the Active Network team. Please click
here for full terms of
use and restrictions or read our
Privacy Statement.
|
|
|
|
|
|
|
|
Time:
00:11 EST/05:11 GMT | News Source:
ActiveWin.com |
Posted By: Robert Stein |
Pet Shop 2.0 Sample Application is a blueprint for building scalable and reliable enterprise Web applications using the Microsoft .NET Framework and ASP.NET.
|
|
#1 By
1845 (12.254.162.111)
at
11/6/2002 4:28:18 AM
|
It bugs me to read code when the { is not on its own line.
private void vDoSomething()
{
//stuff
}
is my preferred style.
|
#2 By
1845 (12.254.162.111)
at
11/6/2002 8:56:47 AM
|
I must not have installed the parser for nomdlevease, because I didn't catch that at all.
|
#3 By
1845 (12.254.162.111)
at
11/6/2002 10:39:05 AM
|
This is an article about the source code to the Pet Shop app. In the Pet Shop app to reduce the number of lines of code all of the "{" of functions, classes, etc. are on the same line as the declaration rather than on their own line. My comment was rather applicable to the link. I suppose this isn't exactly an article, it's a link to the download site for the Pet Shop source code, but whatever. At any rate, a comment about the Pet Shop code is severely on topic.
I'm not saying that I don't make OT posts. This, though, wasn't one of them.
As for nom calling anyone a troll, though, that's just laughable.
|
#4 By
1845 (12.254.162.111)
at
11/6/2002 12:50:01 PM
|
Thanks for the support steven and z00k.
Ditto that about {}'s , z00k. I even include {} for one line code blocks after for, foreach, if, and else if, for readably's sake.
Some other things I noticed about Pet Shop code:
public string InStock {
get { return inStock; }
}
Most folks would write this as
public string InStock
{
get
{
return inStock;
}
}
or at the very least
public string InStock {
get{
return inStock;
}
}
I also like the use of ? : to reduce number of lines.
|
#5 By
2459 (24.233.39.98)
at
11/6/2002 2:11:32 PM
|
True, but even with the extra space from formatting the code differently, I still don't think it would add much when you consider the 2,096 LOC for .NET vs. 14,000+ for Java.
|
#6 By
1845 (12.254.162.111)
at
11/6/2002 2:31:27 PM
|
gt, I have vs set to format the way I like it, so all is correct by putting the final } on a namespace. ;-) I know they formatted the code to reduce the number of lines. I haven't checked Sun's Java source, but I'll bet they did the same thing, so I imagine it pretty well evens out. In other words, I agree with n4cer.
Drax, I'm with you on using vs. I'm a huge fan! I guess most of my gets and sets usually have more than one line, so wouldn't think to scrunch the {} around the code. Even in the few cases when I only have one line, I'd do the {} on separate lines for sake of code consistancy. To each his own, though.
|
#7 By
1845 (12.254.162.111)
at
11/6/2002 3:20:29 PM
|
Yeah! We agree that .NET is rad and on a coding style!
|
#8 By
1845 (12.254.162.111)
at
11/6/2002 4:17:21 PM
|
The only thing I don't like about .NET is the naming convention guideline. I'm a fan of prefix notation for variables and methods. I'm consistent. All my code whether in C++, VB6, VBScript, JavaScript, or C# uses it. I see no reason at all to switch code standard just because I've switched languages.
|
#9 By
20 (24.243.41.64)
at
11/6/2002 6:42:49 PM
|
Just so ya'll know:
This style:
public void foo() {
string blah = "blah";
}
is called "K & R braces" after Brian Kernighan and Dennis Ritchie, the authors and creators of C and the book "The C Programming Language".
This style:
public void foo()
{
string blah = "blah";
}
is called "Pascal braces" after the format used in the Pascal programming language.
As a side note, when I was looking the name of Brian Kernighan (I can never remember his name), I found this interview with Ken Thompson (co-creator of what would later be called Unix at Bell Labs):
http://computer.org/computer/thompson.htm
which contains the interesting quote:
Ken Thompson: I view Linux as something that's not Microsoft—a backlash against Microsoft, no more and no less. I don't think it will be very successful in the long run. I've looked at the source and there are pieces that are good and pieces that are not. A whole bunch of random people have contributed to this source, and the quality varies drastically.
My experience and some of my friends' experience is that Linux is quite unreliable. Microsoft is really unreliable but Linux is worse. In a non-PC environment, it just won't hold up. If you're using it on a single box, that's one thing. But if you want to use Linux in firewalls, gateways, embedded systems, and so on, it has a long way to go.
I wonder if he would revise his "Microsoft is really unreliable" statement today. I find many Unixy or Linuxy MS-bashers have never even used NT or 2000. They see Win9x/98/ME and, rightfully say, Windows sucks, but they don't realize they're using old software that's "legacy-ware".
Anyhow...
-d
|
#10 By
20 (24.243.41.64)
at
11/6/2002 6:49:07 PM
|
Sorry, one more quote:
"I liken starting one's computing career with Unix, say as an undergraduate, to being born in East Africa. It is intolerably hot, your body is covered with lice and flies, you are malnourished and you suffer from numerous curable diseases. But, as far as young East Africans can tell, this is simply the natural condition and they live within it. By the time they find out differently, it is too late. They already think that the writing of shell scripts is a natural act."
Ken Pier, Xerox PARC
|
#11 By
20 (24.243.41.64)
at
11/6/2002 6:52:06 PM
|
Bob: Hungarian Notation is inherently evil. It's great the first time you use, but even during refactoring, the coder himself can screw up the type such that strFoo is actually int.
Please refer to the "How to Write Unmaintainable Code" guide which has a whole section dedicated to Hungarian Notation.
http://www.mindprod.com/unmain.html
And specifically:
http://www.mindprod.com/unmainnaming.html #29 and #30
Hungarian Notation is the tactical nuclear weapon of source code obfuscation techniques; use it! Due to the sheer volume of source code contaminated by this idiom nothing can kill a maintenance engineer faster than a well planned Hungarian Notation attack.
|
#12 By
20 (24.243.41.64)
at
11/6/2002 6:55:09 PM
|
#18: Many people don't use that. Plus, that's not a "Java thing", that style goes back to C as I mentioned above.
Thank K & R for that blight on programmers around the world (well, in addition to C :) )
|
#13 By
20 (24.243.41.64)
at
11/6/2002 10:44:55 PM
|
#23: Re: IIS, MSI, Perl, etc
Well, it is an ASP.NET web app, what else do you expect it to be dependent on? It's an ASP.NET web application meant to be run in IIS, which is why it has that dependency.
If you just want to browse the source, I think there's a way to do that, otherwise I can zip it up and send the source part to you.
Re: Perl obfuscation
Oh man, have you seen any of the contests? My favorites are the ones where they make a design with the source code.
Re: Ken Thompson. Fair enough, good point. Linux is markedly better now, but still not as good as Windows ;)
|
#14 By
5444 (208.180.130.104)
at
11/6/2002 11:35:19 PM
|
Hmm,
don't want to date myself to much here.
But I learned C from the original K&R book,
Hungarian Notation wasn't even a concept from them.
(you don't see to much of it in Unix code for example)
(at least Not early Unix code, haven't played much with
current code in a long time)
Hungarian Notation was just starting to take off when I was getting ready to graduate High School in 1986 and was tied to an OS that we all know and love, DOS. Although you could find it in some other places. It carried over into the windows platforms.
El .
|
#15 By
1845 (12.254.162.111)
at
11/7/2002 2:40:49 AM
|
I've listened to the arguments and read the links, but I still disagree.
JWM
Determine the type - while it is true that with an IDE like VS.NET I can easily determine the type, I can more easily determine the type by looking at the prefix.
OO principles - for the most part, I use prefixing for value types. While it is true that value types can be boxed to become reference types (at least in .NET), I seldom have a variable that falls into this category. In other words, if my value types get boxed, it is implicit, so my prefixes are still valid. I also use prefixes for common objects including common control types. con, com, btn, chk, rd and so on. If the object isn't common, it gets a generic "o".
I can look at code I wrote years ago and know instantly what is happening, because of my convetions. They work quite well for me as they have for my co-workers.
Even if my prefixes make no sense to the reader, they make as much sense as an object name without any prefix. For instance - "command". If I looked at that, I'd have no idea that is an instance of the SqlCommand class. If someone looked at my code and saw "comInsertUser", they also might not know that it is an instance of the SqlCommand class. In either case, they might know the same amount about the variable - nothing. In my case, though, there is the potential of knowing exactly what it is at a glance without asking the IDE to clue you in.
|
|
|
|
|