Monday, February 14, 2005
« patternshare.org is online!! | Main | IE news »

There’s a thread on the CSLA .NET discussion forum about possible differences between the VB and C# versions of CSLA .NET. I started to answer the thread, then got on a roll, so it became a blog entry :-)

 

I strive to keep the two versions of CSLA .NET in sync within a reasonable time window. Everything after version 1.0 (the version in my books) is essentially my donation to the community. What I get out of it is not wealth, but rather is a lot of very interesting and useful feedback from the vibrant CSLA .NET community. I'm able to try out some of the most interesting (to me) ideas by releasing new and updated versions of the code. It is a learning opportunity.

 

The fact that I have to do every mod twice is a serious pain and does reduce the fun, but I think it is worth the pain because it makes the end result more useful for everyone.

 

I do most of my first-run coding in VB, because I prefer it. Simple personal preference. I've done some first-run coding in C# too, I just don't find it as enjoyable. Some people have the reverse experience and that's cool too. That doesn't bother me one way or the other. I fully understand feeling an affinity toward a specific language. It took me years to get over Pascal. Ahh VAX Pascal, I still harbor such fond memories.

 

But what I am more concerned about in terms of CSLA .NET is VS 2005. In .NET 2.0 we start to see some feature divergence between VB and C#. Most notably the My namespace in VB. Fortunately by playing in the middle-tier, CSLA is less subject to the differences than some code will be. However, there'll still be some differences that will make my dual life harder.

 

The biggest one that will impact me is My.Resources, which makes the use of resources somewhat simpler than C#. This isn't a huge thing, but it does mean there'll be extra code differences to reconcile between the two versions in CSLA .NET 2.0.

 

There's also My.Settings, though I don't know if that will impact me quite as much. I anticipate dropping the DB() function from BusinessBase in 2.0, since most people (rightly) avoid putting db connection strings in their config files.

 

The two primary C# features (yield and anonymous delegates) don't appear to have a home in CSLA, so I don't expect any differences from them. Not that they aren’t seriously cool features, but they just don’t have a place in CSLA .NET itself.

 

The new strongly typed TableAdapter classes are very cool. They are useful in both languages. And I hope to use strongly typed TableAdapter objects to simplify the code in the DataPortal_xyz methods.

 

There are some features that are more accessible to VB than C# in the new strongly typed DataTable (due to C#'s lack of WithEvents functionality - a major oversight imo). However, I don't expect to use any of those features in CSLA to start with, so there's no impact there.

 

When I write the book I'll create Windows and Web UI chapters. Those are what I dread most, because that's where the differences due to My become much more serious. There are numerous examples of UI development where My will be a serious code-saver - thus causing direct differences between the VB and C# code. Not that I can't do the same stuff in C#, just that it will take more and different code, which increases the effort on my part as an author.

 

Fortunately most of the book is about the framework and creating business objects, and the language divergence will have relatively minimal impact in those areas.

 

It is hard to speculate on what comes after VS 2005, but personally I expect more divergence, not less. Earlier in the thread someone noted that things like the Mac, Linux and Java still exist even though you can technically do everything they do with Windows and .NET.

 

The fact is that they all serve a purpose, as does .NET to them. People deep in C# often think different than those deep in VB. People in Java think different than those in .NET. This means they have different perspectives, different priorities, on the same problems and issues. This is only good. This means there are competing ideas that we can all evaluate and use to the best of our abilities, regardless of the language or platform we choose to use.

 

Loving distributed computing as I do, I am constantly taking ideas from the C++ and Java worlds. I closely watch the SOA world, even though I think it is misguided in many ways, because there are interesting ideas and perspectives there that can apply to distributed object-oriented systems as well.

 

I’ve said it before and I’ll say it again, if you only know one programming language family (such as the C family or the Basic family) then you really, really need to get out more. Your horizons and thus your career are simply too limited and you can’t be considered credible in most of these discussions.

 

That’s an interesting meme. Which programming languages have you been competent in during your career? I’ll start (in rough order of usage):

 

1.      Apple BASIC

2.      VAX Pascal

3.      Turbo Pascal

4.      DCL

5.      FORTRAN 90

6.      VAX Basic

7.      ARexx

8.      Modula-II

9.      Visual Basic (1-6)

10.  Visual Basic .NET

11.  C#

 

While I did write a VT terminal emulator in C once, I don’t think I was ever really competent in C, so I’m not counting that. My memories of that experience are not inspirational in the slightest… I’ve also dabbled in various Unix shell languages and bat files, but was never competent in them.

 

Converting the list to language families is harder, because things like ARexx aren’t obvious, but here’s my attempt:

 

1.      Pascal (Pascals and Modula-II)

2.      Basic (various)

3.      FORTRAN

4.      Scripting (ARexx, DCL)

5.      C (C# and C if you are generous)

 

So, having wandered from the topic of CSLA .NET parity between VB and C# we arrive at what could be a cool meme. Go ahead, comment or blog – what languages and language families have you been competent in during your career?

Monday, February 14, 2005 6:50:22 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [18]  |  Tracked by:
"Programming Experience in a Nutshell" (Geoff Appleby) [Trackback]
"Language Learning Tree" (Eric Kepes) [Trackback]
"My Programming Experience" (Thomas Williams) [Trackback]
"Language history" (Panopticon Central) [Trackback]
"Language history" (Panopticon Central) [Trackback]


Monday, February 14, 2005 8:09:19 PM (Central Standard Time, UTC-06:00)
Q-BASIC
Turbo Pascal
C
Clipper 87-5.0
FoxPro 2.0-2.6
Visual FoxPro 3.0-8.0
JavaScript
Visual Basic 6
C# - my first .NET language
Visual Basic.NET - my favorite .NET language ;-)

Oh and if you want to count them, PL-SQL and T-SQL.
Monday, February 14, 2005 8:27:22 PM (Central Standard Time, UTC-06:00)
I started out with C in University and than

Natural/Adabase
Clipper
Visual-Objects
C#
VB .Net - my current.

I prefer the syntax of C# but the company I work for now uses VB .Net. I do like some VB .Net stuff better however. I'm glad to learn it and think it will only make me a better developer.
Jamie
Monday, February 14, 2005 8:30:25 PM (Central Standard Time, UTC-06:00)
As the author of the evil post, I was biting my nails as I read the reply just waiting to get slapped in the face for being biased to one language!!

One quick note just to clear up my name, for me, programming is another tool to help me with my job. I own a business and have many other responsibilities and duties besides programming for my own business. I work from the minute I wake up to the minute I go to sleep. Most times this includes weekends. People like me must focus on something that can do the job and then rely on people like you that have the smarts and all kind of resources to come up with great solutions like the CSLA. It is not that we don’t like learning other languages, or that we are lazy, its just that we don’t have time!!

Now for my programming abilities: I programmed VB for one or two years without having a clue of what Object Oriented programming was until I stumbled upon your book!! I feel embarrassed of myself when I open up my first VB program (created many years ago) and see that I used hidden text boxes to save field level values!!! Man I can’t believe I am confessing to that!!

I have programmed for the Palm OS in C using Code Warrior, which was an interesting experience. During my C programming life, I read quite a bit of the “Beginning Visual C++ 6” book from Ivor Horton to help me complement my VB programming but never did an actual C++ solution.

I am now a C# programmer wanabe and enjoying the ride every step of the way!
Rene
Tuesday, February 15, 2005 4:24:03 AM (Central Standard Time, UTC-06:00)
Hey Rocky,

Both Vb.NET and C# have strongly typed resources. In C#, the namespace is the root applciation namespace + Properties (or Configuration depending on which CTP you are using ;) )

So in C#, you can add something like:

using My = WindowsApplication1.Properties

and then you have My.Resources the same as in VB :)


For me, I find the biggest pain on strongly typed resources is that C# has great intellisense for them, whereas Vb.NET does not. If you hover over code that uses a resource in C#, the tooltip tells you the default value in that resource string, Vb.NET just tells you it's a string. See:
http://msmvps.com/bill/archive/2005/02/08/35289.aspx
for exmaple screen shot diferences




Tuesday, February 15, 2005 8:30:44 AM (Central Standard Time, UTC-06:00)
Having just started programming I have but two languages
VB.Net
C#
- I think Python or Ruby may be next
dru
Tuesday, February 15, 2005 8:47:24 AM (Central Standard Time, UTC-06:00)
Rocky,

'I anticipate dropping the DB() function from BusinessBase in 2.0, since most people (rightly) avoid putting db connection strings in their config files.'

Where would most people put their db connection strings, if not in their config files?

Karl.
Karl Holbrook
Tuesday, February 15, 2005 2:29:02 PM (Central Standard Time, UTC-06:00)
Of course, some of us think the DB() function should have never been in BusinessBase in the first place but rather in a proper DAL, but maybe that's another story.

Karl, the idea is that it shouldn't be in something so readily visible and useable by prying eyes. Most people like to encrypt it in some way for example. Microsoft's configuration application block offers some help with that sort of thing.
Daniel Billingsley (DansDreams)
Wednesday, February 16, 2005 2:01:58 AM (Central Standard Time, UTC-06:00)
Daniel, I have always used a connection string in a config file or further back in a udl file and relied on Windows security to secure this. This has always been on a server based app though. Your 'prying eyes' presumably are users? And you are of thinking of a 2 tier scenario where the client goes straight to the database? Would merely encrypting the connection string in the config files not be enough or is there a way to stop the user getting at it entirely?
Martin Kullich
Wednesday, February 16, 2005 8:34:29 AM (Central Standard Time, UTC-06:00)
I first began programming Basic on my step-father's TRS-80 ("trash" 80 to some) and saved my programs on a tape recorder back in 1982. I got my first computer, which was a Timex Sinclair running on a ZX-80 chip and had a whopping 2k of RAM. I quickly outgrew this oversized calculator and bought an Atari 400 with 16k and later a floppy disk drive. Both of these early PCs had BASIC as a language, although Atari made you purchase theirs on a cartridge. I got my first taste of other languages in highschool in 1985 where we dialed into the University of Texas's mainframe and programmed in FORTRAN on a teletype using the cradle modems of yore. Later we evolved into a PC based FORTRAN compiler that used one program to precompile and a second to link.

In 1987 I got my first Turbo Pascal jolt and, like Rocky, fell in love with the elegant syntax and logical top down design that it provided. During my brief matriculation at UT in Austin I was assaulted with Pascal, Modula II, C and Assembly (thankfully the Assembly was on the Motorolla 68000 chip series and thus had a flat memory model).

I had an epiphany shortly after failing out of EE316 (Design of Electrical Circuits and Logic) and switched to CIS and learned COBOL very well. Right out of college (a loooooong tour of duty) I had to program in COBOL-92 and SAS on a VMS system. That was so arcane and terrible. I was overjoyed when Access 1.0 came out which was the first program I wrote Windows programs on. Later, around 1994, FoxPro was bought by Microsoft and I discovered you could write complete applications on that platform as well. With the advent of VB3, the barriers were finally down to Windows programming for the non-C programmer. Although I did teach myself C++ on the sidelines, I never really used it in the business world...just game programming when I got bit by the DirectX bug in 1996.

It's been VB for a long time after that until like everyone else, I devolved into VBScript when ASP hit the scene in 1997. So, it was back to BASIC style spaghetti programming until 2001 when I landed my first C# job. I taught myself VB.NET first, and really liked it, but every trade journal and online post advised me to also learn C# and play up to that side because of perception. I have always thought that Microsoft should have named VB.NET something cool like Plato or Java and thus remove the stigmatism that the professional community has about using this excellent language.

Anyhoo, that leads me to where we all are currently...trying to make sense out of the alphabet soup that surrounds us in our professional lives. I recently changed jobs to a more CSLA type of shop and have brought my BRB (big red books) to work to try to teach the others here about the benefits of OOP using Rocky's methodology which I've used to great success in several consulting gigs. I'm glad I found this website and it's firmly placed in my .NET favorites.
bret williams
Wednesday, February 16, 2005 6:14:48 PM (Central Standard Time, UTC-06:00)
Turbo Pascal
C
Fortran
Assembly 80x86
Access
VB
Javascript
VBScript, ASP
C# (my favorite)
VB.Net

and a few others such as basic, lisp and foxpro which I won't qualify myself as competent.
Ricky Supit
Friday, February 25, 2005 6:25:57 AM (Central Standard Time, UTC-06:00)
My progression has been:

Modula-II
Cobol
Pascal
C
C++
VB 3-6
VB.NET
C#

I cannot understand why the C# development environment cannot be as helpful as the VB environment. I have to use the Object Borwser all the time in C# where as in VB those dropdown overrides/events save so much time. Also, I have always has a problem with the case sensitivity of C/C++ and now C# - it just doesn't make sense at all in these days of developing understandable, maintainable code!

Tuesday, March 01, 2005 10:10:09 AM (Central Standard Time, UTC-06:00)
John,

>Also, I have always has a problem with the case sensitivity of C/C++ and now C# - it just doesn't make sense at all in these days of developing understandable, maintainable code!<

Some of us actually prefer the case sensitivity. Makes properties cleaner avoiding the leading *_* that most VBers use and makes the code easier to read if you follow some guidlines. Just my opinion, but I think you will find most programmers with a C background prefer case sensitivity.
Jamie macleod
Tuesday, March 01, 2005 2:02:33 PM (Central Standard Time, UTC-06:00)
I'm a young pup I guess..

I started out in the early days with BASIC on the C64
The graduated to BASIC and BAT in MS-DOS when my parents bought our first "IBM-Compatible"

Started doing VB3 and went to school.

Got a job doing VB3-6 with Foxpro and Access, then later MS SQL Server

Moved "on" and learned ASP (shudder)

started doing VB.NET and now my current employer requires C#

I have to say I really like the IDE with VB a lot better but C# has grown on me.

I have to agree that asside from the seeming lack of IDE friendliness the case-sensitivity is the feature I most dislike.

There are several things I like about the C# IDE features:
1) when you declare a field as a type and then type 'x = new ' you are presented with the typename you defined, as opposed to having to find it again in the vb intellesense
2) to address the earlier statement about overrides. in C# if you just type 'override ' you get a list of all the available overrides and chosing one will create the definition for you with the call to the base.
3) creating a file in a subdirectory appends the directories name in a namespace statement (I mean, how hard would that have been for the VB guys)

I've done VB.NET as my primary language for about a year and have been in C# for the last 7 months and find that it is all .NET, there is nothing I have had to do for work yet that I couldn't do in either and very little that I find that much harder (as in way too much more code, or too complicated) in one vs. the other. Best part is that now I qualify for twice as many jobs! :-)

--sorry if this posts twice. my first one never showed up.
Thursday, March 02, 2006 12:00:47 PM (Central Standard Time, UTC-06:00)
please send me c# coding of different statement thank you
amin
Tuesday, March 14, 2006 7:19:47 PM (Central Standard Time, UTC-06:00)
when will the vb .net 2.0 compiler support the code snippet below? c# 2.0 understands it. :(

Imports System.Collections.Generic

Class App

Public Delegate Function GetEnumerable(Of T)() As IEnumerable(Of T)

Function Test() As Object()
Return New Object() {}
End Function

Sub Main()
Dim h As GetEnumerable(Of Object)

h = New GetEnumerable(Of Object)(AddressOf Test)
End Sub

End Class
leandro karunungan
Tuesday, April 11, 2006 2:15:08 PM (Central Standard Time, UTC-06:00)
> when will the vb .net 2.0 compiler support the code snippet below? c# 2.0 understands it. :(

VB9 will support it.
Jonathan Allen
Tuesday, April 11, 2006 2:24:26 PM (Central Standard Time, UTC-06:00)
> 1) when you declare a field as a type and then type 'x = new ' you are presented with the typename you defined, as opposed to having to find it again in the vb intellesense

In VB, you don't normally write the type name twice.

VB
Dim x as New C()

C#, VB the hard way
C x = new C()
Dim x as C = New C()


> 2) to address the earlier statement about overrides. in C# if you just type 'override ' you get a list of all the available overrides and chosing one will create the definition for you with the call to the base.

VB has this currently.

> 3) creating a file in a subdirectory appends the directories name in a namespace statement (I mean, how hard would that have been for the VB guys)

Yea, that would be nice. I am very unhappy about Visual Studio's namespace support in VB.
Jonathan Allen
Friday, April 14, 2006 7:51:21 AM (Central Standard Time, UTC-06:00)
sorry guys, but VB always was and always will be a language of housewives and mr Bill Gates.
the syntax is so primitive that ut's only good for office macro programming. Usually newbies who start with VB do not have any idea what programming is - do not know wnything about theory of algorythms, compilers theory or binary math.

i don't understand how people coming from C/C++ background can even look at VB as something serious.

VB was never a language of system programming as C which for me is the symplified assembler and the most favourite language.

so my opinion is that Assembler/C/C++ are the only existing great programming languages/compilers.

and C# (which i find very nice), Java, VB (pure joke) - are just handy tools for creating buisness apps.


cheers guys!
Ruben
Comments are closed.