tags:

views:

532

answers:

9

I recently started playing with C#, but I am finding it very frustrating. It seems every time I want to add what I think is a simple control, I end up either scouring the internet or writing my own. I just feel like I spend more time recreating controls to get them to work the way they should, and less time actually creating applications.

For example: In another question, I asked if it was possible to remove the border on a combobox; something I thought should be built into the control, but alas I had to build my own control for this simple alteration.

Am I just too new to C#/.net, or am I just expecting too much? I know SO loves C# so don't bite my head off for feeling this way, just help me understand what I am missing and whether I should continue learning and working with C#.

+4  A: 

With any new technology there is a substantial learning curve at first, and some have a higher learning curve then others. I think you will see as you gain more experience that these things become substantially easier. C# has a lot of power with the .Net architecture to leverage from, but a lot of it takes time to really appreciate. C# is also changing and growing to allow for new coding styles (newer versions incorporate a lot of influences from functional programming) that keep it both in vogue and powerful. Stick with it and keep learning.

Corey Sunwold
+12  A: 

I spent 4+ hours today tracking down an 8 byte memory leak in a C++ program. There are threads involved and attaching the debugger would alter the thread timing so I couldn't do even something as simple as breaking on the Nth alloc to see where the leak was. Additionally I knew generally in between which two events the memory was allocated. Unfortunately both threads thought that was a great time to allocate lots and lots of 8 byte size objects. At the end of the investigation I found a ref count error on a COM pointer was leading to the leak.

Not having to pull your hair out over investigations like this is why you should move to C#.

JaredPar
A: 

Depends on where you are coming from. I find c# to be very effective.

I rarely if ever use other controls as they often do not work 100% to my use cases and they create dependencies on your app.

So when you want to upgrade your project to c# 4 and can't because control X Y and Z don't work in c# 4 ... your SOL.

So I just take the hit up front and write my own controls which causes less grief later.

Chad Grant
+6  A: 

For example. In another question I asked if it was possible to remove the border on a combobox; something I thought should be built into the control, but alas I had to build my own control for this simple alteration.

Of course you can't remove the border on combo boxes. They are Win32 controls and they have to play by the rules of Win32. That inlcudes giving the OS and the user, not the application control over styling.

If you want something you can style completely on Windows then you need to look at WPF.

Jonathan Allen
Um, you can remove the border on Win32 combo boxes...
Shog9
+1  A: 

Could it be that what you're trying to do is not, let's say, common? Most GUI developers follow some sort of human interface guidelines so that their application fits in well with the window manager of the OS being used. It helps with the user experience. Most GUI elements are designed with this in mind. So, it could be that you're trying to make your interface radically different than most, and thus, are finding that you have to do some custom work. That would be normal.

NobodyReally
Why does everybody think removing the border on a control is so strange, I put the border back when the mouse is over it or it gains focus. It just happens that it looks bad on this form when there is a box around it.
Tester101
I wasn't trying to imply that it was strange, just that it may not be common so there isn't built in support for it.
NobodyReally
I can understand if I have to build a custom control, I have no problem with that. I just don't like rebuilding things that already exist.
Tester101
If it's hard, you're likely doing someting wrong.
Dan
+2  A: 

Yes. You are missing something -- experience with the tools you are using.

For example, a few months ago I decided that my next project would be in ASP.NET MVC. I had been doing WebForms for several years and had dabbled with RubyOnRails for a couple of personal apps. MVC fit in with my desire to increase the testability of my apps and I prefer writing my own HTML for the most part anyway.

Despite my experience with ASP.NET, C#, and experience with MVC in RoR, it still took my awhile to match the velocity I had with WebForms. I felt like I had to spend all my time looking for how to do stuff. Now, a few months later I feel like I'm able to develop just as quickly as before. More to the point, I know the various paradigms and can apply them easily when faced with a similar problem to one I've solved before. I'm also building up a collection of extensions, snippets, and components that can be reused over and over.

I suggest that you give C#/.NET a chance for long enough to get over the inevitable early struggle and then decide whether it's the technology that's the problem.

tvanfosson
That is exactly what I am experiencing with ASP.net MVC, but for me I'm still in the 'don't know how to do that yet in MVC' phase.
metanaito
+3  A: 

It sounds like you are just new to it. It's not C# that's the problem it's the .net framework. If you used VB.net for example you'd likely have the same issue.

I went through this issue when I went from classic ASP to ASP.net. For half a year or so I felt the things I wanted to do in ASP.net were so much easier in classic ASP. Eventually that went away. Now I'm going through it again as I try to learn ASP.net MVC. Things I could do in 5 minutes in ASP.net are taking me days to figure out in ASP.net MVC.

In your case it sounds like you are using windows forms. Were you working with winforms before (i.e. VB6)? If you want more control over styling you might want to look at WPF.

metanaito
+6  A: 

I think what you really mean is:

Windows Forms on .NET is increasing my development time - am I missing something?

I think you are missing several things:

  • Open mindedness - with any new programming language comes not only new syntax, but new paradigms. If you come from C++ paradigms such as garbage collection may sound "too automatic" from you and you'd like to have more control but alas, you have to let go. Whenever you jump from one paradigm to another the prerequisite is always the ability to unlearn what you've always known.
  • Windows controls aren't the same as web controls - I've checked your previous questions and they look like you've been from VBScript, which probably means that you use it either from Office or ASP Classic. That being said your demand for controls that were easy to conjure when you were in the web would be much tougher for Windows -- Windows was not designed to be easily modifiable. That's why WPF/Silverlight was made.
  • Productivity is a function of ability to learn - There, I said it. It might hurt but, if you have cynicism or hostility blocking your learning process, you will simply not become productive soon. If you've been used to not having to learn new things, you will also not become productive soon. If you think you're really good at learning new things you will find ways to become productive in that language -- and then we can discuss about merits of your arguments vis-a-vis development time.
Jon Limjap
You are right my problem does seem to be with .net. As for your second point, I don't do web development I use VBScript for application testing so I don't deal with controls. I am doing well with learning C# the language I get, just the lack of design in the controls frustrates me. But again I guess thats a problem with .net, and I shouldn't take it out on C#.
Tester101
+3  A: 

You're not the first, nor the last developer to have this sentiment. It always seemed to me that every time I needed to do something that wasn't part of a demo, I had to spend hours trying to figure out how to accomplish one small task. Much of my frustration was with ASP.NET web controls.

That being said, I found that once I got over the (steep IMHO) learning curve of control development, many of my frustrations were eliminated. I feel that using inheritance and overriding virtual members to create new behavior is a very clean approach. Plus, it creates output that can be very easily reused. Using OO practices just always seemed better to me than pasting JavaScript snippets all over the place.

Microsoft does a good job of providing many base controls to use out of the box, but every application always seems to need something that's missing. I would recommend learning control development, or looking to third party solutions if possible. There are many companies that exist solely to fill the voids. Either way, I wouldn't judge the whole language based off of the default control set.

Aaron Daniels