.NET Framework Discussion
I am creating this thread to touch on a few points about the features of the .NET Framework.
I am currently on track to Microsoft MCSD certification, but besides getting certified my major goal is understanding some of the most important features of the .NET framework. So here are some things I would like to discuss.
- If datasets are disconnected then does'nt that make it possible for another user to be modifying data that you are manipulating yourself? If so, does that create a situation where the data can be inconsistent? Maybe I really dont understand datasets that well but it seems to me that would be the case.
- I beleive that typed datasets are best suited for small and enterprise solutions. I have seen many different views on this. What are some of your ideas on this topic?
- In ASP.NET is cached information stored for a user's session or is that available to all users? If it is cached per user then why not just use session varaibles to cache information?
- I have been studying the MCAD/MCSD microsoft press self-paced training kit and nowhere in there do they explain best practices for developing applications. As far as I have seen from practice exam tests some of the questions are geared toward the best way to implement something. I have not seen any other study guides so i dont know if there are guides that explain best practices. Is there anyone else on the same path that have encountered this or is it just me? It seems that the guides just explain the basics of using the .NET framework which is consistent with the practice exams except for the questions that ask a specific way to do something where the answers are all correct and are not asking select all that apply.
- The other thing about the consistency between study guides and the actual exam is the fact that the guide shows one way of implementing something and the test ask the question relating to that particular idea that shows a different way. For instance,
The book shows:
VB Code:
dim conDB as new sqlconnection("server=myserver;Database=mydatabase;Integrated Security=SSPI")
The question may include example code like:
VB Code:
dim conDB as new sqlconnection
conDB.ConnectionString = "Datasource=myserver;Initial Catalog=mydatabase;Trusted_Connection=true"
While this is just an example, is there a best way between these two. This goes for many other programming practices as well.
In my opinion the best way would be the first, then if you need to connect to another source u can change the connection string later. This goes for other objects as well.
Please feel free to add to this discussion. This is a completely open discussion.
Thanks.
Re: .NET Framework Discussion
Quote:
Originally posted by jwmoore2001
- If datasets are disconnected then does'nt that make it possible for another user to be modifying data that you are manipulating yourself? If so, does that create a situation where the data can be inconsistent? Maybe I really dont understand datasets that well but it seems to me that would be the case.
That's what referred to as Data Concurrency and you can read more about it here:
http://msdn.microsoft.com/library/de...cyChecking.asp
Re: .NET Framework Discussion
Quote:
Originally posted by jwmoore2001
- The other thing about the consistency between study guides and the actual exam is the fact that the guide shows one way of implementing something and the test ask the question relating to that particular idea that shows a different way. For instance,
The book shows:
VB Code:
dim conDB as new sqlconnection("server=myserver;Database=mydatabase;Integrated Security=SSPI")
The question may include example code like:
VB Code:
dim conDB as new sqlconnection
conDB.ConnectionString = "Datasource=myserver;Initial Catalog=mydatabase;Trusted_Connection=true"
While this is just an example, is there a best way between these two. This goes for many other programming practices as well.
In my opinion the best way would be the first, then if you need to connect to another source u can change the connection string later. This goes for other objects as well.
As a developer, you need to understand the reason that both are correct. This comes down to understanding objects and how they are written. Passing in a connection string to the constructor only sets a internal variable equal to it. The EXACT same thing happens when you use the .ConnectionString property. There really is no difference except two lines of code compared to one.
.NET Framework discussion
Quote:
The cache is available accross session boundries. Remember, even though the Cache, Application, and Session seem to be doing the same thing, the Cache is very different from the Application and Session variables in what it can do. The Cache can expire, call a function when it expires, expire when a file changes, etc...
- "Cache is available across session boundaries" does that mean available to all users connected to the application?
- Sessions expire and sessions have the ability to call functions when they expire as well.
Quote:
As a developer, you need to understand the reason that both are correct. This comes down to understanding objects and how they are written. Passing in a connection string to the constructor only sets a internal variable equal to it. The EXACT same thing happens when you use the .ConnectionString property. There really is no difference except two lines of code compared to one.
Absolutely correct... You can either instantiate the object and passing the connection string along with the call or set the string later. But when an exam asks you which lines you would use and both are correct and the question is not a "select all that apply". What would be the one you would choose? Keep in mind that particular question has never come up for that line of code that was just an example, but it has come up for similar instances.
.NET Framework discussion
Quote:
Why? I don't understand this. Specially when it comes to ASP . NET applications the difference between them is only syntax IMHO.
What I mean is that I know the .NET Framework pretty well, and lets say I came into a job that had some stuff written in C#. Even though the difference is syntax, there is still a difference and I would still need a good refference to navigate the code. We now have C++, VB, VB.NET, and C# to worry about.
Just a thought about the purpose of C# and its role in Windows-Base and Web-Based development.
.NET Framework discussion
good point about the Java programmers. I would have to say thats a pretty well suited argument for developing a language that developers from other technologies can be familiar with. It just gets a little confusing when having to work with several languages at once, I am sure you understand that.
.NET Framework discussion
Quote:
A Cache object will expire when I tell it to. If I put something in the Cache, and set its expiration to 10 minutes, it will be gone in 10 minutes. A session can stay around indefinately as long as the user is doing something and the server doesn't restart the process.
You can also expire sessions when you tell them to, and you can expire individual objects by setting them to nothing. But you do have a good point in that Cache objects will stay even when you leave the site, and that the cache object can be reset at a specified time and continue holding until the time limit is up again at which point you can re-cache the object.
Quote:
Maybe it was the example you used, but you will NEVER see a question like that on a MS test. I just took one last monday, and no, not even close to something like that.
I do remember a practice exam question that asked the following.
You are setting up a connection to a database, what is the best method to implement that? (Worded as best I can)
1. I would set the connection in a global variable.
2. I would set the connection for every page that requires data access.
3. I would create a server componenet to connect to the database and place it on the pages that require access to the database.
I dont remember the other answers but from that right there, I would have to say that if your data application requires access to the database on every page then a global variable might work best. They do not say whether or not the application does require access on every page.
Quote:
The answer is 1, it will provide better performance. The reason is because it filters and sorts only once. Number 2 is slightly slower because you are doing one thing at a time.
I am not sure but dont both those lines of code work the same, if you instantiate an object by passing the default paramaters, the internal class will set each property and call the sort and filter procedures individually the same way it would if you where calling each individual procedure yourself.
.NET Framework discussion
Good answer.
Aside from some of the issues of the .NET Framework. I have found that working with Visual Studio .NET and the Framework has been a great experience in capabilities, functionality, error correction and debugging. There has not been a time that I could not resolve a bug, or create work around when running into problems(which is not as heavy as Win32 API). In the the Win32 API, I could spend hours trying to debug and correct errors. Great improvement.
I have a question for you, when creating objects in .NET is there a way allow only one class to call Friend or Public properties or procedures. For instance:
VB Code:
Friend Class Shape
Private intSize as integer
Friend Property Size() as integer
Get
Size = intSize
End Get
Set (ByVal Value as integer)
intSize = Value
End Set
End Property
End Class
Friend Class Circle
Dim objShape as Shape
objShape.Size = 10
End Class
Lets just say that I only want the Class Circle to be able to set that property. The reason being, if I dont want the webform class to be able to set that property. Or is the proper way just to inherit.
VB Code:
Friend MustInherit Class Shape
Friend MustInherit Property Size() as integer
' other code here
'
End Class