# Wanna dabble in basic programing



## ShiBDiB (Jan 8, 2015)

I'm military but I've always had a passion for computer related things and recently enrolled into a CIS program. I'm also currently an avid EVE online player and as such I want to try converting one of my many spreadsheets into something a little nicer.

https://docs.google.com/spreadsheet...pKHkQlTjk4L1asuQB27Qur4r5o/edit#gid=775159359

is a link I share with other users in my alliance to determine prices for buying capital ships from me. I'd like to make it a web based app that allows multiple users to use it at once without stepping on eachothers toes. Basically all it does is use the 3 drop downs to get prices based on ship, location and fitting. It also seemed like a great place to start getting my mind ready for programming. It seems like it will be a relatively simple starting point without alot of basic if this then this + this while referencing a db.


Basically what this boils down too..

- What coding language should I start with given the major I just started and task I'm looking to complete.
- Where's a decent free (for now) guide that I can pick at for completing the task at hand.
- Just general tips and advice for the major or this project.


----------



## xvi (Jan 8, 2015)

Visual Basic .NET is relatively friendly, but not terribly efficient (not like that matters too much for what it looks like you'd be using it for). It lets you design a GUI before you put code to it. Stick a few elements in for inputs, parse any text boxes to numbers so that "7+9" doesn't equal "79"(convert.ToInt function, I think?), make a button that has a .onclick function to do whatever calculations you want, and you should be done.
As for the IDE, I'd suggest whatever the latest Visual Studio is. Used to be Visual Studio Express was the free one, but it looks like it's now called Visual Studio Community or something.

It's been a while since I've worked with any of that, but that's what we started with in college. Not sure on a guide, but I would imagine Google should have something.

It's typically pretty basic. In pseudo-code, because I don't remember a whole lot of the syntax..

```
me.ButtonA.onclick{
    TextboxC = TextboxA + TextboxB
}
```
Once you get all that in, hit "Compile and run" and test it out.


----------



## ShiBDiB (Jan 8, 2015)

hmm ill leave that downloading while on post (currently in afghanistan)


----------



## FordGT90Concept (Jan 8, 2015)

Visual Basic .NET is where most CIS programs start predominantly because developing the WinForms UI is stupid easy in Visual Studio.  If you have an ASPX host, you can even port a lot of the code behind to ASPX for use in a webpage.  C# has the same advantages but it's a harder language to pick up because it is picky on syntax and things like event handlers are more complicated to set up.

& is the string concatenation character in VB or + in C#.  System.Convert.ToInt32() can convert a string (or many other types) to an signed 32-bit integer; this is the same in all .NET languages.

VB and C# via Visual Studio can both generate Click event handlers.  VB would be something like:

```
Private Sub ButtonClicked(ByVal sender As Object, ByVal e As EventArgs) Handles button.Click
  txtC.Text = txtA.Text & txtB.Text
End Sub
```
Private = can't be accessed outside of the class it resides in
Sub = Subroutine = code that executes but not return anything
Function = code that executes and returns a value (not in the above code but important to know)

ButtonClicked = the name of the subroutine
ByVal = a copy of the source
ByRef = a link to the source (not in the above code but important to know)
sender = a copy of what sent the event, for example, in this case, it would be a copy of "button."
Object = the most primitive type in .NET.  It can literally contain anything.
e = event arguments which can contain extra data about the clicked event
EventArgs = the generic event arguments class found at System.EventArgs.  MSDN has more information but really not too much to know about it unless you inherit the class for your own purposes.  There's already a lot of derivatives of EventArgs in .NET (for example, there's a KeyEventArg that is used in the context of keyboard keystrokes).

Handles = this links an event (something that exists in other code) to actions inside of your code. In this case, it is what to do when a button is clicked.
button = The name of a button on the Windows Form
Click = The name of the event handler that's listening for and notifying of click events on that button.

Visual Studio Express is available for free for non-commercial use.


----------



## ShiBDiB (Jan 9, 2015)

I have no idea what any of what you said means.


----------



## HalfAHertz (Jan 9, 2015)

If you have zero coding background, I'd start with something more friendly like Python. You can learn the basics(list management, iteration, looping, etc.) for free from here: http://www.codecademy.com/learn
Then once you feel comfortable with that, try to move on to something tougher like one of the dotNET languages.


----------



## RCoon (Jan 9, 2015)

HalfAHertz said:


> If you have zero coding background, I'd start with something more friendly like Python. You can learn the basics(list management, iteration, looping, etc.) for free from here: http://www.codecademy.com/learn
> Then once you feel comfortable with that, try to move on to something tougher like one of the dotNET languages.



I recommend PyCharm for such a task. It's free for all educational institutions, and not quite as ugly as other software.


----------



## FordGT90Concept (Jan 9, 2015)

ShiBDiB said:


> I have no idea what any of what you said means.


Be specific.


----------



## ShiBDiB (Jan 9, 2015)

FordGT90Concept said:


> Be specific.




I don't know how to tie in what you posted with what I'm trying to do. Also installed pycharm, giving that a whirl.


----------



## HammerON (Jan 9, 2015)

Sub'd for curiosity as I have been interested in basic programming as well but no nothing....


----------



## ShiBDiB (Jan 9, 2015)

So right now goal is using either pycharm or visual studio, I want to create a web form that can be put on some free website that replaces the spreadsheet linked in the first post.


----------



## FordGT90Concept (Jan 9, 2015)

ShiBDiB said:


> I don't know how to tie in what you posted with what I'm trying to do. Also installed pycharm, giving that a whirl.


Install Visual Studio Express, create a new Visual Basic Windows Forms application, create a button on said form, double click on said button, and you'll see code pop up similar to what I said above.  I explained all of its components.


You should probably go with HTML + JavaScript.  I would pass on Visual Studio and Python.

You'll need three select boxes each with an OnChange event that calls a function which in turn does all the math.


----------



## ShiBDiB (Jan 9, 2015)

FordGT90Concept said:


> Install Visual Studio Express, create a new Visual Basic Windows Forms application, create a button on said form, double click on said button, and you'll see code pop up similar to what I said above.  I explained all of its components.
> 
> 
> If you want to skip learning the basics and go straight to web development then create an ASP.NET Web Forms project instead.



I'd love to learn the basics.. I just feel like what I got in that post is far from them as literally it's like looking at a foreign language.


----------



## ShiBDiB (Jan 9, 2015)

Right now I want to make a embed-able application that can do what is simple on a spreadsheet (get a price based off variables). Baby steps... Visual studio web forms now has me messing with html, css, and randomly placed buttons that i dont know how to link or get to do what I want


----------



## FordGT90Concept (Jan 9, 2015)

See my edit.  You'll need to familiarize yourself with HTML first.  W3Schools.com is a good place to learn the basics.  You'll need the HTML, HEAD, BODY, SELECT, and OPTION.  If you want to keep it tabular format, you'll also need TABLE, TR (table row), and TD (table division).   The whole list of them is available here: http://www.w3schools.com/tags/default.asp

Once you have your HTML document nice and tidy, you'll need to inject the JavaScript code to make it work.


----------



## ShiBDiB (Jan 9, 2015)

I.. need a nap.. Haha I've never been more confused about something computer related than I am right now. The issue with the google doc is it can't be used by than 1 person at a time.. That's the primary reason I want to do this. But it's starting to seem easier to just deal with it rather than learn random languages I might not even need for my degree.

I appreciate the help but it's like your throwing parts at me with no way of linking any of it to a bigger idea.


----------



## HalfAHertz (Jan 9, 2015)

FordGT90Concept said:


> Install Visual Studio Express, create a new Visual Basic Windows Forms application, create a button on said form, double click on said button, and you'll see code pop up similar to what I said above.  I explained all of its components.
> 
> 
> You should probably go with HTML + JavaScript.  I would pass on Visual Studio and Python.
> ...


If you want some kind of a graphic interface online, then yea python is probably not a good idea.


----------



## FordGT90Concept (Jan 9, 2015)

ShiBDiB said:


> But it's starting to seem easier to just deal with it rather than learn random languages I might not even need for my degree.


You should be able to ask what languages your CIS degree will cover.


Visual Studio takes care of virtually all the JavaScript but you still need to be familiar with HTML, VB.NET or C#.NET, and ASP.NET.  The ASP.NET compiler takes care of the JavaScript that is necessary to execute the page client-side and a DLL executes the server-side code.  For a task this simple, I'd still argue HTML and JavaScript would be best because using .NET, you need to familiarize yourself with a lot.

To put it into context, this should be doable in less than 50 lines of HTML/JavaScript.  It would take a lot more than that to do it in ASP.NET because you'd have to author a master (template) page, the page that is viewable, and the code behind that makes it work.  That also completely disregards all of the JavaScript ASP.NET imports behind the scenes.


----------



## Blue-Knight (Jan 9, 2015)

ShiBDiB said:


> I'd love to learn the basics.


If you want to learn the basics, then I would recommend learning the basics (for beginners):
Basics (site 1)
Basics 2 (site 2, download the book from the site)
Basics 3 (site 3, download the book from the site)
Basics 4 (site 4)

Learn the basics of programming and how computer program really works and it will be much easier to understand and learn high level languages.

Starting with a high level language and not knowing how that actually worked was the biggest mistake I made in my programming life.

I eventually had to learn all that anyway, it is a thing you will not escape (and you should not).

I am just sharing my experience with programming. Other people may disagree, but that was true for me.

Good luck!


----------



## Sasqui (Jan 9, 2015)

FordGT90Concept said:


> Be specific.



Sounds like @ShiBDiB needs some context.  I actually appreciated that post, as I've got quite a bit of older visual basic experience (not .NET tho)

Microsoft has a good site for complete beginners:  http://msdn.microsoft.com/library/xk24xdbe(v=vs.90).aspx

VB is the way to go if you are new and trying to customize applications like MS Office and many others that have an interface (API) to do that.


----------



## hellrazor (Jan 9, 2015)

HammerON said:


> Sub'd for curiosity as I have been interested in basic programming as well but no nothing....


Learn Python, it'll teach you good design.

Also, grammar mistakes will get you everywhere you don't want to be.


----------



## Ahhzz (Jan 9, 2015)

*sigh* I remember programming in Basic BASIC.... gone are the "good ole days" of Peeking and poking, and gosubs, and returns....


----------



## xvi (Jan 9, 2015)

Ahhzz said:


> *sigh* I remember programming in Basic BASIC.... gone are the "good ole days" of Peeking and poking, and gosubs, and returns....


10 PRINT "Home"
20 PRINT "Sweet"
30 GOTO 10

Y'know, there are emulators for that kind of stuff.


----------



## Ahhzz (Jan 9, 2015)

xvi said:


> 10 PRINT "Home"
> 20 PRINT "Sweet"
> 30 GOTO 10
> 
> Y'know, there are emulators for that kind of stuff.


Oh.
My.
God.....


A C64... my first baby.... tape drive and all....


back later, hacking  CompuServe.....


----------



## Schmuckley (Jan 9, 2015)

VB,C++,assembly
BASIC isn't used anymore.


----------



## Aquinus (Jan 10, 2015)

Schmuckley said:


> VB,C++,assembly
> BASIC isn't used anymore.


I think he means he wants to do some basic (simple) programming, not necessarily using a form of BASIC.
VB is a terrible idea, C# is the most worth-while CLR language to learn as its grammar and syntax are almost identical to most languages that end statements with semi-colons.

For learning how to program, starting with a scripting language like Python (as others have suggested,) or with Ruby might be a better starting point. Languages like Java, C#, and C/C++ require a deeper understanding of how the computer works since you're starting to get closer to hardware. Languages like Ruby and Python will get you into good habits without making everything too difficult. PHP theoretically could be lumped together with Python and Ruby, but generally speaking it's a bad language to start with since it lets you do some *very* stupid things.


----------



## rooivalk (Jan 27, 2015)

Aquinus said:


> I think he means he wants to do some basic (simple) programming, not necessarily using a form of BASIC.
> VB is a terrible idea, C# is the most worth-while CLR language to learn as its grammar and syntax are almost identical to most languages that end statements with semi-colons.
> 
> For learning how to program, starting with a scripting language like Python (as others have suggested,) or with Ruby might be a better starting point. Languages like Java, C#, and C/C++ require a deeper understanding of how the computer works since you're starting to get closer to hardware. Languages like Ruby and Python will get you into good habits without making everything too difficult. PHP theoretically could be lumped together with Python and Ruby, but generally speaking it's a bad language to start with since it lets you do some *very* stupid things.


You're correct if the thread starter want to:
- learn basic programming with intention as a start line for learning even deeper or diverse
- learn good habit of programming
- have a lot of time to spare

If the goal is just one or two simple projects, not intended for full-on profession, I think it's better to learn those 'stupid' languages (VB or PHP) instead due to:
- shorter learning curve (it's kinda the easiest one)
- more forgiving - which stupid from another point of view but I'd argue he isn't doing extremely complex programming, so the debugging/error will be minimal.
- be productive in short time may encourage him to do more


----------



## Aquinus (Jan 27, 2015)

rooivalk said:


> If the goal is just one or two simple projects, not intended for full-on profession, I think it's better to learn those 'stupid' languages (VB or PHP) instead due to:
> - shorter learning curve (it's kinda the easiest one)
> - more forgiving - which stupid from another point of view but I'd argue he isn't doing extremely complex programming, so the debugging/error will be minimal.
> - be productive in short time may encourage him to do more


Yes, but long term it could be demotivational because PHP doesn't enforce good programming practices. As a new dev, you might write a bunch of code but not know what's going on because PHP lets you do some pretty funky things. I can only recommend PHP if the web is where you plan on dev'ing and even then, PHP isn't an ending point. I have a special place in my heart for PHP. I love it because you can pump stuff out quick. I hate it because it easily can become a mess to manage.

I think VB is a better option than PHP because it's strongly typed and requires explicit type casts unlike PHP which is loosely typed. So in a CLR language, 1 + "1" would through an error, whereas in PHP: 1 + "1" would = 2 and is legitimate. Things like that make you consider the argument a little more where in PHP, you might not even stop to think if something is a string, an integer, or a float.

Now, if someone is interested in Web, I think Ruby is one of the best language to start with. Pair that with something like Sinatra, and you have a very simple web server that is very easy to understand and very easy to start with.

http://www.sinatrarb.com/

Edit: I agree with all your first points though. I do think anyone first starting is going to have a lot to learn, so time is a necessity.


----------



## FordGT90Concept (Jan 29, 2015)

Aquinus said:


> So in a CLR language, 1 + "1" would through an error, whereas in PHP: 1 + "1" would = 2 and is legitimate.


You're wrong there:

```
Module Module1
    Sub Main()
        Console.WriteLine(1 + "1") ' 2
        Console.ReadKey()
    End Sub
End Module
```
.NET automatically tries to convert "1" to Double and it succeeds.  Now, if it was "a1" making that conversion invalid, it would fail at runtime.


----------



## Aquinus (Jan 29, 2015)

FordGT90Concept said:


> You're wrong there:
> 
> ```
> Module Module1
> ...



I stand corrected. It's strictly typed by it does type casts for you. Was that still the case 6 years ago? It's been a while since I've really written any C# or VB.

Doing something like this in Ruby or Python will actually type error because an explicit cast is required by the language. PHP is even more weird because the order can determine the cast, making addition not commutative between distinct types, JS is similar to PHP in that respect as well.


----------



## Easy Rhino (Jan 29, 2015)

FordGT90Concept said:


> .NET automatically tries to convert "1" to Double and it succeeds.  Now, if it was "a1" making that conversion invalid, it would fail at runtime.



Why would anyone find that useful? "1" should never equal 1.


----------



## Ahhzz (Jan 29, 2015)

Oooonnneeeee!!! Is the loneliest number....


----------



## Aquinus (Jan 29, 2015)

Easy Rhino said:


> Why would anyone find that useful? "1" should never equal 1.


His point was to say that I was wrong, which I was. However, if you actually ever do something like this...



 
https://www.destroyallsoftware.com/talks/wat


----------



## FordGT90Concept (Jan 29, 2015)

Aquinus said:


> I stand corrected. It's strictly typed by it does type casts for you. Was that still the case 6 years ago? It's been a while since I've really written any C# or VB.


In C#, + is concatenation when there is a string involved; + is additive when there is numeric types involved so...

```
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(1 + "1"); // 11
            Console.ReadKey();
        }
    }
}
```
There is no way to make 1 + "1" = 2 in C# without explicitly converting "1" to a numeric type.

VB 1 & "1" == C# 1 + "1"
VB 1 + "1" == C# 1 + Convert.ToInt32("1")

One could create a C# overloads so that integer + string attempts to add like VB but not much point in doing that.


----------



## krimetal (Jan 29, 2015)

In C#, 1+"1" would be 11, a integer  and a string are not added, are concatenated. + sign represents concatenations, the integer is converted to a string.


----------



## ntgamers (Apr 7, 2015)

Some real advice ignoring what everyone else has said is to find something you are actually interested in working on, choose the language that fits the best features that meet the project that you want to work on's needs. Your goal shouldn't be to learn programming, your goal should be to complete a programming project that you would find enjoyable to work on everything else will come in due time.


----------

