Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: how do I practice programming logic for a beginner?

  1. #1
    Join Date
    Dec 2010
    Beans
    129
    Distro
    Ubuntu 14.04 Trusty Tahr

    how do I practice programming logic for a beginner?

    Hi, I started doing java programming 6 months ago, but I managed to learn more basics for the last two months dur to huge interest in coding. Also I started reading info on oracle's tutorials and I managed to complete exercises provided by the website.... but I was put off slightly when I tried to make a class whose instances represented a deck of cards. When I couldn't manage, I looked at correct answers. I was a bit horrified with sophisticated, but even simple coding from the answer and I felt so stupid because of that. I did have a look for ways to improve, but they were a bit over the top for me, coz it involved learning anpther language or improving code than logic. So I was wondering how you guys manage to build your logic for programming? Thank u for taking to read my post!
    "If you are in hell, keep going." Winston Churchil
    ubuntucrazygeek.blogspot.com
    http://motivatedsuccess.tumblr.com/
    http://pavelexpertov.tumblr.com/

  2. #2
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,469
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: how do I practice programming logic for a beginner?

    practice makes the master
    in the beginning the brain gets overloaded and overwhelmed easily and there is no way around that. Just step back a bit in complexity, write few more programs to get more confident and try that deck of cards again. Even if you still won't write it on your own, it's very possible that someone else's code will be undestandable enough to be enlightening and open a new path in your thinking.
    When you think about your program try to break it to manageable blocks and tackle them one at a time.
    if your question is answered, mark the thread as [SOLVED]. Thx.
    To post code or command output, use [code] tags.
    Check your bash script here // BashFAQ // BashPitfalls

  3. #3
    Join Date
    Mar 2010
    Location
    Metro-ATL; PM free zone.
    Beans
    Hidden!
    Distro
    Lubuntu 14.04 Trusty Tahr

    Re: how do I practice programming logic for a beginner?

    The best way to learn is to follow others and emulate them. Follow can happen in many different ways:
    * schooling/classes
    * reviewing other peoples' code
    * reading books from the "experts"
    * reading magazines specific to your area of coding and/or langauge
    * joining local groups of like-minded people and having frank discussions
    * working in the field - i.e. practice.

    The more you learn, the more you will appreciate that some people are coding-poets.
    There is nothing like practice to make you better at anything. Back when I was coding A LOT, anything that I'd written 2 months ago was crap, I knew it, but if you looked at the stuff I'd done today - it was beautiful, elegant, efficient, easy to understand even by the most dullard person. Of course, in 2 months it would seem like crap to me ...

    Anyway, don't be afraid to post your crap code and get feedback. I was lucky. At my first professional job, we were required to have formal design, code and test reviews with 3 other peers. These included written issues submitted before the meeting with a signature from each reviewer to ensure they did actually review it and were confident they didn't miss anything. This is strange for most environments - where the only review is "does it work" and does QA see anything wrong. Team programming was supposed to make code better, and I suppose it does.

    Also, review coding standards documents for each language. Inside those you will find smart ways to make your code defensive and fail as close to where the issue is as possible, instead of letting the code continue, for hours- days - months before that error is experienced.

    Didn't reread this post - hope it makes sense. Practice. Practice. Practice. Just like musicians.

  4. #4
    Join Date
    Dec 2010
    Beans
    129
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: how do I practice programming logic for a beginner?

    Thanx guys, just a minute ago I stepped back just to think over what I am doing with the task of creating a deck of cards. I think I am getting a bit of it done, but I think it's not gonna work due to the goal of the task :/

  5. #5
    Join Date
    Mar 2010
    Location
    Metro-ATL; PM free zone.
    Beans
    Hidden!
    Distro
    Lubuntu 14.04 Trusty Tahr

    Re: how do I practice programming logic for a beginner?

    Quote Originally Posted by pavelexpertov View Post
    Thanx guys, just a minute ago I stepped back just to think over what I am doing with the task of creating a deck of cards. I think I am getting a bit of it done, but I think it's not gonna work due to the goal of the task :/
    That is a common thing. You are learning 2 things right? Programming and OOD? I was lucky - back when I was learning, very few people had even heard of OOD at all, so everyone used function and structures to code. I'd programmed 8+ yrs before touching anything OOD. When OOD came along, there were lots of classes that were not language specific .... I don’t think I could have learned that on my own from books. The concept was too foreign to me. Any class can teach it - doesn't need to be a name-brand college class - took mine at a local community college. Since then, I like to say, if you want to become a priest, you need to go to a monastery. I think the same applies to learning OOD - BTW, that is Object Oriented Design. I still have the OOD Booch book here and refer to the diagrams for UML on the inside font and back covers.

    I'd also say that I've never, ever, attempted to make a class hierarchy for a deck of cards. My 1st questions would be
    * is a single card the base-class or is the deck a base-class?
    If I were trying to do this, I'd look online for other class diagrams to see a few different options and look for wholes in each design.

    My OOD classes were taught near a NASA flight center, so our beginning design and programming exercises where about satellites and space ships moving around a planet that needed to be "captured." Teach to your audience, right?

  6. #6
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,469
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: how do I practice programming logic for a beginner?

    yes, java is indeed rather rigid because it forces you to do everything with objects. Maybe you could try let's say python which is not as rigid, doesn't require as much boilerplate code and has tons of nifty syntactic shortcuts.
    if your question is answered, mark the thread as [SOLVED]. Thx.
    To post code or command output, use [code] tags.
    Check your bash script here // BashFAQ // BashPitfalls

  7. #7
    Join Date
    Dec 2010
    Beans
    129
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: how do I practice programming logic for a beginner?

    Quote Originally Posted by TheFu View Post
    That is a common thing. You are learning 2 things right? Programming and OOD? I was lucky - back when I was learning, very few people had even heard of OOD at all, so everyone used function and structures to code. I'd programmed 8+ yrs before touching anything OOD. When OOD came along, there were lots of classes that were not language specific .... I don’t think I could have learned that on my own from books. The concept was too foreign to me. Any class can teach it - doesn't need to be a name-brand college class - took mine at a local community college. Since then, I like to say, if you want to become a priest, you need to go to a monastery. I think the same applies to learning OOD - BTW, that is Object Oriented Design. I still have the OOD Booch book here and refer to the diagrams for UML on the inside font and back covers.

    I'd also say that I've never, ever, attempted to make a class hierarchy for a deck of cards. My 1st questions would be
    * is a single card the base-class or is the deck a base-class?
    If I were trying to do this, I'd look online for other class diagrams to see a few different options and look for wholes in each design.

    My OOD classes were taught near a NASA flight center, so our beginning design and programming exercises where about satellites and space ships moving around a planet that needed to be "captured." Teach to your audience, right?
    when you do OOD, do you make a first plan by making flow charts and then writing draft classes to see if they follow planned functions?
    "If you are in hell, keep going." Winston Churchil
    ubuntucrazygeek.blogspot.com
    http://motivatedsuccess.tumblr.com/
    http://pavelexpertov.tumblr.com/

  8. #8
    Join Date
    Dec 2010
    Beans
    129
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: how do I practice programming logic for a beginner?

    Quote Originally Posted by Vaphell View Post
    yes, java is indeed rather rigid because it forces you to do everything with objects. Maybe you could try let's say python which is not as rigid, doesn't require as much boilerplate code and has tons of nifty syntactic shortcuts.
    I honestly wish I could have started with python, but I want to learn java so I can learn programming in android. This is because I feel I want to become mobile independent app developer and I have lots of free time due to my age and few responsibilities. Furthermore, I am getting UDOO, so I might get a chance to play with python or C++ .
    "If you are in hell, keep going." Winston Churchil
    ubuntucrazygeek.blogspot.com
    http://motivatedsuccess.tumblr.com/
    http://pavelexpertov.tumblr.com/

  9. #9
    Join Date
    Mar 2010
    Location
    Metro-ATL; PM free zone.
    Beans
    Hidden!
    Distro
    Lubuntu 14.04 Trusty Tahr

    Re: how do I practice programming logic for a beginner?

    Quote Originally Posted by pavelexpertov View Post
    when you do OOD, do you make a first plan by making flow charts and then writing draft classes to see if they follow planned functions?
    Flow charting is not for OOD, it is for procedural programming. When just starting out, that isn't often clear.

    Not flow charts, but class diagrams and scenarios/use cases. Flowcharts come much later - actually, I usually just use code comments to cover the major parts of any method/function. That doesn't always work out, since big ideas usually take more code than a method or function can hold, so I have to add a few helper_methods inside the class.

    When I actually write class methods, I force them to be 20 lines or less - small, easily testable, and easily understood. If a method/function doesn't fit onto a single screen, it is too long. This, more than any other tip, has made me a better programmer. Also, method naming is an art form. I try to always name the method such that the returned data answers a question. IsFaceCard() would be an example.

  10. #10
    Join Date
    Mar 2010
    Location
    Metro-ATL; PM free zone.
    Beans
    Hidden!
    Distro
    Lubuntu 14.04 Trusty Tahr

    Re: how do I practice programming logic for a beginner?

    Quote Originally Posted by pavelexpertov View Post
    I honestly wish I could have started with python, but I want to learn java so I can learn programming in android. This is because I feel I want to become mobile independent app developer and I have lots of free time due to my age and few responsibilities. Furthermore, I am getting UDOO, so I might get a chance to play with python or C++ .
    Programming based on your "itch" is a great idea. I wish you luck for starting with Java and Android. It is a fairly advanced topic. Android programming is unlike any other coding that I've done, with all sorts of odd ways (non-standard for any of the other 15 platforms I've coded on) the environment forces things to be handled. I can't imagine trying to learn to program in Java AND Android at the same time.

    When asked "how to learn to code" the last 2 yrs, I tell people to start with Python - though I don't know that language. I'm from a different generation. Python forces good coding style and has everything that a new programmer needs to learn ... except the compiling aspects of non-scripted languages. http://blog.jdpfu.com/2011/10/19/how...arn-to-program explains and a few highly experienced Java programmers left their comments.

    OTOH, Java has been taught in schools for 10 yrs as the beginning programming language. I'm from a pre-Java time - before the language existed.

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •