1. Hi there, Guest

    Only registered users can really experience what DLP has to offer. Many forums are only accessible if you have an account. Why don't you register?
    Dismiss Notice

Beginning in Programming

Discussion in 'Tech Support' started by Agent One, May 20, 2018.

  1. Oz

    Oz For Zombie. Moderator DLP Supporter

    Joined:
    Jan 31, 2008
    Messages:
    8,831
    Gender:
    Female
    Location:
    Baile Átha Cliath
    It took me months for programming to "click" so don't feel down if you don't grok something the first, second or hundredth time. It really does come down to practice just like learning an actual language.
     
  2. Fudoutoku

    Fudoutoku Third Year DLP Supporter

    Joined:
    Mar 6, 2011
    Messages:
    95
    Kinda forgot about this thread.

    BUT, I found exactly what I was looking for: https://coderbyte.com/

    Has a bunch of coding challenges for some of the more popular languages, but it's def missing a lot of em..

    Anyway, it's helped a bunch.
     
  3. Nazgus

    Nazgus Minister of Magic

    Joined:
    Mar 16, 2011
    Messages:
    1,288
    Location:
    USA
    I've used a similar site in the past, not sure why I didn't think of it before... https://exercism.io/

    Looks like they've made a big update to it recently so idk what's up with that, but it has a good selection of languages and a large number of exercises per.

    On a separate note, anyone know a nice way to alias a class name in Java? I'm writing a board game solver and would like to change out which game it will solve by just changing the game class around in a single line, but am having no luck so far.
     
  4. cucio

    cucio Second Year

    Joined:
    Aug 13, 2016
    Messages:
    63
    High Score:
    0
  5. Nazgus

    Nazgus Minister of Magic

    Joined:
    Mar 16, 2011
    Messages:
    1,288
    Location:
    USA
    Thanks for those! Knew there had to be a way, just been too long since I wrote any Java... Will check out tomorrow. Just currently finished implementing my second game and my God it was a pain. Really happy with the end result though, so was worth. Need sleep...

    EDIT: Yeap, that worked perfectly. Thanks a lot @cucio !
     
    Last edited: Sep 12, 2018
  6. Fudoutoku

    Fudoutoku Third Year DLP Supporter

    Joined:
    Mar 6, 2011
    Messages:
    95
    Incoming shill post:

    If you sign up for Visual Studio's benefits you can get 3 free months of either Linkedin Premium or a month of free Pluralsight - both of those sites have a shitload of courses on not just programming or programming languages but pretty much all the popular architectures out there.

    https://my.visualstudio.com/benefits

    Personally I've been using the linkedin one since the pluralsight one doesn't give you access to the "premium" feature of challenges and interactive courses but linkedin does.

    Be aware that you're probably signing up to get your organs harvested by Bill Gates as his start failing.

    I think KhanAcademy might have something similar for free as well, but I just stumbled across the visual studio benefits thing and decided to see what was in pluralsight and was blown away by the quality of their shit.

    Just wanted to drop this in here coz learning from books didn't help me diddly squat but these courses have been a huge for me.
     
  7. Jarizok

    Jarizok Professor

    Joined:
    Sep 22, 2015
    Messages:
    414
    Gender:
    Male
    Location:
    Netherlands
    I got accepted into a 5-month IT traineeship yesterday. I know absolutely nothing about programming right now, so it'll be interesting to come back here in July and share my experiences I think.

    The traineeship is college level, but only open to people who already have a bachelor degree or higher. I'll supposedly be at the same level as the graduates of the regular 3-year major. Looking forward to it!
     
  8. Chime

    Chime Dark Lord

    Joined:
    Aug 22, 2007
    Messages:
    1,957
    Books ain't gonna help you learn to program (if you're like me, anyway). You've just got to pick a project and run with it. I started with games and I think they're the best starting point, because games tax all your knowledge (OS, networking, I/O, graphics, OOP, Functional, and more)

    I highly recommend just doing a text adventure game. If you're interested in getting a job in web development (which is probably the most common IT job), start learning what a JSON object is. Design a couple JSON objects:

    Code:
    {
      id:150,
      name: "Guy",
      level: 1,
      health: 100.0,
      mana: 0.0,
      attributes: {
        str: 1,
        int: 1,
        agi: 1
      }
    }
    Code:
    {
      Rooms: [{
      id: 1,
      name: "Room 1",
      desc: "A dirty dirt floor expands around you...",
      objects: [150],
      exits: [2,3]
    },{
      id: 2,
      name: "Room 2",
      desc: "A dirty wood floor expands around you...",
      objects: [],
      exits: [1]
    },{
      id: 3,
      name: "Room 3",
      desc: "A dirty marble floor expands around you...",
      objects: [],
      exits: [1]
    }]
    }
    Learn how to parse JSON strings into in-memory objects in your language of choice (JavaScript and C# are probably the easiest languages to do this in, Python being a close second. Java's not so great at this for newbies, but it's okay too. C++/C are obviously good if you want to go hardcore. Pick your poison) and manipulate them to learn how object-references are managed in your language of choice.

    Then, learn I/O for letting players input stuff.
    Then, learn database/file mgmt for persisting game state as a 'save'. A simple NoSQL DB is great for storing JSON objects, though might be a bit much for a beginner. A simple file system works too.
    Then, you probably want to learn about different data structures, like how you can organize your room objects to make them traversable by an AI.
    And basically, if you write it correctly, you can persist your text world on a server and let two web clients interact with it at once, since it's just JSON being passed around.

    A simple exercise like this will teach you just about everything you'll ever need to know.

    When you're starting to program for the first time, it's easy to make one giant function which "does everything". It takes a long time to understand how to structure your code so you can actually progress and make something truly complex and functional on a deep level. The easiest way to start learning how to accomplish this is to "write as little code in a function as possible". Obviously not the easiest thing to execute in practice, especially as a newbie, but it's just a heuristic.

    Code:
    main() {
      run();
    }
    
    run() {
      savedData = loadSave();
      state = new GameSession(savedData);
      StartGame(state);
    }
    
    loadSave() {
      ...
    }
    
    StartGame(state) {
      while (running) {
        input = allowInput();
       processInput(input, state);
      }
    }
    
    
    Obviously some very over-simplified pseudocode, but even so, try to have your functions do as little as possible. This lets your human-compiler-brain understand the context of what's going on. If you have to sit there and compile the code in your brain to parse what the code is doing, you're on the wrong track. Unless you're writing specialized performant routines for cryptography or graphics cards, anyway.

    Also, if you learn the Dependency Injection pattern well, early -- you will save yourself much, much pain.
     
    Last edited: Jan 24, 2019
  9. Sir Snuffy

    Sir Snuffy Third Year DLP Supporter

    Joined:
    May 3, 2016
    Messages:
    100
    Gender:
    Male
    Location:
    The country the Queen lives in
    High Score:
    0
    Languages like C++ are not very beginner friendly but there is merit in learning them first. Once you start off with Object-Oriented languages others come easy as they can be very similar.

    I started off with C# - after that, learning new languages like Java and C was pretty easy.
     
  10. Chime

    Chime Dark Lord

    Joined:
    Aug 22, 2007
    Messages:
    1,957
    I don't recommend starting with C++. If you want to learn OOP, learn C# or Java or Python or something like Ruby (Ruby's more for functional paradigms though at this point). If you want to learn low level code, start with assembly or C. C++ is an abominable hybrid of "modern OOP" and "oldschool". In the right hands, C++ is all powerful, in the wrong hands, you learn bad habits, bad patterns, bad practices, and write bad code. You also will have a big learning curve for C++, as you'll get a mix of everything all at once and have trouble sorting it out.

    Don't believe me? Well, here, I'll show you a fun "pattern" you can "learn" from coding in C++ too long:

    Code:
    do {
      ....
    } while(false);
    
    (Do yourself a favor and don't do the research to find out why anybody would do this)

    C is a "simple" language that is a little quirky, but is essentially "pretty assembly code". Which is why it's so great to start with, plus it should expose you to linux/unix, which is essential, too. C++ is a language that needs things like boost or the "standard libraries" (which are not beginner friendly at all imo) to be "clean" ... Then again, there are some decent C++ courses on pluralsight, that even talk about best C++ practices, so if you start with those, you'll at least have that. Though, I still wouldn't recommend C++ to anybody. Anything you can do in C++, you can theoretically accomplish in C anyway, you just may have a few hurdles to overcome.

    Oh, and C++ is just right awful for string manipulation, especially on Windows. Newbies love to manipulate strings for simple projects, so that's also why I don't recommend it. (If you do C++, you've got to know what a c_str() vs char[] vs wchar vs tchar vs lpstr and a lpcstr and a lpctstr yes it keeps going, then throw in ansi vs unicode, then depending on what libraries you mix and match, you may have to convert a c_str() into a tchar[] back into a lpctstr which is about as much fun as tearing your fingernails off oh no my computer is beeping at me when I write output to console halp where did I go wrong???).
     
    Last edited: Jan 26, 2019
  11. Sir Snuffy

    Sir Snuffy Third Year DLP Supporter

    Joined:
    May 3, 2016
    Messages:
    100
    Gender:
    Male
    Location:
    The country the Queen lives in
    High Score:
    0
    With this I agree - I should have just stuck with C# or Java in my previous post rather than C++ haha.

    If you want to try a more complex language then C# and Java are a very good starting point, although I personally prefer C# as it's essentially a superior Java clone.
     
  12. Chime

    Chime Dark Lord

    Joined:
    Aug 22, 2007
    Messages:
    1,957
    Let's not get into language wars. I think Java has been left to languish by its owner, so I agree it's a little behind other 'modern' languages today. Doesn't help they don't really 'hard' deprecate much. Code written in Java 1.0 still probably works today. Which is kind of gross. Java is valuable to learn though, because of the future of things like Scala or Kotlin.

    The main issue with language wars I find is ... when you start to hunt for jobs, you don't get to pick the language you want sometimes. You should be open to learning most languages. Of course, I refuse to touch COBOL - you've got to have some standards on how dirty you'll get your hands, but you can't be too picky. At one of my previous jobs, I had to be able to handle a lot of legacy Java and VB. Of course, I could rewrite certain code in whatever language I wanted, but I still needed to be proficient in other stuff.

    All languages are roughly the same thing anyway, some are just harder for organizing certain concepts.
     
  13. Horton

    Horton First Year

    Joined:
    Feb 26, 2012
    Messages:
    41
    Location:
    UK
    If it's useful, this is a search engine that's designed for code : http://symbolhound.com/

    As the fact you can't put special characters into Google while searching is rather...annoying?
     
  14. GordonQuick

    GordonQuick Muggle

    Joined:
    Oct 23, 2018
    Messages:
    1
    To the competent programmer, the language is just a way to express your ideas. Some languages are better for expressing certain ideas, and other are better for expressing other ideas.

    The same result can be achieved by a plethora of ways. If you want to learn object oriented programming, go with a language that can suitably express those concepts. Examples would be Java, C++, C#, ... and so on.

    Try not to learn a language - try to learn how to program instead. I have seen people pick up a new language and write amazing programs with it in a day. That's what being a good programmer is about.

    If you are just starting out, the correct choice of language is "any". It will be of help if there exists a large community with good learning resources, though.
     
  15. Nazgus

    Nazgus Minister of Magic

    Joined:
    Mar 16, 2011
    Messages:
    1,288
    Location:
    USA
    I'm gonna firmly disagree with you there. While after you've been programming for a while you should be able to pick up new languages as needed, there's definitely languages that are 100% more beginner friendly than others. Which ones and how much you can debate back and forth, but for someone just starting out, Python is going to be a lot easier to get started with than C (to give an example).
     
  16. Palindrome

    Palindrome A bigger, darker mark Moderator DLP Supporter

    Joined:
    Apr 9, 2009
    Messages:
    2,525
    Gender:
    Female
    Location:
    England
    When I first learned programming formally, my teachers had the exact opposite sentiment to you: start 'em on the tricky stuff to make sure they actually properly understand the basics and from there on everything else will be easy to learn. Did it work? Well, sorta.

    We started in C, and most of the class got to grips with it pretty quickly. It's a massive pain for beginners trying to understand the error messages the compilers spit out when you forget semicolons and such, so you'd see people who were just endlessly confused. That's the biggest hurdle, ultimately, for basically everything programming related - in order to be successful, you need to be the sort of person who can jump over the hurdles of frustration and not be too daunted by the unknown. There's inevitably an endless string of problems with nearly everything you do, and only about a quarter of people who try learning to program seem to be cut out for sticking with it until they're solved. So in a way, maybe starting with a harder language really is just a good way to show a beginner whether they'd actually enjoy working in the field. There's nothing sadder than seeing a programmer who absolutely hates problem-solving.

    But they were right, starting with learning C helps you learn other languages without getting things muddled up. Once you get the concepts of pointers and why they exist a lot of the mysticism behind computers starts to fall away, so when you're picking up new languages you can neatly slot in all their new concepts and structures and probably guess at how they're implemented.

    Ultimately though, I don't think it makes a huge difference to a beginner what they learn. They'll still get the core concepts of logic and structure down either way. Anything else is just salad dressing. So I think the answer to whether you should start beginners on 'beginner friendly' languages comes down to what your goal is: are you trying to turn away as few people as possible? Or to teach core concepts as thoroughly as possible?

    (I'm probably biased though because I'm a C programmer primarily, and hey it's not that bad! :p)
     
  17. cucio

    cucio Second Year

    Joined:
    Aug 13, 2016
    Messages:
    63
    High Score:
    0
    Manual memory management was unavoidable a couple of decades ago.

    These days, with CPUs well in the GHz range, RAM in the GB and very well designed garbage collectors, it is only relevant for applications like embedded platforms and real-time programming.

    MMM is a tall hurdle to jump for any newcomer, relatively difficult to conceptualize and rather error-prone for the unexperienced developer. Compounded with concurrent programming, it can easily become a nightmare, even with the help of clever tricks like smart pointers.

    So I don't think C/C++ is that good idea for a beginner, it makes the learning curve steeper and many programmers will go through their entire careers without ever having to allocate a pointer. It is a definite must for certain fields, though.

    Next choice would be between a strongly typed language or one who isn't. Strong typing makes the code a bit more verbose, but shifts a good number of runtime errors to build time, and it creates good habits.

    Java and Python are popular choices among teachers, and there are good reasons for that.

    For children and casual beginners, VPLs like Scratch or App Inventor are a good introduction to core programming concepts.
     
  18. Jarizok

    Jarizok Professor

    Joined:
    Sep 22, 2015
    Messages:
    414
    Gender:
    Male
    Location:
    Netherlands
    Day 2 of Software Engineering bootcamp. So far we’ve covered the basic datatypes and how to use them, as well as some method construction and how to use some if statements and while loops.

    I’m currently struggling a lil bit with having a prompt for valid user input appear upon invalid input while also keeping the rest of my loop running smoothly, but I’m having a ton of fun!

    There’ll be two more days of basic (java) programming before we switch over to databases for 7 days, and mySQL after that.

    Funfunfun!
     
  19. Palindrome

    Palindrome A bigger, darker mark Moderator DLP Supporter

    Joined:
    Apr 9, 2009
    Messages:
    2,525
    Gender:
    Female
    Location:
    England
    TOMD: After being told all my life that it is the worst thing you could ever do, I used a GOTO statement for the first time today and it felt so good.

    Edit for a beginner-friendly explanation:

    That link above has a quick run-down on it. Basically if you don't know what you're doing, stay far away from GOTOs. As a filthy C programmer, though, sometimes there's a right time for it. It's liberating to realise that!
     
    Last edited: Feb 5, 2019
  20. Jarizok

    Jarizok Professor

    Joined:
    Sep 22, 2015
    Messages:
    414
    Gender:
    Male
    Location:
    Netherlands
    So, turns out databases and mySQL are not entirely seperate things. Who knew.

    Anyways, week 2 is here and with that came the basic programming test yesterday. I got a 97 because I didn’t initialize my string array on the same line I declared it even though I could have. Still pretty happy with it!
     
    Last edited: Feb 12, 2019
Loading...