-
Apr 19th, 2015, 09:45 PM
#1
Thread Starter
New Member
Tips For Visual Basic/Programming Student
Hey everyone, I came here before for help with a problem in my Visual Basic class. Now I'm asking for any general tips or rules of thumb that could help me along on my journey to becoming a software developer. I want to know as much as possible early on, to make it a steadier road as I go. Any tips?
-
Apr 19th, 2015, 10:54 PM
#2
Re: Tips For Visual Basic/Programming Student
Always read the relevant documentation first. When I started using this forum, I answered numerous questions on subjects that I had no experience with, simply by reading the documentation the the person asking the question should already have read for themselves. You won't always find what you need in the documentation and you won't always understand what you find but the more you use it, the better you'll get at using it.
You can use the F1 key to get context-sensitive help or use the Help menu and then the Search or Index functions. If you know what type or member you want to use then you should always read the documentation for that type or member to get specific information on what it does and does not do.
-
Apr 19th, 2015, 11:02 PM
#3
Re: Tips For Visual Basic/Programming Student
Hi,
There are loads of tips regarding techniques and best practice principles that we could give you so let me start the ball rolling, jmcilhinney beat me to it, with these two:-
1) Turn Option Strict on and Never Turn it off. This will help you to identify and correct Type conversion errors as they occur in your code. Have a read of this for more information:-
Option Strict Statement
Always use Descriptive Variable Names when writing your code since it makes reading and understanding your own code a heck of a lot easier, especially when your projects begin to grow in size.
Hope that helps.
Cheers,
Ian
-
Apr 20th, 2015, 05:26 AM
#4
Re: Tips For Visual Basic/Programming Student
Always check your references
Real Genius (1985)
Please remember next time...elections matter!
-
Apr 20th, 2015, 07:43 AM
#5
Re: Tips For Visual Basic/Programming Student
Lots of small methods is better that one big method. Keeping your methods small, concise and well named makes it very easy to see what they're doing.
The best argument against democracy is a five minute conversation with the average voter - Winston Churchill
Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd
-
Apr 20th, 2015, 09:03 AM
#6
Re: Tips For Visual Basic/Programming Student
White Space!!!! It costs nothing and has amazing benefits.
-
Apr 20th, 2015, 09:11 AM
#7
Re: Tips For Visual Basic/Programming Student
Lots of small methods is better that one big method. Keeping your methods small, concise and well named makes it very easy to see what they're doing.
Yep Single Responsibility - Each method should do just one thing. Large if statements pushing your methods into dealing with multiple scenarios are hard to read, hard to debug and hard to maintain, Avoid them!!!
Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you
-
Apr 20th, 2015, 09:29 AM
#8
Re: Tips For Visual Basic/Programming Student
I have heard it argued that there should be no ifs at all outside of your factory methods and all conditionality should be handled by inheritance. I think that's probably taking things a bit far but you can see the point they were aiming at.
It does hint at another tip though: Lots of small methods in a single class is only marginally less evil than a single large method. You're better having lots of small classes.
The best argument against democracy is a five minute conversation with the average voter - Winston Churchill
Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd
-
Apr 20th, 2015, 09:49 AM
#9
Re: Tips For Visual Basic/Programming Student
I have heard it argued that there should be no ifs at all outside of your factory methods and all conditionality should be handled by inheritance. I think that's probably taking things a bit far but you can see the point they were aiming at.
Yeh well i try to avoid Ifs as much as possible apart form in the GUI, i do use them fairly liberally in the GUI code often to check for data or conditions to see if something should be allowed to run!!
Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you
-
Apr 20th, 2015, 10:00 AM
#10
Re: Tips For Visual Basic/Programming Student
Avoid literal values salted throughout your code.
Create constants where they can be easily found and changed instead.
(Usually at the top of your Form, Module, Class)
Embrace Classes.
Burn the land and boil the sea
You can't take the sky from me
~T
-
Apr 20th, 2015, 10:44 AM
#11
Re: Tips For Visual Basic/Programming Student
Originally Posted by FunkyDexter
I have heard it argued that there should be no ifs at all outside of your factory methods and all conditionality should be handled by inheritance. I think that's probably taking things a bit far but you can see the point they were aiming at.
It does hint at another tip though: Lots of small methods in a single class is only marginally less evil than a single large method. You're better having lots of small classes.
I agree. I tend to roll out a new class when ever possible.
-
Apr 20th, 2015, 11:45 AM
#12
Thread Starter
New Member
Re: Tips For Visual Basic/Programming Student
Thanks for the tips everyone. Right now in my VB class all we do with If statements is to check for certain conditions to validate what the user entered is correct.
We just learned how to create subs in VB, but haven't really touched on classes. In my Intro to Programming class last semester with Java we started to go into it the last few weeks though.
-
Apr 20th, 2015, 07:03 PM
#13
Re: Tips For Visual Basic/Programming Student
Originally Posted by FunkyDexter
I have heard it argued that there should be no ifs at all outside of your factory methods and all conditionality should be handled by inheritance. I think that's probably taking things a bit far but you can see the point they were aiming at.
That sounds like getting towards OOP in its purest form.
-
Apr 21st, 2015, 02:24 AM
#14
Re: Tips For Visual Basic/Programming Student
i do use them fairly liberally in the GUI code often to check for data or conditions to see if something should be allowed to run
Validation etc is probably the obvious exception to the rule. The rule's really meant to govern different behaviours (which should be delegated to different derived classes) whereas validation's a "check" rather than a behaviour. I'm not sure I'm describing that well but hopefully it's clear.
That sounds like getting towards OOP in its purest form
Yeah, although I think there's such a thing as too pure (e.g. Germany in 1936 ). I think it's a nice rule of thumb in that it highlights that behaviour should be controlled by inheritance but a lot of the time breaking out a whole new class for some trivial and specific edge case seems unnecessary.
We just learned how to create subs in VB, but haven't really touched on classes. In my Intro to Programming class last semester with Java we started to go into it the last few weeks though.
Your probably not at the point where good design principles (e.g. small classes, methods etc.) are really going to matter then. Still, it's worth having them at the back of your mind right from the start.
The best argument against democracy is a five minute conversation with the average voter - Winston Churchill
Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd
-
Apr 21st, 2015, 01:24 PM
#15
Hyperactive Member
Re: Tips For Visual Basic/Programming Student
Originally Posted by IanRyder
Hi,
1) Turn Option Strict on and Never Turn it off. This will help you to identify and correct Type conversion errors as they occur in your code. Have a read of this for more information:-
Option Strict Statement
Although for VB.Net I'd say this is important, this is more specific for this language, not a general programming tip. To make this more useful for other languages too, you should try to program as though this is true, even if the particular language doesn't have that exact option. In other words, try to always declare your variables using the specific datatype that is proper for the variable's function.
I'm surprised that no one has mentioned probably one of the top tips for anyone using a computer... Save early and often. However unlike reports that you may also want to save often, with programming it becomes even more important as the programs grow larger and can handle more varied conditions / inputs. With many documents saved on a computer, the most recent version is usually all you need to keep. With programming, on the other hand, you may want to go back to a much earlier version, not necessarily the latest. This is in part why many programmers use some sort of source code repository that not only keeps track of the latest version, but also may contain many other subversions so that you can look at the code from anytime during the programming cycle.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|