Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What should a mid-level C# developer know? 4

Status
Not open for further replies.

imterpsfan3

Programmer
Jul 22, 2005
160
US
I'm not sure if this is posting to the right forum. I recently went for an interview for a mid-level C# developer. They asked me stuff about reflection, can you inherit from a string, if a string had 1GB of data in it, should it be passed by value or reference, how is a string an immutable object, etc etc.

Are these ridiculous questions or what?

I can't think of a situation where you would have a GB of data in a string or would want to. You could know the answers to all those questions and still be a rotten programmer.

Or perhaps I should know all these things. Just looking for some feedback.

Microsoft Certified Solutions Developer -- Visual Basic 6
Microsoft Certified Applications Developer C# (in the works)
 
You're right about experience beating studying most of the time. However I am one of those who needs to study a lot to make up for the fact that I am not a genius like Linus Torvalds or Sergei Brin.

I am able to write database applications in C# right now using class modules, etc. However I feel there is so much I don't know, it's both challenging and humbling. Some of the higher concepts like delegation, inheritance, interfaces and abstract classes still baffle me. I know what they mean but putting them into practice in a real application is the only way I will learn.

I am in the midst of migrating Access/Visual Basic applications to .NET. I'm basically doing a rewrite of existing applications to the .NET environment, using MSDE as the backend and Crystal Reports for the reporting.

Some of the questions I have are 1) is it better to use the unbound form model? 2) use primarly data readers over datasets? 3) if you use datasets, should you use typed datasets?

From now on I will do no more development using Visual Basic or Access. This will force me to do it with C#.

 
1) yep
2) uhm, use datareaders to populate the datatables if you can. Make one class that does this and let the others inherit from it. If you look at the last tip I wrote in the vb.net forum you will see that even a dataadapter can be forced to use a datareader to populate a datatable. BTW use datatables over datasets (smaller footprint). And datasets when you want to have datarelations.

3) yep. But not if they are made by a wizard. So avoid the datawizard.

Christiaan Baes
Belgium

I just like this --> [Wiggle] [Wiggle]
 
If I'm using a datareader to populate form controls, why would I need a datatable? I could then just use a command object to update, insert, delete records. You can't update a database via datatable from my understanding. Just curious.

Can you show me an example of populating a datatable from a datareader? I'll go look at your example but I would like one in C#. From my understanding you can also return an array from a datareader in the same fashion as GetRows in ADO.

What I do in my class module is create the datareader and then pass this datareader to the client, which then populates form controls.

And let's say I have a form with a few hierarchies of data (form-subform-subform), do I still use datareaders or a dataset?

With ADO your choices were much simpler, you would create a disconnected recordset and pass it to the client and then populate form controls. You'd use a command object with a stored proc to update,delete, or insert.

It gets a little tricky for me to decide what is really most efficient in regards to ADO.NET because you have a lot more options and it doesn't seem cut and dry on when to use which.



 
Since dataeraders need for the connection to be open and you can have only one per connection I would advise to close the connection as soon as possible and put everything in a datatable or any other collection and pass that around.

datareader to datatable.


Code:
using System; 
using System.Data; 
using System.Data.Common ; 

namespace DataUtils 
{ 
public class DataReaderAdapter : DbDataAdapter 
{ 
public int FillFromReader(DataTable dataTable, IDataReader dataReader) 
{ 
return this.Fill(dataTable, dataReader); 
} 

protected override RowUpdatedEventArgs CreateRowUpdatedEvent( 
DataRow dataRow, 
IDbCommand command, 
StatementType statementType, 
DataTableMapping tableMapping 
){return null;} 

protected override RowUpdatingEventArgs CreateRowUpdatingEvent( 
DataRow dataRow, 
IDbCommand command, 
StatementType statementType, 
DataTableMapping tableMapping 
){return null;} 

protected override void OnRowUpdated( 
RowUpdatedEventArgs value 
){} 
protected override void OnRowUpdating( 
RowUpdatingEventArgs value 
){} 
} 
}

Try reading up on The MVC (Model-View-Controller) pattern.

Christiaan Baes
Belgium

I just like this --> [Wiggle] [Wiggle]
 
I had a similar experience to imterpsfan3. I programmed in C# for over a year and went looking for a new job.

I went on one interview where I was asked rapid fire definitions of terms and I was unable to properly define some terms, though I can do the work.

I ultimately got a job somewhere else after an interview where they asked me questions that involved how I solve various problems and to explain previous applications that I had written. Those explanations proved my worth to them.

I'm going to check out that C# and the .NET Platform book by Andrew Troelsen and see if I can get boned up a little more on my OOP terms and be able to explain them better to others.

I hate looking like a fool, though I do it so well :)

----------------------------------------

TWljcm8kb2Z0J3MgIzEgRmFuIQ==
 
Hi, just thought I would add a few lines to this topical subject but before I do I will add this link that explains reflection.
You should be warned that reflection is an advanced programming methodology and to be honest you may never use it, or you may use it and not be aware that you have.

Anyway… I firstly will say that in my humble opinion you should continue looking for a job. We can all tell that you have the correct aptitude for programming (basically you enjoy its challenges). I reiterate Do NOT be putt of and of course continue learning.

Give yourself a break - to learn OOP takes time, as it is a new way of thinking that cannot be used in apps written in VB. This guys interview techniques were very poor, as you should never leave an interview feeling that you have not done well (even if you haven’t). You should feel that you have learnt something and perhaps made a new friend.

Finally as was mentioned earlier they do need us so take it on the chin and carry on, look forward to good money and lots of respect :) good luck!


Age is a consequence of experience
 
So you really think it makes a difference whether you are passing dataset or a datatable between tiers?

One thing I have been learning as far as OOP is how to pass data between tiers. The book presented several different ways to do this and the strengths and weaknesses of each.

1) setting property values inidividually on the client - this was demonstrated as very poor performance because each time you are accessing a property you are going across boundaries.

2) passing parameters to a method - this was faster than (1) but was demonstrated as also poor performance.

The suggestion was to instead "serialize" the data, or group it into some large chunk, in order to pass it from middle tier and back in one piece, or one call.

The example, this was a VB book, but could be presented in a .NET context as well, was to pass a disconnected recordset by value. Sometimes I've passed an array between tiers. For .NET you'd translate that to a dataset, datareader or datatable object. I've experimented with passing a dataset or a datareader between tiers.

Am I on the right track here?

If I have let's say 10 fields on a form that I am going to populate with data from a database, how do you approach it?
There seems to be a plethora of ways to do it, from using property get/set accessors in class modules, to using collections, to passing ADO.NET objects.

Chrissie, I will look at your code more intently. Is that something similar to the Data Access Layer classes?

Thanks again...

 
Just my own commentary on this :)

If the interviewer in question was defining what topics (according to him) need to be known in order to be considered a middle level programmer, then I fail. The reflection question would have stumped me simply because I would not have been able to define it. In fact I have never used reflection in .Net (not purposely) though I have used it in other languages.

This actually reminds me a bit of an ASP interview I did over the phone once. The first question was to list the core objects available in ASP. I also did not recall the correct syntax for a few sub-functions off the top of my head. I didn't receive a callback and in fact the call wrapped up with them telling me they wer looking for a more advanced ASP programmer. Which was fine for me because I had never even requested an interview, I was just playing along :p

Basically an example of how not to interview in my book. I may not have known the definition of reflection as a word or have had an occasion to use it in .Net, but give me an hour or less and I could implement something using it. I work weekly with anywhere from 2 to 6 languages. I learned about XmlSerialization and implemented some fairly complex objects in an hour or so.
This interview is basically telling me that I need to go find another career besides programming.

I'm a rookie but learning...

Perhaps others will disagree, but I would rather hire someone in the process of learning than someone who has a .Net book memorized. It is more important to me that a programmer be able to continue learning and apply both problem solving and common concepts than it is to have a memorized version of the framework. I am still learning and I will never be done. Even a simple language like VBScript still has the occasional surprise for me.

barcode_1.gif
 
The problem I find is that the examples I often see in books are overly simplistic and not indicative of a real world application.

Oftentimes you have to several combo boxes, and perhaps a hierarchy of forms and subforms that need to be synchronized together.

Maybe there is a .NET book out there that takes you through a real world application from begin to end, but I haven't seen it yet. Most of the examples are in isolation so you have to piece it together yourself.

 
If you take one problem (say creating an ecommerse website)and analise it completely you would get more of a real world solution. It's a different way to learn .Net because it assumes you know .Net somewhat and are trying to solve a problem with it.

This book does a full Website in C#

I found this to be a good book, however I learned several other archetechures including CSLA and 2 other home grown solutions, so now I don't like the one presented in this book. Still a good read though.

Take a real world problem and try and figure it out. That's the fun of programming. Tek=Tips and Google Groups can help you fill in the more complex peices.

You should also look for user groups. In the DC area here are some. They may have a group local to you. Also a good way to find a job.
 
STSUING, Those two guys on the cover of the one book didn't look too happy to be there. I guess WROX didn't pay them much...

I am actually in the DC area and I work right now as a govt sub in Alexandria VA. I think there was an ASP.NET group in Rockville but it seemed to be very advanced.

 
The rockville one meets in NOVA sometimes. Even if you don't understand much you will be exposed and therefore will get something out of it. They also serve as a networking events. There are also code camps. Eveyone started where you are so don't be afraid try different things to learn.
 
I'm 41 and other peers have been telling me to get out of the programming field and into management. They think I have a few screws loose in my head because I still want to be a programmer instead of a project manager, etc.

To be a programmer anyway, you HAVE to have a few screws loose in your head.

Maybe it's true that the programming is for the young. I haven't gotten this programming bug out of my system yet and one of these days I'll get the .NET stuff under my belt.

I have a few projects I can work on. They are intermediate difficulty projects that I know I can handle.

The real problem with programming as opposed to other genres in the computer field is that what you knew three years ago will become irrelevant today. 3 years from now .NET will be superceded by Longhorn SDK. Being great in Visual Basic does you very little good in .NET.

 
The real problem with programming as opposed to other genres in the computer field is that what you knew three years ago will become irrelevant today.
I vehemently disagree. Design Patterns was written in 1995 and is book that should be on your shelf. Code is code. The words change the IDE's change but it is still code. My first programming job was building CICS apps using COBOL and VSAM. Today I build apps using .NET and Oracle. A couple of years ago it was Java. What I have seen change is the work ethic. I see it in the posts where a Google would have given the poster the answer. When I started there was no TT and when BB’s started and you where lucky enough to have web access at your site you got flamed with RTFM if you posted something that should and can be looked up. I see it in the new hires when they tell me they have a computer information degree. I ask what is that, and am told it is like a computer science but you do not have to take the math courses. Discrete Mathematics and Linear Logic should be a requisite for this trade.
Many enter the field for money and not for the love of it. Instead of rolling their own they look for a point and click solution (wizards). I can see it in the debugging skills or lack there of since they point and clicked an application and do not know what is really behind it.
I do commend you not taking the job.
Marty
 
I also disagree with imterpsfan3, things are more similar than they are different. I have a few books that mention studies done with programmers in the 1960's, yet still hold true today.

I have used about a dozen languages in my proffessional career, yet in all of them I trace my core knowledge back to the data structures I learned in college.
 
Well, thanks for your posts. Maybe I am in the wrong field. I once fancied myself a great programmer, but I think it's time to find something else in the information technology arena.

If it's taking me this much trouble to learn another programming language, then something is awry. I'm a notoriously slow learner.

I think in order to be a good programmer, you basically have to give your life to this stuff, and I am not really sure if I am interested in that investment.

I've found the database stuff to be leaps and bounds easier than programming. As an ASP.NET programmer you have to know so many different technologies. You have to be a master of ASP.NET, C#, Javascript, XML, HTML, object oriented design, visual modeling tools, GUI Design, data validation, data access technologies, etc, etc, etc as well as databases. I'll never master these things in this lifetime. Plus you have to account for every possible situation that could happen in an application and then about a 1000 others you couldn't think of.

From now on I'll leave the programming for the geniuses...adios everyone and good luck.


 
imterpsfan3,

Just read your post, sorry to hear about your interview but to be honest, that guy was some egomaniac who only employs code machines.

Trust me, from experience I know what its like to be shot down in an interview, especially when you know the interview is full of .....

I was a programmer in another lifetime, but like you I am a slow learner in that I like to take my time and as my manager would say, "you ask too many questions". When I start to look at something I have to know why something works a certain way, not just because I read a statement in a book and unfortunately this meant I was not able to produce my best work under preassure.

I left the coding world and to be honest, I have never looked back. I moved into IT Support and really enjoyed it as this kind of work allows you to amass a great deal of knowledge and also develop your analytical and problem solving skills in the process.

I moved into System Administration which really helped me learn and it was during this time I started coding in Borland Delphi. I coded small apps to help me with my sys admin work and occasionally worked on something more large scale but I have always remained a hobbyist coder and I think thats the best way to be.

I have no preassure to code something that 'might have bugs' - I can take my time and develop a solution that works for a given task like auditing over a hundred servers and I will use anything that works from VBScript to C# as long as it gets the job done properly.

I don't consider myself a programmer as I don't fully understand all of the terminology that surrounds stuff like OOP and modern coding standards however through my work I have become accustomed to the lingo and I am aware of what OOP stands for and why it works.

I think you went into that interview part believing you had the skills and part thinking you needed confirmation of your knowledge but I know from experience there is no substitute for real knowledge gained by being exposed to your peers and the technology around you.

In our department I have seen a large growth of contract coders brought in to work on a large scale project and the majority of them are very skilled at coding however the have ZERO business acumen and a very limited understanding of a real world IT infrastructure. Its all well and done producing a gee-wizz bit of code but if impacts on another system to me, its complete useless and I will flat out tell the coders to take their code and stick it somewhere ;)

I guess I am trying to say that you can be a good coder without having to work as a programmer; I have been exposed to some brilliant coding from guys in my team yet they are not coders but the developed a solution based on their experience of working in an it infrastructure (I am talking 10+ years of sys admin/dba knowledge).

For me coming back to coding after all these years is a real boon as I now have a different perspective of my work (thanks to some years working as a business integration analyst). I take a high level view of not just the problem but systems and people that are affected by this problem, and eventually my design.

I code for fun now, if it helps me in my primary work as a sys admin then great, otherwise I spend my spare time to learn when I can as I know eventually it will help me at some point.

Its very difficult to commit to becoming a coder, initially it is a solitary life. I am married now, have a 3 year old son and another baby on the way, a nice big house and a nice car, including my other social commitments (I am an amateur mixed martial arts fighter and body building enthusiast) I barely have time to code much and I have asked myself that question; whether I can really be bothered.

Life is too short

Thats all you need to say to idiots like the fella interviewing you
smiletiniest.gif


Fz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top