Results 1 to 15 of 15

Thread: Tips For Visual Basic/Programming Student

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2015
    Location
    Connecticut, USA
    Posts
    8

    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?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    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.

  3. #3
    Frenzied Member IanRyder's Avatar
    Join Date
    Jan 2013
    Location
    Healing, UK
    Posts
    1,232

    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

  4. #4
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,834

    Re: Tips For Visual Basic/Programming Student

    Always check your references

    Real Genius (1985)
    Please remember next time...elections matter!

  5. #5
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,900

    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

  6. #6
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,398

    Re: Tips For Visual Basic/Programming Student

    White Space!!!! It costs nothing and has amazing benefits.

  7. #7
    Superbly Moderated NeedSomeAnswers's Avatar
    Join Date
    Jun 2002
    Location
    Manchester uk
    Posts
    2,660

    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



  8. #8
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,900

    Re: Tips For Visual Basic/Programming Student

    Large if statements
    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

  9. #9
    Superbly Moderated NeedSomeAnswers's Avatar
    Join Date
    Jun 2002
    Location
    Manchester uk
    Posts
    2,660

    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



  10. #10
    Frenzied Member Gruff's Avatar
    Join Date
    Jan 2014
    Location
    Scappoose Oregon USA
    Posts
    1,293

    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

  11. #11
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,398

    Re: Tips For Visual Basic/Programming Student

    Quote Originally Posted by FunkyDexter View Post
    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.

  12. #12

    Thread Starter
    New Member
    Join Date
    Mar 2015
    Location
    Connecticut, USA
    Posts
    8

    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.

  13. #13
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Tips For Visual Basic/Programming Student

    Quote Originally Posted by FunkyDexter View Post
    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.

  14. #14
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,900

    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

  15. #15
    Hyperactive Member
    Join Date
    Mar 2012
    Posts
    311

    Re: Tips For Visual Basic/Programming Student

    Quote Originally Posted by IanRyder View Post
    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
  •  



Click Here to Expand Forum to Full Width