By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,953 Members | 1,143 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,953 IT Pros & Developers. It's quick & easy.

OOP vb.net

P: n/a

--
hello

I have been having a look at the OOP of VB.net and experimenting. I here a
lot of VB.net is a complete new language etc......much harder to understand.

I think I have the major concepts of a windows app but let me know if I am
totally missing the idea of VB.net

I know Java,C so it VB.net didnt seem too foreign

OOP concepts new (or better developed than VB6) in VB.net are inheritance,
encapsulation, polymorphism, constructs, as well as properties
(readonly..),methods. The Implementation classes,objects are similar to VB6
but you have more functionality and flexibility on what you can do in VB.net.

Many Keywords used in VB.net require you to use the relevant import before
they can be used.....like Java because of .Net set up

Can build libraries, controls
You can also use references,controls like vb6

I am missing something. They need to make your program OOP is up to you, but
I like classes which is not new to vb.net. I like OOP and used it in VB6.

Have I got the main idea of vb.net.... (I like it but I see a lot of work
is needed to fully use all the language because it seems so big...but vb6 is
big to)

Making your program OOP is a matter of design and we all have different
views on what is good OOP. This is a side issue to VB.net however I do notice
a lot of sloppy OOP code being implemented (eg functions that returns value
as well as other changesto the data) in VB.net books for the sake of trying
to be more OOP but I will argue that another day.

I think the best way for me to know VB.net is try not to be so complicated
with the language and dont overdo OOP concepts for the sake of it


Nov 21 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
I have done a few posts here lately and I promise I will cut back!

"john andrew" wrote:

--
hello

I have been having a look at the OOP of VB.net and experimenting. I here a
lot of VB.net is a complete new language etc......much harder to understand.

I think I have the major concepts of a windows app but let me know if I am
totally missing the idea of VB.net

I know Java,C so it VB.net didnt seem too foreign

OOP concepts new (or better developed than VB6) in VB.net are inheritance,
encapsulation, polymorphism, constructs, as well as properties
(readonly..),methods. The Implementation classes,objects are similar to VB6
but you have more functionality and flexibility on what you can do in VB.net.

Many Keywords used in VB.net require you to use the relevant import before
they can be used.....like Java because of .Net set up

Can build libraries, controls
You can also use references,controls like vb6

I am missing something. They need to make your program OOP is up to you, but
I like classes which is not new to vb.net. I like OOP and used it in VB6.

Have I got the main idea of vb.net.... (I like it but I see a lot of work
is needed to fully use all the language because it seems so big...but vb6 is
big to)

Making your program OOP is a matter of design and we all have different
views on what is good OOP. This is a side issue to VB.net however I do notice
a lot of sloppy OOP code being implemented (eg functions that returns value
as well as other changesto the data) in VB.net books for the sake of trying
to be more OOP but I will argue that another day.

I think the best way for me to know VB.net is try not to be so complicated
with the language and dont overdo OOP concepts for the sake of it

Nov 21 '05 #2

P: n/a
John,

Just start and try to do some things in an other way as you probably was
used too.

And as most simple thing to start, "Try to avoid global variables"

Therefore not
\\\
Private i as integer
Private myfield() as string
Private mytempfield as string
Private sub mysub()
for i = 0 to 9
mytempfield = "A" & CStr(i)
redim preserve myfield(i)
myfield(i) = mytempfield
next
end sub
///
However something as
\\\
Private function mysub() as arraylist
dim myarrlist as new arraylist
for i = 0 to 9
dim sb as new text.stringbuilder
sb.add("A")
sb.add(i.tostring)
myarrlist.add(sb.tostring)
next
return myarrlist
///
The stringbuilder part is not often done in this way; however, it is for
this sample. It is by the way as it is showed in this way the most
efficient. While as it was "A" & "B" would be slower, that has to do with
constants. However, forget that for now.

What happens is that there is all the time an "sb" object new created from
the class stringbuilder and that its reference is freed every time in the
loop. Add the end of the function the arraylist stays on the managed heap,
which is the place for all objects, because there is a reference too it,
while all the stringbuilders will be deleted by the Garbage collector (GC)
from the managed heap because they have no references anymore and are not
referenced as well.

You think maybe coming from classic programming that this is inefficient,
yes exactly in OOP programming is a little bit inefficiency, however you get
it back by better too maintenance programs and easier reuse of code.

Starting it in this way, wills in my opinion lead you in a while to the
point that you start building your own classes, using inheriting,
overloading and/or whatever.

I hope that this gives some ideas?

Cor

Nov 21 '05 #3

P: n/a
"john andrew" <jo********@discussions.microsoft.com> schrieb:
I have been having a look at the OOP of VB.net and experimenting. I here a
lot of VB.net is a complete new language etc......much harder to
understand.
The language itself is not much harder to understand. It's OOP that people
have to learn. If you are good in Java programming and know OO concepts,
switching to VB.NET is easy.
OOP concepts new (or better developed than VB6) in VB.net are inheritance,
encapsulation, polymorphism, constructs, as well as properties
(readonly..),methods.
Readonly properties were also available in VB6, in a much more convenient
way (different levels of accessibility for the 'Get' and 'Let' part of the
property).
Many Keywords used in VB.net require you to use the relevant import before
they can be used.....like Java because of .Net set up
Many classes require importing the namespace they are part of. Keywords
don't need 'Imports'.
I am missing something. They need to make your program OOP is up to you,
but
I like classes which is not new to vb.net. I like OOP and used it in VB6.
Yes, it's (and that's an advantage of VB over C#) still up to you to write
an OO program or a simple procedural program. Nevertheless, OO features of
VB.NET are much more powerful than they were in VB Classic. Parameterized
constructors, type safety, overloading, built-in implelementation
inheritance, ...
Making your program OOP is a matter of design and we all have different
views on what is good OOP. This is a side issue to VB.net however I do
notice
a lot of sloppy OOP code being implemented (eg functions that returns
value
Why do you think that a function that returns a value is bad OOP code?!
I think the best way for me to know VB.net is try not to be so complicated
with the language and dont overdo OOP concepts for the sake of it


That's true, OOP is not always the best solution. OO currently is a "hype".

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #4

P: n/a

"john andrew" <jo********@discussions.microsoft.com> wrote
Can build libraries, controls
You can also use references,controls like vb6

I am missing something.


In addition to the standard Windows applications, you get a much farther
reach in .Net:

Console applications
Mobile (Pocket PC type) applications
ASP (Web) applications
Web Services
And you can even include user scripting in your applications.
(all using the SAME VB.Net syntax, of course!)

In a nutshell, we used VB syntax to learn the VB language.
In .Net we use VB-like syntax to interact with the FCL.
(Framework Class Library). All languages use the same
set of classes from the FCL. (Largely equalizing performance
issues) While VB would compile to P-code or Native code,
..Net languages compile to MSIL (Intermediate Language).
(Another equalizing factor) Anyone can look at the IL using
ILDASM.EXE. (Oh well!)

While VB used COM and the Registry to share components,
..Net uses meta-data in each assembly to find and load any other
needed files (with support for sharing common files and for COM
when needed....) VB was reference counted, and dependant on
proper tear down, .Net uses a garbage collector to free memory.

At a more basic level, VB was from the desktop era, while
the .Net platform is targeted more toward network applications.
You can use the same IDE and language to write both the client
and server side code....

HTH
LFS

Nov 21 '05 #5

P: n/a
Herfried,
Making your program OOP is a matter of design and we all have different
views on what is good OOP. This is a side issue to VB.net however I do
notice
a lot of sloppy OOP code being implemented (eg functions that returns
value
Why do you think that a function that returns a value is bad OOP code?!


You need to look at his entire statement:
... (eg functions that returns value as well as other changesto the data) ...


The "as well as other changes to the data" is known as a side effect. I hope
you agree that Side effects can be bad. Which is why I say that Functions
should not have ByRef parameters...

Hope this helps
Jay
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... "john andrew" <jo********@discussions.microsoft.com> schrieb:
I have been having a look at the OOP of VB.net and experimenting. I here
a
lot of VB.net is a complete new language etc......much harder to
understand.


The language itself is not much harder to understand. It's OOP that
people have to learn. If you are good in Java programming and know OO
concepts, switching to VB.NET is easy.
OOP concepts new (or better developed than VB6) in VB.net are
inheritance,
encapsulation, polymorphism, constructs, as well as properties
(readonly..),methods.


Readonly properties were also available in VB6, in a much more convenient
way (different levels of accessibility for the 'Get' and 'Let' part of the
property).
Many Keywords used in VB.net require you to use the relevant import
before
they can be used.....like Java because of .Net set up


Many classes require importing the namespace they are part of. Keywords
don't need 'Imports'.
I am missing something. They need to make your program OOP is up to you,
but
I like classes which is not new to vb.net. I like OOP and used it in VB6.


Yes, it's (and that's an advantage of VB over C#) still up to you to write
an OO program or a simple procedural program. Nevertheless, OO features
of VB.NET are much more powerful than they were in VB Classic.
Parameterized constructors, type safety, overloading, built-in
implelementation inheritance, ...
Making your program OOP is a matter of design and we all have different
views on what is good OOP. This is a side issue to VB.net however I do
notice
a lot of sloppy OOP code being implemented (eg functions that returns
value


Why do you think that a function that returns a value is bad OOP code?!
I think the best way for me to know VB.net is try not to be so
complicated
with the language and dont overdo OOP concepts for the sake of it


That's true, OOP is not always the best solution. OO currently is a
"hype".

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #6

P: n/a
Jay,

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> schrieb:
You need to look at his entire statement:
... (eg functions that returns value as well as other changesto the data) ...


The "as well as other changes to the data" is known as a side effect. I
hope you agree that Side effects can be bad. Which is why I say that
Functions should not have ByRef parameters...


OK, I misread the text :-). I thought that the OP wanted to give two
samples of bad practices that were not related to each other. Thank you for
making me aware that I was wrong.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #7

P: n/a
Herfried,
OK, I misread the text :-). I thought that the OP wanted to give two
samples of bad practices that were not related to each other. I hope he doesn't!
Thank you for making me aware that I was wrong. I would not say you were wrong as much as we took two different
interpretations of his statement...

Jay

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl... Jay,

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> schrieb:
You need to look at his entire statement:
... (eg functions that returns value

as well as other changesto the data) ...


The "as well as other changes to the data" is known as a side effect. I
hope you agree that Side effects can be bad. Which is why I say that
Functions should not have ByRef parameters...


OK, I misread the text :-). I thought that the OP wanted to give two
samples of bad practices that were not related to each other. Thank you
for making me aware that I was wrong.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.