• 0

I'm really getting frustrated.


Question

Hello everyone.

 

I have been trying to learn how to program in multiple programming languages (Python, Ruby, PHP, Visual Basic, C++, JAVA, C#, C.) but I have picked up none of these languages. I have been looking for books for quite a long time, I've been trying hands-on books, I've been trying For Dummies books, Heads First, etc, but I haven't gotten further than writing Hello World.

 

What my major issue is that I do not understand any of the technical terms, even after Googling them. What happens is that I get a book on C# for example and I pick it up for a little bit, then something that I don't understand comes up and I'm practically forced to give up.

I'm an IT student and I would like to have some programming experience before next year. I am really interested in C#, C++, C and JAVA but I have not found anyone or anything that can help me, even after taking a course in Visual Basic (Which I miserably failed).

 

Could anybody show the ropes to an absolute idiot? I'm just looking for definitions on all the technical stuff which is in English, not in technical terms.

 

Thank you so much.

 

ShellBox.

Link to comment
Share on other sites

Recommended Posts

  • 0

Xamarin Studio is free for personal use with size limitations on the app; how is compatibility poor? The only libraries not supported are Windows-specific (WCF, WPF). Unity is the most widely used cross-platform game development toolkit, is free and uses C# as a scripting language. There's nothing inherently more cross-platform about Java.

 

Unless we're talking server or command line applications, I'm not a big fan of write once, run everywhere. The first party UI toolkits are invariably different on each platform and I'd like to be able to fully take advantage of the specifics of each. When I write iOS apps, I do so in Obj-C and when I write Android apps, I do so in Java.
Link to comment
Share on other sites

  • 0

Unless we're talking server or command line applications, I'm not a big fan of write once, run everywhere. The first party UI toolkits are invariably different on each platform and I'd like to be able to fully take advantage of the specifics of each. When I write iOS apps, I do so in Obj-C and when I write Android apps, I do so in Java.

That's exactly what Xamarin favours, actually. You get the native GUI toolkit of each specific platform. So you get to re-use all non-UI code and to use the same language and base libraries across all platforms, but you code a separative, native UI for each platform. Best of both worlds IMO.

Link to comment
Share on other sites

  • 0

That's exactly what Xamarin favours, actually. You get the native GUI toolkit of each specific platform. So you get to re-use all non-UI code and to use the same language and base libraries across all platforms, but you code a separative, native UI for each platform. Best of both worlds IMO.

 

Yep, they are binding the underlying APIs instead of abstracting them out. It's the correct approach IMO. I haven't used it though, so I don't know how well that works in practice. What's your experience with it been like?

 

I admit that I've got reservations. There are lots of subtleties in each platform, and you'd still have to deal with these. There's some opportunity to share code, but it's not apparent that it's going to be a whole lot beyond some model classes. You can't share code related to UI, platform services, application lifecycle, hardware access, notifications, etc. You still need to deal with the underlying platform memory management quirks. You still need to learn the target platform tools (e.g. Instruments for profiling iOS apps).

 

I'm not sure it's a worthwhile net win overall.

Link to comment
Share on other sites

  • 0

Yep, they are binding the underlying APIs instead of abstracting them out. It's the correct approach IMO. I haven't used it though, so I don't know how well that works in practice. What's your experience with it been like?

 

I admit that I've got reservations. There are lots of subtleties in each platform, and you'd still have to deal with these. There's some opportunity to share code, but it's not apparent that it's going to be a whole lot beyond some model classes. You can't share code related to UI, platform services, application lifecycle, hardware access, notifications, etc. You still need to deal with the underlying platform memory management quirks. You still need to learn the target platform tools (e.g. Instruments for profiling iOS apps).

 

I'm not sure it's a worthwhile net win overall.

I don't have personal experience with Mono (and little in mobile apps, actually), but I suppose the amount of code re-use depends on the complexity of the application and how you abstract platform interactions. If you're building a game with 3d rendering, pathfinding, state management, custom controls, etc., all of that can be common. I'd also say that at least using the same language and set of base class libraries is a big plus (vs using completely unrelated technologies like Java and Objective-C).

 

Xamarin has some pretty high figures for code re-use on their site: http://scan.xamarin.com/Home/Report?scanId=4e9f7ae8-dc3b-4cc1-9917-8ccffcf74042

  • Like 1
Link to comment
Share on other sites

  • 0

I don't have personal experience with Mono (and little in mobile apps, actually), but I suppose the amount of code re-use depends on the complexity of the application and how you abstract platform interactions. If you're building a game with 3d rendering, pathfinding, state management, custom controls, etc., all of that can be common. I'd also say that at least using the same language and set of base class libraries is a big plus (vs using completely unrelated technologies like Java and Objective-C).

 

Xamarin has some pretty high figures for code re-use on their site: http://scan.xamarin.com/Home/Report?scanId=4e9f7ae8-dc3b-4cc1-9917-8ccffcf74042

 

Yep, it really depends on the type of app. I might take Xamarin for a test drive and see what's what for myself.

Link to comment
Share on other sites

  • 0

Hello everyone, OP here.

Sorry for not posting anything for a while, I was busy with college and I took a bit of time off. 

I've been looking for a small, easy program that I can create myself but I still haven't chosen yet. I was thinking of doing a console text-based game in C# but I have been struggling a bit with C#.

 

I have however been writing small and stupid programs using IF statements which are kind of working now so I'm glad about that. 

Could anybody please explain to me in a very simple way (compare it to something in real life) what objects are, what a class is and what operators are and what all of these do?

Thank you very much.

Link to comment
Share on other sites

  • 0

Could anybody please explain to me in a very simple way (compare it to something in real life) what objects are, what a class is and what operators are and what all of these do?

Thank you very much.

 

There are several explanations on that above.  Pick one that makes the most sense to you, then ask specific questions about it.

 

As for operators, I'm assuming you're referring to overloaded operators.  I suggest disregarding operator overloading for now, until you have a firmer grasp of the basics.

Link to comment
Share on other sites

  • 0

There are several explanations on that above.  Pick one that makes the most sense to you, then ask specific questions about it.

 

As for operators, I'm assuming you're referring to overloaded operators.  I suggest disregarding operator overloading for now, until you have a firmer grasp of the basics.

 

To be honest, I don't understand any of the given explanations.

Link to comment
Share on other sites

  • 0

I've been looking for a small, easy program that I can create myself but I still haven't chosen yet. I was thinking of doing a console text-based game in C# but I have been struggling a bit with C#.

 

 

Here's your mistake; you're trying to run before you can even stand,let alone walk.

 

I have however been writing small and stupid programs using IF statements which are kind of working now so I'm glad about that. 

 

Which is exactly what you SHOULD be doing at your level.  Very simple pieces of code that take a bit of information, make a decision about it, and do something based on that.

 

 

To be honest, I don't understand any of the given explanations.

 

Of course you haven't, because you don't have the basic grounding in object oriented programming that you need to understand the terms.  You don't even understand procedural programming yet, so you're really going to struggle with OO.

 

Give this article a try.  If you can't understand the simple explanations of OO in this, then I'm sorry but you'll almost certainly need teacher guidance to get anywhere.

Link to comment
Share on other sites

  • 0

That's just as bad to be honest. I honestly don't have a clue on what they're going on about. The one FloatingFatMan posted is quite good but I don't really understand the code.

Have you tried reading a book...

Link to comment
Share on other sites

  • 0

That's just as bad to be honest. I honestly don't have a clue on what they're going on about. The one FloatingFatMan posted is quite good but I don't really understand the code.

 

I'm really not surprised. The concepts of OOP are difficult for a beginning programmer to grasp. As FloatingFatMan suggested, you'd be better off learning a simple imperative language without the complexities of objects, classes etc.

 

You already seem to have a grasp of conditional logic (IF/ELSE etc) in code, so I suggest continuing with that imperative programming paradigm. At this point languages like C#, Java, and C++ are just going to confuse and overwhelm you with information.

 

Now that you understand conditional logic, why not try your hand at loops. They are in the same category as if / else statements, in that they allow you to control the flow of your program. Uniquely though, loops allow you to repeatedly execute a block of code until some condition becomes true. For example:

#include <stdio.h>
 
void
main ( void )
{
      int i = 1000;
 
      while ( i-- )
             printf ( "Hello World %i\n",  i );
}

Then try a For, and Do while loop. With all that you can begin to make a basic program that's actually useful.

 

After that you need to learn about functions, both creating them, and calling them. As well as including other files / modules in your program (note: #include).

Link to comment
Share on other sites

  • 0

Have you tried reading a book...

 

To be fair, the kids in that video are just reading from a script that's no different than the standard definition of what classes and objects are. Just because it features children, it doesn't make the content any easier to digest. I doubt most of them even know what the words 'Instantiation' or 'Abstraction' mean.

 

If you want a reference book, I'd suggest K&R's C Programming language second edition. To get set up, have a look at this pdf.

Link to comment
Share on other sites

  • 0

 

I'm really not surprised. The concepts of OOP are difficult for a beginning programmer to grasp. As FloatingFatMan suggested, you'd be better off learning a simple imperative language without the complexities of objects, classes etc.

 

You already seem to have a grasp of conditional logic (IF/ELSE etc) in code, so I suggest continuing with that imperative programming paradigm. At this point languages like C#, Java, and C++ are just going to confuse and overwhelm you with information.

 

Now that you understand conditional logic, why not try your hand at loops. They are in the same category as if / else statements, in that they allow you to control the flow of your program. Uniquely though, loops allow you to repeatedly execute a block of code until some condition becomes true. For example:

The problem isn't the language having OOP, the problem is that OP is ignoring advice to not dive into OOP concepts until he has a foundation in the basics (such as procedural programming, branching, simple logic, etc.). C# is an imperative & procedural programming language along with OO (it's multi-paradigm) and the OP should be focusing on those things instead of trying to deal with OOP concepts as it has been noted various times.

Link to comment
Share on other sites

  • 0

The problem isn't the language having OOP, the problem is that OP is ignoring advice to not dive into OOP concepts until he has a foundation in the basics (such as procedural programming, branching, simple logic, etc.). C# is an imperative & procedural programming language along with OO (it's multi-paradigm) and the OP should be focusing on those things instead of trying to deal with OOP concepts as it has been noted various times.

 

Considering the fact that you can't write the simplest of programs in C# without invoking the class keyword I tend to disagree. Take a look at Microsoft's own Hello World example. Immediately the reader is thrown into classes, objects, namespaces, static vs non-static class functions, and so on.

 

Someone writing C# code can't avoid OO. That's the nub of the matter. And that's why I advocate eschewing languages like it. The OP should strip all that away and use a simple imperative / procedural language. No complicated OO classes, namespaces, objects, polymorphism, operator overloading, inheritance, generics, or anything else that's completely unnecessary. By all means when someone has a firm grasp of things, but until then it's just a distraction.

Link to comment
Share on other sites

  • 0

I've found an eBook which is kind of useful (Heads First C# 3rd edition) and they do explain things but still not what I need. I'm just curious to what polymorphism and memory allocating and everything in this thread means. 

I'm updating the OP with the VB code I wrote. I'm gonna try to convert it into C# and see what comes from it.

I can't update the OP so I'll do it here.

 

 

Gotta start somewhere. I remember doing a lot of apps like that in Turing

 

var age

var name

var gender

put "What is your name?"

get name

put "What is your gender?"

get gender

put "How old are you?"

get age

put "Hello "

put name

put " is it fun being a " 

put age

put " year old "

put gender

put "?"

 

 

Link to comment
Share on other sites

  • 0

Considering the fact that you can't write the simplest of programs in C# without invoking the class keyword I tend to disagree. Take a look at Microsoft's own Hello World example. Immediately the reader is thrown into classes, objects, namespaces, static vs non-static class functions, and so on.

 

Someone writing C# code can't avoid OO. That's the nub of the matter. And that's why I advocate eschewing languages like it. The OP should strip all that away and use a simple imperative / procedural language. No complicated OO classes, namespaces, objects, polymorphism, operator overloading, inheritance, generics, or anything else that's completely unnecessary. By all means when someone has a firm grasp of things, but until then it's just a distraction.

Simpy put: you are not being fair. You can write an entire procedural program using a single class. This is conceptually no different from taking a C program and wrapping it in a C++ class. You do not need to understand or deal directly with the nature of objects, classes, inheritance, polymorphism, etc. do to this. At worse, you have to use namespaces in an analogous manner to #includes in C and deal with Strings. Doing these things required next to zero knowledge about OOP concepts. The OP is struggling with the concept of control flow structure and implementing basic decision making. What part of that requires an understanding of OOP concepts?

 

It's like FloatingFatMan said, the OP is trying to run before he can even stand. And what's more is that it doesn't matter if he uses a non-OOP language, he is just going to do the same thing with that unless he decides to pace himself and get the fundamentals down. If it isn't classes, it is going to be memory management, pointers, structs, and data-structures and you are in the same boat as now. This isn't a language issue, it's a pacing issue.

Link to comment
Share on other sites

  • 0

It's like FloatingFatMan said, the OP is trying to run before he can even stand. And what's more is that it doesn't matter if he uses a non-OOP language, he is just going to do the same thing with that unless he decides to pace himself and get the fundamentals down. If it isn't classes, it is going to be memory management, pointers, structs, and data-structures and you are in the same boat as now. This isn't a language issue, it's a pacing issue.

 

TBH, and I mean no disrespect to the OP, but it's something I've seen time and time again; people's reach vastly exceeding their grasp.  Everyone today is in so much of a hurry and want what they want immediately, without putting in the time needed to actually learn those skills.

 

It's like those week long intensive training courses with a Microsoft certification exam at the end. The only thing you learn in those is how to pass the exam, that's it.  You still won't be any damn good programming in the language, because you haven't got the months and months that you absolutely NEED under your belt with using it.

 

Until the OP takes a good long look at himself, and realizes that he just doesn't have the basic grounding that he MUST have to be a decent programmer, he's going to continue to run on the spot, and his school course will be a complete waste of everyone's time.  He cannot get the knowledge he needs from books alone, especially with his additional needs. He needs a good teacher, he needs to practice, practice, practice, and he needs to control his aspirations.

  • Like 1
Link to comment
Share on other sites

  • 0

Could anybody please explain to me in a very simple way (compare it to something in real life) what objects are, what a class is and what operators are and what all of these do?

First you should understand:

 

 - Functions

 - Basic data types (int, float, string)

 - Variables

 

Assuming you understand the above. Basic data types like integers and floats are great for representing single, scalar values, for example someone's height.

float height = 1.88m; // my height in meters

It's also easy to write functions that operate on single values using these types. Let's write a function that takes two floats and returns their sum:

float Sum(float a, float b) {
    return a + b;
}

We can call this function like this:

float result = Sum(3f, 5f); 
// now result is 8f

However, it becomes a problem when you want to represent composite values. For example, how would you represent a 2D coordinate in C#? Perhaps with two variables:

float X = 12f;
float Y = 15f;

Now, how would you write a function that takes two 2D coordinates and returns their sum? Note that the sum of two 2D points is a 2D point, i.e. mathematically:

 

(X', Y') = (X1, Y1) + (X2, Y2)

where

X' = X1 + X2

Y' = Y1 + Y2

 

So, you would need to take in 4 values (X1, Y1, X2 and Y2) and return 2 values (X' and Y'). Something like:

(X, Y) = Sum(x1, y1, x2, y2);

Alas, this is not valid C#! A function can only return one value; there is no way to write a Sum function such that this code will compile.

 

We'd need to somehow return our two floats as a single value...

 

Which is exactly where classes come in! In C#, we can define a new data type by compositing existing data types, like so:

class Point2D {
     public float X;
     public float Y;
}

This allows us to write our Add function easily:

Point2D Sum(Point2D a, Point2D b) {
    var result = new Point2D();
    result.X = a.X + b.X;
    result.Y = a.Y + b.Y;
    return result;
}

Here, Point2D is a class. a, b, and result are objects, i.e. instances of a class. We could have as many Point2D objects as we want (i.e. instances), but there's only one Point2D class (only one definition of Point2D). There's some new syntax here: the new operator and the dot operator. These allow us to create an object and access its members, respectively. 

 

Try not to stumble too much on the syntax. Simply understand that we defined a new type, "Point2D", as a composite of two floats, which we named X and Y. We can now create all the Point2Ds we want, just like we could create all the floats or strings we want. Point2D is a new data type, our own data type, and it has two members. We can now define functions that create and operate on this type. This allows us to use related data as a single value.

 

We could use our new Sum function like so:

var p1 = new Point2D();
p1.X = 10;
p1.Y = 10;
var p2 = new Point2D();
p2.X = 13;
p2.Y = 15;

var p3 = Sum(p1, p2);
Console.WriteLine("({0},{1}) + ({2},{3}) = ({4},{5})", p1.X, p1.Y, p2.X, p2.Y, p3.X, p3.Y);
// prints "(10,10) + (13,15) = (23,25)"

Now, writing:

var p3 = Sum(p1, p2);

(where p1, p2 and p3 are Point2Ds) is ok, but it'd be much nicer if just like we do with floats, we could more naturally write:

var p3 = p1 + p2;

To do this, we need to define what the operator "+" means, when applied to two Point2Ds. Intuitively enough, we need to modify our definition of Point2D to specify this meaning:

class Point2D {
    public float X;
    public float Y;
    public static Point2D operator +(Point2D p1, Point2D p2) 
    {
        var result = new Point2D();
        result.X = p1.X + p2.X;
        result.Y = p1.Y + p2.Y;
        return result;
    }
}

Again, try not to focus too much on the syntax. We're defining "operator +" as a function that takes two Point2Ds and returns their sum, i.e. another Point2D. And now, the above code just works!

 

Look ma' I just learned operator overloading!

 

Finally, it'd also be nice if it didn't require three lines of code to create and initialize a Point2D:

var p1 = new Point2D();
p1.X = 3;
p1.Y = 5;
// All this typing!!! URRRGH

Wouldn't it be nice if we could just write this in one line, say like so:

var p1 = new Point2D(3, 5);
// AAAAH WAY BETTER

And this would automatically assign 3 to X and 5 to Y. C# allows us to do this with special methods called constructors. So let's modify the Point2D class again:

 

    class Point2D
    {
        public float X;
        public float Y;


        public Point2D(float x, float y)
        {
            X = x;
            Y = y;
        }

        public static Point2D operator +(Point2D p1, Point2D p2)
        {
            return new Point2D(p1.X + p2.X, p1.Y + p2.Y);
        }
    }

The strange Point2D method with no return type is what's called a constructor. It allows us to write the initialization logic in only one place, and then create our objects much more easily.

 

Notice that I also changed the "operator +" function to use this constructor directly instead of creating a Point2D and initializing the members separately: it now fits nicely on a single line.

 

We can go further and simplify all of our code. For instance, we can rewrite our addition example like so:

var p1 = new Point2D(10, 10);
var p2 = new Point2D(13, 15);


var p3 = p1 + p2;
Console.WriteLine("({0},{1}) + ({2},{3}) = ({4},{5})", p1.X, p1.Y, p2.X, p2.Y, p3.X, p3.Y);
// prints "(10,10) + (13,15) = (23,25)"

Isn't this great? We can now work with 2D coordinates basically as easily as floats! We made our own data type!

 

And that's about all I'm willing to fit into a forum post. Hopefully you will have understood that:

 

 - classes allow you to define your own data types by compositing existing data types

 - classes can define operations on their members (like the "+" operator)

 - A class is the definition of the data type: what it is and what it does. An object is a concrete instance of that data type. There's only ever one definition per type (one class), but there can be as many objects of that type as you want.

 

Take your time. There's lots to learn about classes: public vs protected vs private members, static vs instance members, inheritance, virtual methods, etc. If you were following a good book with exercices and doing the exercices, you would likely not need to keep asking for basic tutorials here. I suggested the Yellow Book many times to you (which would explain all this much better than me), and I can only repeat my suggestion. You don't need to be stuck and wait for people to help you on forums. You can follow a good book like that and practice on your own.

 

As an exercise, try to extend the Point2D with more operations:

 

 - substraction

 - scalar addition/substraction

 - dot product

 - cross product

 - norm

 - etc.

 

Don't hesitate if you have more specific questions though.

 

Here's a full, compilable listing if you want to play with the example code:

 

using System;


class Point2D
{
    public float X;
    public float Y;

    public Point2D(float x, float y)
    {
        X = x;
        Y = y;
    }

    public static Point2D operator +(Point2D p1, Point2D p2)
    {
        return new Point2D(p1.X + p2.X, p1.Y + p2.Y);
    }
}

class Program
{
    static void Main()
    {
        var p1 = new Point2D(10, 10);
        var p2 = new Point2D(13, 15);

        var p3 = p1 + p2;

        Console.WriteLine("({0},{1}) + ({2},{3}) = ({4},{5})", p1.X, p1.Y, p2.X, p2.Y, p3.X, p3.Y);
        // prints "(10,10) + (13,15) = (23,25)"
    }
}
  • Like 3
Link to comment
Share on other sites

  • 0

I don't think the OP understands a single word of the that 'mini-tutorial' but yea, nice one nonetheless.

Link to comment
Share on other sites

  • 0

I don't think the OP understands a single word of the that 'mini-tutorial' but yea, nice one nonetheless.

 

Unfortunately I didn't no. That's why I struggle reading "simple" programming fundamental books and tutorials. I just simply don't understand what a function is. I know what a variable is and how to do if else statements.

Link to comment
Share on other sites

  • 0

Hello,

ShellBox, like I mentioned I dont think programming is for you if you dont understand what a function is at this point.

And the rest, this is a 14 page thread. By now....this should be closed/ended/dead.

Did you checkout daniweb?

Like I said, I wont post here anymore but it just keeps popping up on the minispy.

Link to comment
Share on other sites

  • 0

A function is a set of statements, aimed to perform a single thing.

For example, an function to calculate something. If you put the code for a calculation in a function, you can just 'call' this function everywhere you want in your code without having to write all the actual code over and over again every time you need it.
 

public int CalculateLoan(int incomePerHour, int hoursWorked)
{
   int loan = incomePerHour * hoursWorked;
   return loan;
}


This EXTREMELY simplified function(or method, whatever you want to call it) needs to 2 variables to work. First, it needs an incomePerHour which is an Integer and a number of hours, also an Integer.

Than it goes to work. It calculates the loan and stores it in a seperate variable 'loan' and then returns loan. The function's work is done here. It took 2 parameters, performed a set of actions on it and returns the result.

The advantage is,every time you need to calculate a loan in your application, you can simply call CalculateLoan and give it the 2 variables it needs

 

int myLoan = CalculateLoan(12, 8);

// myLoan will contain 96

Now, this is extremely simplified and by no means complete but it just demonstrates the basic concept of a function. You also have functions that don't necessarily return something. They just DO something. You could also write that CalculateLoan function on 1 line instead of 2 (omitting the loan variable) but don't focus on that for now.

Now I'm not a teacher (and maybe it shows :/ ) but I hope it helped.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.