Newbie Coders Chat

Announcements Posted on
How helpful is our apprenticeship zone? Have your say with our short survey 02-12-2016
    Offline

    0
    ReputationRep:
    Anyone used free code camp? I'm a good way through the courses and so far it's really good.
    Offline

    3
    ReputationRep:
    (Original post by catman99)
    Anyone used free code camp? I'm a good way through the courses and so far it's really good.
    If it has a C course, I might give it a go. (planning on learning C/C#/C++ on top of Python)
    Offline

    2
    ReputationRep:
    Back once again with the JavaScriptMaster!


    also I'm really good at C# and C++...... and Java
    Online

    3
    ReputationRep:
    Bieber concerts is a great advancement in the teaching of programming.

    Before it would of been let's make this exciting console app that reverses a string or prints out a christmass tree using the the hash character.
    Online

    3
    ReputationRep:
    (Original post by JavaScriptMaster)
    Back once again with the JavaScriptMaster!


    also I'm really good at C# and C++...... and Java
    Oh wise JavaScript master I have noticed people creating JavaScript objects in many different ways:

    Some do:
    Code:
    var customer ={Name:"Ronald"};
    Others do:
    Code:
    function Customer(name){
    this.Name = name; 
    }
    car customer = new Customer('Ronald');
    And I've even seen
    Code:
    function Customer(name)
    {
    }
    Customer.prototype.Name ='Ronald';*
    var customer = new Customer();
    * What are the differences between them ? Which should I use ?
    Offline

    2
    ReputationRep:
    (Original post by INTit)
    Oh wise JavaScript master I have noticed people creating JavaScript objects in many different ways:

    Some do:
    Code:
    var customer ={Name:"Ronald"};
    Others do:
    Code:
    function Customer(name){
    this.Name = name; 
    }
    car customer = new Customer('Ronald';);
    And I've even seen
    Code:
    function Customer(name)
    {
    }
    Customer.prototype.Name ='Ronald';*
    var customer = new Customer();
    * What are the differences between them ? Which should I use ?
    Well that 1st method is actually making a JSON (JavaScript Object Notation) object which is good for saving data or converting it to another format... JSON objects can be used in a NoSQL database like MongoDB or CouchDB. They can be identified by their use of "key-value-pairs" which in this case, the key is 'Name' and the value is 'Ronald', note that the value is always surrounded by quotes because the value is always a string.

    2nd example: This is just a standard object constructor, all of the objects properties (name) are passed into the constructor as an argument, once the constructor is called the object is instantiated. This is the most common and straightforward way of creating objects.

    3rd Example: Empty constructor with a prototype, it's the same as the second example however this gives you the option to change it's properties and add new properties that aren't defined in the constructor code.

    One thing about JavaScript: EVERYTHING IS AN OBJECT this includes variables and functions, yes functions so this brings me to another way you can make objects (bit complicated though) it's called "Currying" where a function returns another function that then may return an object... it looks a little something like this:
    Code:
    function add(a, b) {    if (arguments.length < 1) {        return add;    } else if (arguments.length < 2) {        return function(c) { return a + c }    } else {        return a + b;    }}
    looks a bit pointless with this "basic addition" example but it becomes more useful when you use server-side JavaScript like Node JS for a process known as "routing"
    Offline

    3
    ReputationRep:
    Console.WriteLine("Hello");

    :ninja:
    Offline

    2
    ReputationRep:
    I'll just grab my Web Development notes here:

    Yes, nested functions are closures.

    With nested functions you have access to variables at definition time (in their scope by lexical context), in contrast to C#, which uses execution context.
    The great advantage of using closures is that you still have access to variables after the containing function has ended, through the use of a hidden [[scope]] pointer on the heap.

    In JavaScript, if you declare a function within another function, then the local variables can remain accessible after returning the function you called.
    http://stackoverflow.com/questions/11...-closures-work

    There is no class keyword in Javascript, but you can do the following:
    Code:
    function AnObject(){
    }
    
    var my = new AnObject();
    my.name = "John";
    my.definition = function { ... }
    The problem with the above approach is that the object properties 'name' and 'definition' (arbitrarily chosen) have only been defined for instance 'my'.

    var yours = new AnObject();
    alert(yours.name) // returns UNDEFINED

    Solutions to this problem:
    - Constructor function
    - Prototype

    Constructor function: you have to use the this keyword to define public variables and functions (and to define private ones, you use the var keyword)

    Prototype:

    To add properties and methods to all instances of an object, outside of the constructor. We use the prototype property for this and every object has it.

    Javascript is not a real OO language because it's missing the following features:
    - namespaces, encapsulation, interfaces, inheritance

    What can we do about that? We can imitate these by making specific coding agreements:
    use of scope, context and closures.

    Namespaces:
    You use the object literal notation as a singleton so that you can emulate namespaces.

    Encapsulation:
    Use naming conventions such as prefixing all private members with an underscore.
    Also via closures:
    - constructor defines private attributes through the var keyword
    - constructor defines privileged methods through the this keyword
    - public methods without access to private attributes through prototype keyword

    Interfaces through duck typing.

    In summary:
    - Use the first code example to emulate namespaces so that you have unobtrusive code
    - Use the third example to have more flexible code

    If your platform is resource-poor, try to consider efficient memory and CPU pipeline use of the various approaches (also referred to as 'micro-optimization'.
    Online

    3
    ReputationRep:
    (Original post by 571122)
    I'll just grab my Web Development notes here:

    Yes, nested functions are closures.

    With nested functions you have access to variables at definition time (in their scope by lexical context), in contrast to C#, which uses execution context.
    The great advantage of using closures is that you still have access to variables after the containing function has ended, through the use of a hidden [[scope]] pointer on the heap.

    In JavaScript, if you declare a function within another function, then the local variables can remain accessible after returning the function you called.
    http://stackoverflow.com/questions/11...-closures-work

    There is no class keyword in Javascript, but you can do the following:
    Code:
    function AnObject(){
    }
    
    var my = new AnObject();
    my.name = "John";
    my.definition = function { ... }
    The problem with the above approach is that the object properties 'name' and 'definition' (arbitrarily chosen) have only been defined for instance 'my'.

    var yours = new AnObject();
    alert(yours.name) // returns UNDEFINED

    Solutions to this problem:
    - Constructor function
    - Prototype

    Constructor function: you have to use the this keyword to define public variables and functions (and to define private ones, you use the var keyword)

    Prototype:

    To add properties and methods to all instances of an object, outside of the constructor. We use the prototype property for this and every object has it.

    Javascript is not a real OO language because it's missing the following features:
    - namespaces, encapsulation, interfaces, inheritance

    What can we do about that? We can imitate these by making specific coding agreements:
    use of scope, context and closures.

    Namespaces:
    You use the object literal notation as a singleton so that you can emulate namespaces.

    Encapsulation:
    Use naming conventions such as prefixing all private members with an underscore.
    Also via closures:
    - constructor defines private attributes through the var keyword
    - constructor defines privileged methods through the this keyword
    - public methods without access to private attributes through prototype keyword

    Interfaces through duck typing.

    In summary:
    - Use the first code example to emulate namespaces so that you have unobtrusive code
    - Use the third example to have more flexible code

    If your platform is resource-poor, try to consider efficient memory and CPU pipeline use of the various approaches (also referred to as 'micro-optimization'.
    Good notes although JS does support inheritance through prototype and 'constructor stealing':
    https://jsfiddle.net/3atskdkc/1/
    You got to admire Javascripts simplicity
    Offline

    2
    ReputationRep:
    (Original post by INTit)
    Good notes although JS does support inheritance through prototype and 'constructor stealing':
    https://jsfiddle.net/3atskdkc/1/
    You got to admire Javascripts simplicity
    JavaScript is anything but simple. It's every developer's nightmare. If you know how the JavaScript engine parses, executes and allocates its variables (as opposed to how you think it does that) then you are good with Javascript, because it does it in an incredibly unintuitive way that has developers scream with frustration.

    Let's not forget the zillion bugs JS has.. it's a complete nightmare. Every developer agrees.
    Commonly used image in JavaScript lectures and developer talks:
    Online

    3
    ReputationRep:
    (Original post by 571122)
    JavaScript is anything but simple. It's every developer's nightmare. If you know how the JavaScript engine parses, executes and allocates its variables (as opposed to how you think it does that) then you are good with Javascript, because it does it in an incredibly unintuitive way that has developers scream with frustration.

    Let's not forget the zillion bugs JS has.. it's a complete nightmare. Every developer agrees.
    Commonly used image in JavaScript lectures and developer talks:
    Haha yea the more the more you know the more the worse it gets.
    Online

    3
    ReputationRep:
    (Original post by 571122)
    Try not to let others mess you up. Rough times are a part of life though. Best of strength. Stay focused.
    (Original post by Craghyrax)
    Sorry to hear about your situation. You seem very young to be married? Not a judgement, but I think that makes it harder because you are both still growing and maturing.
    If you can, arrange to see a marriage counsellor.
    Next thing to do is to spend time reflecting on exactly what the issues are. Identify your own needs, and also your own failures. You need to be honest about things that you can't do, or cope with. Then you need to find a way to communicate these in a calm way, and using language that is as neutral as possible. Frame things in terms of your needs and feelings and never in terms of her faults. This will make it more likely that she is able to hear you without reacting and that a productive conversation can take place.
    If she could do the same, that would be great. Sometimes this stuff is just too hard to verbalise in person. An email or letter might really help you.

    It's also worth keeping an open mind about whether you think your marriage can work, or should work after you've spent the time to analyse precisely what your different needs are and precisely what your personal limitations are. If you think that you can improve and mature so as to be able to give the other what they need, and avoid causing them pain... then great. But there's a possibility that you won't be able to... or that doing so would seriously undermine your own happiness. If that is the case then there is no shame in deciding to let the marriage go. There is a lot of cultural stigma surrounding divorce. But there is a gamut of psychological research confirming that divorce is far better for happiness than an unhappy marriage in the long term. So don't rule that out.
    All the best
    Thanks for the support 571 and Crag. I think i am over the worst of it now. I had been drinking a lot of coffee, and then being very clingy to her. I will need to address that. The thing is we don't always live in this world, but the next one. I don't certainly. What i mean by that is that, i need to get my priorities straight. But i still have this interview tomorrow morning i think i may have told you about. And assuming things don't go the way of the titanic, i am trying to remain positive. Plus this morning she told me that it was me who was pushing for a divorce. Stay tuned....
    Offline

    2
    ReputationRep:
    (Original post by INTit)
    Haha yea the more the more you know the more the worse it gets.
    I love this JS talk about JS's funny little bugs, check it out:



    It's not all that mysterious though, just ugly.
    Offline

    3
    ReputationRep:
    Hi.

    I've decided to learn to code with the objective of making my own smartphone game - I have a few really good ideas which I just need to know the means of bringing them to life!

    Has anyone used Kilobolt?

    I'm on Unit 1 where it'll teach me about Java. At the end of Unit 4, i'll be able to port my probably awful first game to android and possibly play it on my phone!

    Anyone had any experience with it? I'm very excited. Seems hard!
    Offline

    2
    ReputationRep:
    does anyone know how to program a voice recognition app so that when you speak to it it does what you ask it say for example 'turn off the light' or just ask it a question and it gives you the answer??
    Online

    3
    ReputationRep:
    (Original post by kaylababesxx)
    does anyone know how to program a voice recognition app so that when you speak to it it does what you ask it say for example 'turn off the light' or just ask it a question and it gives you the answer??
    *

    You could probably hook something up using a speech recognition api which would then communicate with a Raspberrry pi/ micro-controller like the Arduino to control the lights.

    One DIY route would be to try find a voice recognition api for the raspberry pi then wire a circuit to control the lights which you could control programatically via the PIs GPIO pins.
    Unless you really know what your doing with electricity stick to LEDs and not mains power lights !

    * If that doesn't sound fun or you want it to control mains lighting then just buy an Amazon Echo and some smart bulbs
    Online

    3
    ReputationRep:
    (Original post by Craghyrax)
    Sorry to hear about your situation. You seem very young to be married? Not a judgement, but I think that makes it harder because you are both still growing and maturing.
    If you can, arrange to see a marriage counsellor.
    Next thing to do is to spend time reflecting on exactly what the issues are. Identify your own needs, and also your own failures. You need to be honest about things that you can't do, or cope with. Then you need to find a way to communicate these in a calm way, and using language that is as neutral as possible. Frame things in terms of your needs and feelings and never in terms of her faults. This will make it more likely that she is able to hear you without reacting and that a productive conversation can take place.
    If she could do the same, that would be great. Sometimes this stuff is just too hard to verbalise in person. An email or letter might really help you.

    It's also worth keeping an open mind about whether you think your marriage can work, or should work after you've spent the time to analyse precisely what your different needs are and precisely what your personal limitations are. If you think that you can improve and mature so as to be able to give the other what they need, and avoid causing them pain... then great. But there's a possibility that you won't be able to... or that doing so would seriously undermine your own happiness. If that is the case then there is no shame in deciding to let the marriage go. There is a lot of cultural stigma surrounding divorce. But there is a gamut of psychological research confirming that divorce is far better for happiness than an unhappy marriage in the long term. So don't rule that out.
    All the best
    I am 35 you know?

    Anyway we are over the worst of it.

    And back to my programming course, i have passed the first three weeks with a grade over 50%, which is what i was aiming for. Hopefully if i keep this up i may just scrape a c pass overall. But I'm not going to kill myself over it,

    See attached <>

    Name:  computerscv2.jpg
Views: 26
Size:  148.4 KB
    Offline

    2
    ReputationRep:
    Here are my scores for C# and stuff. I paused doing the course for a while because I have to study something else, but I'll get back on it sometime soon!

    Online

    3
    ReputationRep:
    (Original post by 571122)
    Here are my scores for C# and stuff. I paused doing the course for a while because I have to study something else, but I'll get back on it sometime soon!

    Yes but the difference between you and me is that you know how to code, and i haven't done it in over twenty years. I also have pass grades for personal finance, psychiatric drug maintence and social media as well. What is the bredth of your study 571?
    Offline

    2
    ReputationRep:
    (Original post by john2054)
    Yes but the difference between you and me is that you know how to code, and i haven't done it in over twenty years. I also have pass grades for personal finance, psychiatric drug maintence and social media as well. What is the bredth of your study 571?
    Yeah, sorry for bragging there.

    Well, my education entails a lot of courses, which is a very broad knowledge baggage. I don't really know how to program well, you see, I don't have a talent, like good coders do. I just know the basics. A few grades from uni I suppose I'll show:

    Accounting: 90%
    Financial analysis: 80%
    Communication 101: 90%
    Computer architecture: 60%
    Web development: 70%
    Object Oriented Programming 101: 75%
    Logic theory and data structures 101: 50%
    Systems theory: 60%
    Operating systems theory: 65%
    Network architecture 101: 60%
    Networking 101: 60%
    Networking 201: 60%
    Databases 101: 60%
    Databases 201: 50%
    Software Engineering 101: 60%
    Project Programming 101: 60%
    Software Engineering 2: 60%
    Systems theory 201: 60%
    OO programming 201 (Java, .NET): 60%, 70%
    Databases 301: 65%
    Software Engineering 301: 60%
    Multimedia technologies: 70%
    Communication 201: 70%
    XML and data technologies: 90%
    Communication 301: 70%
    Statistics 101: 50%
    Project management: 50%
    Performance management: 90%
    ICT law: 85%
    Programming 301: 65%
    Enterprise Resource Planning : development: 85%
    Finals programming project: 60%
    UI design 301: 65%
    Programming 401: 60%
    Distinction research paper: 80%


    And that concludes my degree.
    I still haven't mentioned the other ones from my community college degree, but I'm too tired for that. It's more or less the same.
 
 
 
Write a reply… Reply
Submit reply

Register

Thanks for posting! You just need to create an account in order to submit the post
  1. this can't be left blank
    that username has been taken, please choose another Forgotten your password?
  2. this can't be left blank
    this email is already registered. Forgotten your password?
  3. this can't be left blank

    6 characters or longer with both numbers and letters is safer

  4. this can't be left empty
    your full birthday is required
  1. Oops, you need to agree to our Ts&Cs to register
  2. Slide to join now Processing…

Updated: November 25, 2016
TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

Today on TSR
Poll
Would you rather have...?
Useful resources

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Quick reply
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.