topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday November 5, 2024, 12:59 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: I'm thinking about learning how to program.  (Read 39519 times)

Renegade

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 13,291
  • Tell me something you don't know...
    • View Profile
    • Renegade Minds
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #25 on: October 27, 2010, 09:37 PM »
Well, I just finished booking air tickets to Vietnam, and thought I'd write a little program to illustrate some simple concepts and have some fun. Hopefully this will prove to be both fun and educational in starting to learn how to program in C#! :D

It should also prove just how fast and productive C# is, because you can create an entire online air ticket booking system in only a few minutes and in less than 100 lines of code! See! C# ROCKS~! :P

What I've come up with is a program that perfectly mimics what I get from the Quantas online air ticket reservation system. Oh, did I mention that I'm flying with Singapore air? ;)

The project is a very simple console application that demonstrates the use of:

  • while
  • WriteLine
  • ReadLine
  • if... then... else...
  • string.ToLower()
  • string.Substring(startAtIndex, length)
  • the "+=" addition operator

Code: C# [Select]
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ReserveQuantasTickets
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int price = 450;
  13.             while (true) // This perfectly mimics the functionality of the Quantas online ticket reservation system.
  14.             {
  15.                 Console.WriteLine("********************************************************");
  16.                 Console.WriteLine("******** Welcome to Quantas flight booking *************");
  17.                 Console.WriteLine("********************************************************");
  18.                 Console.WriteLine("Please enter your name the press Enter."); // User-friendly communications
  19.                 if (UserIsFedUp()) break;  // Notice that we don't actually store the name as it is unimportant.
  20.                 Console.WriteLine("Please enter your point of departure.");
  21.                 if (UserIsFedUp()) break;  // Notice that the departure point is also unimportant.
  22.                 Console.WriteLine("Please enter your destination.");
  23.                 if (UserIsFedUp()) break;  // Notice that the destination is also unimportant.
  24.                 Console.WriteLine("Please enter your departure date.");
  25.                 if (UserIsFedUp()) break;  // Notice that the departure date is also unimportant.
  26.                 Console.WriteLine("Please enter your return date.");
  27.                 if (UserIsFedUp()) break;  // Notice that the return date is also unimportant.
  28.                 Console.WriteLine("Please enter your departure date.");
  29.                 if (UserIsFedUp()) break;  // Notice that the departure date is also unimportant.
  30.                 Console.WriteLine(string.Format("Your tickets will cost: {0}", price+=50)); // Notice that we don't care about anything other than increasing the price.
  31.                 Console.WriteLine("Press Enter to proceed to payment...");
  32.                 if (UserIsFedUp()) break;
  33.                 // The following is the actual error from the Quantas web site.
  34.                 Console.WriteLine("Please review the following items");
  35.                 Console.WriteLine("* We are unable to confirm the fare for the flights you have selected. Please cancel these segments and choose a different fare or flights and resubmit your confirmation request. (15012)");
  36.                 Console.WriteLine("Press Enter to \"Start over\"");
  37.                 if (UserIsFedUp()) break;
  38.             }
  39.         }
  40.  
  41.         private static bool UserIsFedUp() // Notice that this is static.
  42.         {
  43.             if (Console.ReadLine().ToLower().Substring(0, 8) == "expletive") // Make sure to allow for exclamation marks.
  44.             {
  45.                 return true;
  46.             }
  47.             else
  48.             {
  49.                 return false;
  50.             }
  51.         }
  52.     }
  53. }

:D

* ReserveQuantasTickets.zip (41.35 kB - downloaded 209 times.)
Slow Down Music - Where I commit thought crimes...

Freedom is the right to be wrong, not the right to do wrong. - John Diefenbaker

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,913
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #26 on: October 27, 2010, 10:04 PM »
 ;D ;D ;D ;D

Perry Mowbray

  • N.A.N.Y. Organizer
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 1,817
    • View Profile
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #27 on: October 27, 2010, 11:15 PM »
What I've come up with is a program that perfectly mimics what I get from the Quantas online air ticket reservation system.

...our national airline are a self-centered bunch: there is no "u" in QANTAS  :)

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • View Profile
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #28 on: October 28, 2010, 07:17 AM »
Cute!

Also, since you're just beginning with C#, I'll point out that often-times the boilerplate code inserts using lines that you don't need.  In your program, you should be able to delete the following two lines without problems:

using System.Collections.Generic;
using System.Linq;

phitsc

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 1,198
    • View Profile
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #29 on: October 28, 2010, 07:27 AM »
Cute!

Also, since you're just beginning with C#, I'll point out that often-times the boilerplate code inserts using lines that you don't need.  In your program, you should be able to delete the following two lines without problems:

using System.Collections.Generic;
using System.Linq;

That depends on if he's using any generic collections or LINQ ;). Better: right-click anywhere in your C# code file, select 'Organize Usings', then 'Remove and Sort'.

Renegade

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 13,291
  • Tell me something you don't know...
    • View Profile
    • Renegade Minds
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #30 on: October 28, 2010, 07:28 AM »
Silly me...

Code: C# [Select]
  1. private static bool UserIsFedUp() // Notice that this is static.
  2.         {
  3.             string input = Console.ReadLine();
  4.             if (input.Length >= 8)
  5.             {
  6.                 if (input.ToLower().Substring(0, 8) == "********") // Make sure to allow for exclamation marks.
  7.                 {
  8.                     return true;
  9.                 }
  10.             }
  11.             return false;
  12.         }

That's better.

Also, you can comment out "using System.Text;" as well.

"string" is in the System namespace, not the System.Text namespace.

Slow Down Music - Where I commit thought crimes...

Freedom is the right to be wrong, not the right to do wrong. - John Diefenbaker

Renegade

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 13,291
  • Tell me something you don't know...
    • View Profile
    • Renegade Minds
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #31 on: October 28, 2010, 07:33 AM »
That depends on if he's using any generic collections or LINQ ;). Better: right-click anywhere in your C# code file, select 'Organize Usings', then 'Remove and Sort'.

Good point.

Another thing to take notice of is the plethora of fantastic tools you get in your context menu in Visual Studio.

One that I particularly love is the refactoring.

Refactor > Encapsulate field is really useful.

You right-click on the first line, use that, then you get 5 lines for free!

Code: C# [Select]
  1. private string _something;
  2.  
  3.         public string Something
  4.         {
  5.             get { return _something; }
  6.             set { _something = value; }
  7.         }

There's just no end to the goodies in VS~! :D


Slow Down Music - Where I commit thought crimes...

Freedom is the right to be wrong, not the right to do wrong. - John Diefenbaker

mahesh2k

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,426
    • View Profile
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #32 on: October 29, 2010, 12:36 AM »
 ;D  ;D

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,913
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #33 on: October 29, 2010, 07:49 AM »
Another thing to take notice of is the plethora of fantastic tools you get in your context menu in Visual Studio.


It's hard for me to imagine any new learner being anything but negatively impacted by all of the plethora of tools and commands in Visual Studio.  I've been programming for 30 years and i still find these super powerful IDEs a bit overwhelming and distracting.. If you're just starting out learning how to program you might be better off using a simple text editor for your code, and focusing on the language itself and not trying to master a complex development editor/tool at the same time.

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 11,188
    • View Profile
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #34 on: October 29, 2010, 08:22 AM »
Another thing to take notice of is the plethora of fantastic tools you get in your context menu in Visual Studio.


It's hard for me to imagine any new learner being anything but negatively impacted by all of the plethora of tools and commands in Visual Studio.  I've been programming for 30 years and i still find these super powerful IDEs a bit overwhelming and distracting.. If you're just starting out learning how to program you might be better off using a simple text editor for your code, and focusing on the language itself and not trying to master a complex development editor/tool at the same time.

It really depends on your focus, IMO.  Use what you need should be the mantra.  I've never used a lot of the tools in the VS IDE, but they don't negatively impact me; as I want to use a new tool, I add it to my repertoire.  The big thing for me is the fact that everything you need is included; you don't have to set up different moving parts to be productive.  Install one package, open the IDE, create a new project, and click run.  You'll get something.  No errors, or anything.  It won't be anything but an empty form, but the point is, you're now at the point of programming, with none of the configuration frustration.  I remember that being the biggest obstacle when I first started programming... all of the moving parts you had to get put together.  And if you're learning on your own, that can be pretty daunting.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #35 on: October 29, 2010, 11:56 AM »
Another thing to take notice of is the plethora of fantastic tools you get in your context menu in Visual Studio.


It's hard for me to imagine any new learner being anything but negatively impacted by all of the plethora of tools and commands in Visual Studio.  I've been programming for 30 years and i still find these super powerful IDEs a bit overwhelming and distracting.. If you're just starting out learning how to program you might be better off using a simple text editor for your code, and focusing on the language itself and not trying to master a complex development editor/tool at the same time.

I have to agree with that.  For first programming you should be getting the logic, syntax and how function calls, subroutines work. In gwBasic the only "advanced tool" in the editor was automatic line numbering.  Once you have the hang of getting programs to do what you want using comparisons and other tests and branching, then it's time to find out you really have only scratched the surface.  Unfortunately it's not like The Matrix where the stuff can just be downloaded into your head. It takes a while to absorb it.

It's easy to forget that coming from outside programming, you think there is some real correlation between what you see and what happens in the machine.  You don't realize to some extent it's an illusion created by the programmer(the error message doesn't have to say "file not found" it could say "jeez are you dumb or what?" etc...)  The correlations that seem real are just maintained by consistent practices.

« Last Edit: October 29, 2010, 12:00 PM by MilesAhead »

Stoic Joker

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 6,649
    • View Profile
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #36 on: October 29, 2010, 02:44 PM »
It's hard for me to imagine any new learner being anything but negatively impacted by all of the plethora of tools and commands in Visual Studio.  I've been programming for 30 years and i still find these super powerful IDEs a bit overwhelming and distracting.. If you're just starting out learning how to program you might be better off using a simple text editor for your code, and focusing on the language itself and not trying to master a complex development editor/tool at the same time.

That's why I strip the VS UI down to just the basic main menu (no toolbars), the project window, and the code I'm working on. Build window pops up during compile then sinks back out of the way.

Me like simple clean interface.

Renegade

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 13,291
  • Tell me something you don't know...
    • View Profile
    • Renegade Minds
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #37 on: October 29, 2010, 07:37 PM »
Another thing to take notice of is the plethora of fantastic tools you get in your context menu in Visual Studio.


It's hard for me to imagine any new learner being anything but negatively impacted by all of the plethora of tools and commands in Visual Studio.  I've been programming for 30 years and i still find these super powerful IDEs a bit overwhelming and distracting.. If you're just starting out learning how to program you might be better off using a simple text editor for your code, and focusing on the language itself and not trying to master a complex development editor/tool at the same time.

I'm with wraith808 on this one.

I keep the properties and solution panes open all the time, but my build, output, error, tools, data connections, and all the other panes hide away until I need them. I'll pin the tools pane when I'm doing UI work, which is convenient, but usually it's hidden in a tab at the side of the IDE.

I've got a few toolbars open, but nothing that's really distracting.

And it's pretty much exactly as the VS default install!

Now, there are a trillion tools available, but it's like being a kid on an adventure through a candy store~!

The menus are well organized and things are easy to find.

Intellisense is wonderful.

There is one problem with VS 2010 though... A serious problem... A very sad, deeply saddening problem... Dynamic Help is gone.

If you can get VS 2008 or 2005, do it. Dynamic Help was about the best computing teacher one could ever hope for.  It would sense where you were inside your code, and list in a pane for you all the different relevant help topics. It was stupidly awesome. I feel dumber just knowing that it is gone in VS 2010.

It really was that good. You could just glance at it and there was so much useful information there. Or, you could type in your IDE something, and the answer would appear in the Dynamic Help pane.

It was the most underrated feature of VS, and for a new programmer, it was just the best.

Do look for a VS 2008 or 2005 version though. It will reduce your learning curve by half at least.

Oooops... Back on topic now...

I think that at the end of the day, if you're just starting out, the tools in VS (especially 2005/2008) will help you learn faster. A simple text editor will leave everything up to you, along with all the BS nonsense that nobody should ever even look at, much less code out by hand.

This is the kind of stuff I mean:

Wiring Up UI Code (mindnumbingly boring and repetitive):
Code: C# [Select]
  1. namespace SslTest
  2. {
  3.     partial class Form1
  4.     {
  5.         /// <summary>
  6.         /// Required designer variable.
  7.         /// </summary>
  8.         private System.ComponentModel.IContainer components = null;
  9.  
  10.         /// <summary>
  11.         /// Clean up any resources being used.
  12.         /// </summary>
  13.         /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  14.         protected override void Dispose(bool disposing)
  15.         {
  16.             if (disposing && (components != null))
  17.             {
  18.                 components.Dispose();
  19.             }
  20.             base.Dispose(disposing);
  21.         }
  22.  
  23.         #region Windows Form Designer generated code
  24.  
  25.         /// <summary>
  26.         /// Required method for Designer support - do not modify
  27.         /// the contents of this method with the code editor.
  28.         /// </summary>
  29.         private void InitializeComponent()
  30.         {
  31.             this.textBox1 = new System.Windows.Forms.TextBox();
  32.             this.label1 = new System.Windows.Forms.Label();
  33.             this.label2 = new System.Windows.Forms.Label();
  34.             this.textBox2 = new System.Windows.Forms.TextBox();
  35.             this.label3 = new System.Windows.Forms.Label();
  36.             this.textBox3 = new System.Windows.Forms.TextBox();
  37.             this.label4 = new System.Windows.Forms.Label();
  38.             this.textBox4 = new System.Windows.Forms.TextBox();
  39.             this.label5 = new System.Windows.Forms.Label();
  40.             this.textBox5 = new System.Windows.Forms.TextBox();
  41.             this.label6 = new System.Windows.Forms.Label();
  42.             this.textBox6 = new System.Windows.Forms.TextBox();
  43.             this.label7 = new System.Windows.Forms.Label();
  44.             this.textBox7 = new System.Windows.Forms.TextBox();
  45.             this.label8 = new System.Windows.Forms.Label();
  46.             this.textBox8 = new System.Windows.Forms.TextBox();
  47.             this.label9 = new System.Windows.Forms.Label();
  48.             this.textBox9 = new System.Windows.Forms.TextBox();
  49.             this.label10 = new System.Windows.Forms.Label();
  50.             this.textBox10 = new System.Windows.Forms.TextBox();
  51.             this.btnDoCert = new System.Windows.Forms.Button();
  52.             this.SuspendLayout();
  53.             //
  54.             // textBox1
  55.             //
  56.             this.textBox1.Location = new System.Drawing.Point(96, 75);
  57.             this.textBox1.Name = "textBox1";
  58.             this.textBox1.Size = new System.Drawing.Size(184, 20);
  59.             this.textBox1.TabIndex = 0;
  60.             //
  61.             // label1
  62.             //
  63.             this.label1.AutoSize = true;
  64.             this.label1.Location = new System.Drawing.Point(12, 78);
  65.             this.label1.Name = "label1";
  66.             this.label1.Size = new System.Drawing.Size(35, 13);
  67.             this.label1.TabIndex = 1;
  68.             this.label1.Text = "label1";
  69.             //
  70.             // label2
  71.             //
  72.             this.label2.AutoSize = true;
  73.             this.label2.Location = new System.Drawing.Point(12, 104);
  74.             this.label2.Name = "label2";
  75.             this.label2.Size = new System.Drawing.Size(35, 13);
  76.             this.label2.TabIndex = 3;
  77.             this.label2.Text = "label2";
  78.             //
  79.             // textBox2
  80.             //
  81.             this.textBox2.Location = new System.Drawing.Point(96, 101);
  82.             this.textBox2.Name = "textBox2";
  83.             this.textBox2.Size = new System.Drawing.Size(184, 20);
  84.             this.textBox2.TabIndex = 2;
  85.             //
  86.             // label3
  87.             //
  88.             this.label3.AutoSize = true;
  89.             this.label3.Location = new System.Drawing.Point(12, 130);
  90.             this.label3.Name = "label3";
  91.             this.label3.Size = new System.Drawing.Size(35, 13);
  92.             this.label3.TabIndex = 5;
  93.             this.label3.Text = "label3";
  94.             //
  95.             // textBox3
  96.             //
  97.             this.textBox3.Location = new System.Drawing.Point(96, 127);
  98.             this.textBox3.Name = "textBox3";
  99.             this.textBox3.Size = new System.Drawing.Size(184, 20);
  100.             this.textBox3.TabIndex = 4;
  101.             //
  102.             // label4
  103.             //
  104.             this.label4.AutoSize = true;
  105.             this.label4.Location = new System.Drawing.Point(12, 156);
  106.             this.label4.Name = "label4";
  107.             this.label4.Size = new System.Drawing.Size(35, 13);
  108.             this.label4.TabIndex = 7;
  109.             this.label4.Text = "label4";
  110.             //
  111.             // textBox4
  112.             //
  113.             this.textBox4.Location = new System.Drawing.Point(96, 153);
  114.             this.textBox4.Name = "textBox4";
  115.             this.textBox4.Size = new System.Drawing.Size(184, 20);
  116.             this.textBox4.TabIndex = 6;
  117.             //
  118.             // label5
  119.             //
  120.             this.label5.AutoSize = true;
  121.             this.label5.Location = new System.Drawing.Point(12, 182);
  122.             this.label5.Name = "label5";
  123.             this.label5.Size = new System.Drawing.Size(35, 13);
  124.             this.label5.TabIndex = 9;
  125.             this.label5.Text = "label5";
  126.             //
  127.             // textBox5
  128.             //
  129.             this.textBox5.Location = new System.Drawing.Point(96, 179);
  130.             this.textBox5.Name = "textBox5";
  131.             this.textBox5.Size = new System.Drawing.Size(184, 20);
  132.             this.textBox5.TabIndex = 8;
  133.             //
  134.             // label6
  135.             //
  136.             this.label6.AutoSize = true;
  137.             this.label6.Location = new System.Drawing.Point(12, 208);
  138.             this.label6.Name = "label6";
  139.             this.label6.Size = new System.Drawing.Size(35, 13);
  140.             this.label6.TabIndex = 11;
  141.             this.label6.Text = "label6";
  142.             //
  143.             // textBox6
  144.             //
  145.             this.textBox6.Location = new System.Drawing.Point(96, 205);
  146.             this.textBox6.Name = "textBox6";
  147.             this.textBox6.Size = new System.Drawing.Size(184, 20);
  148.             this.textBox6.TabIndex = 10;
  149.             //
  150.             // label7
  151.             //
  152.             this.label7.AutoSize = true;
  153.             this.label7.Location = new System.Drawing.Point(12, 234);
  154.             this.label7.Name = "label7";
  155.             this.label7.Size = new System.Drawing.Size(35, 13);
  156.             this.label7.TabIndex = 13;
  157.             this.label7.Text = "label7";
  158.             //
  159.             // textBox7
  160.             //
  161.             this.textBox7.Location = new System.Drawing.Point(96, 231);
  162.             this.textBox7.Name = "textBox7";
  163.             this.textBox7.Size = new System.Drawing.Size(184, 20);
  164.             this.textBox7.TabIndex = 12;
  165.             //
  166.             // label8
  167.             //
  168.             this.label8.AutoSize = true;
  169.             this.label8.Location = new System.Drawing.Point(12, 260);
  170.             this.label8.Name = "label8";
  171.             this.label8.Size = new System.Drawing.Size(35, 13);
  172.             this.label8.TabIndex = 15;
  173.             this.label8.Text = "label8";
  174.             //
  175.             // textBox8
  176.             //
  177.             this.textBox8.Location = new System.Drawing.Point(96, 257);
  178.             this.textBox8.Name = "textBox8";
  179.             this.textBox8.Size = new System.Drawing.Size(184, 20);
  180.             this.textBox8.TabIndex = 14;
  181.             //
  182.             // label9
  183.             //
  184.             this.label9.AutoSize = true;
  185.             this.label9.Location = new System.Drawing.Point(12, 286);
  186.             this.label9.Name = "label9";
  187.             this.label9.Size = new System.Drawing.Size(35, 13);
  188.             this.label9.TabIndex = 17;
  189.             this.label9.Text = "label9";
  190.             //
  191.             // textBox9
  192.             //
  193.             this.textBox9.Location = new System.Drawing.Point(96, 283);
  194.             this.textBox9.Name = "textBox9";
  195.             this.textBox9.Size = new System.Drawing.Size(184, 20);
  196.             this.textBox9.TabIndex = 16;
  197.             //
  198.             // label10
  199.             //
  200.             this.label10.AutoSize = true;
  201.             this.label10.Location = new System.Drawing.Point(12, 312);
  202.             this.label10.Name = "label10";
  203.             this.label10.Size = new System.Drawing.Size(41, 13);
  204.             this.label10.TabIndex = 19;
  205.             this.label10.Text = "label10";
  206.             //
  207.             // textBox10
  208.             //
  209.             this.textBox10.Location = new System.Drawing.Point(96, 309);
  210.             this.textBox10.Name = "textBox10";
  211.             this.textBox10.Size = new System.Drawing.Size(184, 20);
  212.             this.textBox10.TabIndex = 18;
  213.             //
  214.             // btnDoCert
  215.             //
  216.             this.btnDoCert.Location = new System.Drawing.Point(96, 336);
  217.             this.btnDoCert.Name = "btnDoCert";
  218.             this.btnDoCert.Size = new System.Drawing.Size(75, 23);
  219.             this.btnDoCert.TabIndex = 20;
  220.             this.btnDoCert.Text = "Do Cert";
  221.             this.btnDoCert.UseVisualStyleBackColor = true;
  222.             //
  223.             // Form1
  224.             //
  225.             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
  226.             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  227.             this.ClientSize = new System.Drawing.Size(619, 458);
  228.             this.Controls.Add(this.btnDoCert);
  229.             this.Controls.Add(this.label10);
  230.             this.Controls.Add(this.textBox10);
  231.             this.Controls.Add(this.label9);
  232.             this.Controls.Add(this.textBox9);
  233.             this.Controls.Add(this.label8);
  234.             this.Controls.Add(this.textBox8);
  235.             this.Controls.Add(this.label7);
  236.             this.Controls.Add(this.textBox7);
  237.             this.Controls.Add(this.label6);
  238.             this.Controls.Add(this.textBox6);
  239.             this.Controls.Add(this.label5);
  240.             this.Controls.Add(this.textBox5);
  241.             this.Controls.Add(this.label4);
  242.             this.Controls.Add(this.textBox4);
  243.             this.Controls.Add(this.label3);
  244.             this.Controls.Add(this.textBox3);
  245.             this.Controls.Add(this.label2);
  246.             this.Controls.Add(this.textBox2);
  247.             this.Controls.Add(this.label1);
  248.             this.Controls.Add(this.textBox1);
  249.             this.Name = "Form1";
  250.             this.Text = "Form1";
  251.             this.Load += new System.EventHandler(this.Form1_Load);
  252.             this.ResumeLayout(false);
  253.             this.PerformLayout();
  254.  
  255.         }
  256.  
  257.         #endregion
  258.  
  259.         private System.Windows.Forms.TextBox textBox1;
  260.         private System.Windows.Forms.Label label1;
  261.         private System.Windows.Forms.Label label2;
  262.         private System.Windows.Forms.TextBox textBox2;
  263.         private System.Windows.Forms.Label label3;
  264.         private System.Windows.Forms.TextBox textBox3;
  265.         private System.Windows.Forms.Label label4;
  266.         private System.Windows.Forms.TextBox textBox4;
  267.         private System.Windows.Forms.Label label5;
  268.         private System.Windows.Forms.TextBox textBox5;
  269.         private System.Windows.Forms.Label label6;
  270.         private System.Windows.Forms.TextBox textBox6;
  271.         private System.Windows.Forms.Label label7;
  272.         private System.Windows.Forms.TextBox textBox7;
  273.         private System.Windows.Forms.Label label8;
  274.         private System.Windows.Forms.TextBox textBox8;
  275.         private System.Windows.Forms.Label label9;
  276.         private System.Windows.Forms.TextBox textBox9;
  277.         private System.Windows.Forms.Label label10;
  278.         private System.Windows.Forms.TextBox textBox10;
  279.         private System.Windows.Forms.Button btnDoCert;
  280.     }
  281. }


Program initialization code that never changes for any program (Windows Forms that is):

Code: C# [Select]
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Windows.Forms;
  5.  
  6. namespace SslTest
  7. {
  8.     static class Program
  9.     {
  10.         /// <summary>
  11.         /// The main entry point for the application.
  12.         /// </summary>
  13.         [STAThread]
  14.         static void Main()
  15.         {
  16.             Application.EnableVisualStyles();
  17.             Application.SetCompatibleTextRenderingDefault(false);
  18.             Application.Run(new Form1());
  19.         }
  20.     }
  21. }


VS does all that stuff automatically for you, leaving you to get the real stuff done.

Now, if you're into programming for the sake of programming, by all means go for vi or emacs as your programming tool of choice. But if you want to play around more and get things working and done, then an IDE is much more productive.

FWIW, other IDEs are similar to VS and have much of the same functionality to get you up, running, and productive. e.g. intelli-J, Eclipse, NetBeans, MonoDevelop, SharpDevelop, etc. Lots of them out there.

They'll all take care of the mindnumbingly boring code like UI code and wiring up button events and things.

However, vi and emacs (or any bare bones text editor) will force you to go through a TON of excruciating pain that I would call cruel and unusual, BUT, you will learn more and you will learn the underlying concepts better.

I'd recommend trying out a few different IDEs and text editors and different languages to see what you like. You can get all the tools for free, so why not taste test them? :D
Slow Down Music - Where I commit thought crimes...

Freedom is the right to be wrong, not the right to do wrong. - John Diefenbaker

Renegade

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 13,291
  • Tell me something you don't know...
    • View Profile
    • Renegade Minds
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #38 on: October 29, 2010, 07:55 PM »
You might want to look at SharpDevelop => http://www.icsharpco...rce/SD/Features.aspx

It supports IronPython:

Supported Programming Languages

    * C# (Code Completion, Windows Forms Designer)
    * VB.NET (Code Completion, Windows Forms Designer)
    * Boo (Code Completion, Windows Forms Designer)
    * IronPython (Code Conversion, Windows Forms Designer, partial Code Completion)
    * IronRuby (Code Conversion, Windows Forms Designer)
    * F#
Slow Down Music - Where I commit thought crimes...

Freedom is the right to be wrong, not the right to do wrong. - John Diefenbaker

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,885
    • View Profile
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #39 on: October 30, 2010, 08:33 PM »
Another thing to take notice of is the plethora of fantastic tools you get in your context menu in Visual Studio.


It's hard for me to imagine any new learner being anything but negatively impacted by all of the plethora of tools and commands in Visual Studio.  I've been programming for 30 years and i still find these super powerful IDEs a bit overwhelming and distracting.. If you're just starting out learning how to program you might be better off using a simple text editor for your code, and focusing on the language itself and not trying to master a complex development editor/tool at the same time.

I felt that way about VS after having used an older Borland IDE (Delphi 6) exclusively. I actually thought that if I wanted to eventually move to C#, I was going to have to learn it first in a Borland IDE (UI already familiar enough to deal with) and then make the transition to using it in VS, so I wouldn't be complicating everything for myself by trying to learn 2 things at once. VS is scary looking compared to what I am used to...so are newer versions of Delphi, for that matter.

Renegade

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 13,291
  • Tell me something you don't know...
    • View Profile
    • Renegade Minds
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #40 on: October 30, 2010, 09:48 PM »
@ superboyac -- Have you tried anything out yet, or decided on what path you'd like to try out?
Slow Down Music - Where I commit thought crimes...

Freedom is the right to be wrong, not the right to do wrong. - John Diefenbaker

steeladept

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,061
    • View Profile
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #41 on: October 31, 2010, 04:14 AM »
I have fought with this since VS 2005.  Basically my problem with it is that the IDE is almost more complicated than the code.  I know it is just because I don't know how to use it, but I really need a "how to use Visual Studio" course.  Unfortunately everything is how to program C# or VB.  I don't care about how to program yet another video player.  I need to know how to accomplish certain tasks within the IDE.  I used TextPad for Java and that was just about right as far as complexity, but as Renegade pointed out, it is horrendous if you have to program a UI.  We used NetBeans for that, but even that was clunky at best.  I have had a project in mind for probably 5 years or more now, and even have the "engine" written in Java (It would be a simple task to change it to C# instead).  It is the UI and display that I really need to work with, but just can't find the starting point.

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 11,188
    • View Profile
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #42 on: October 31, 2010, 08:50 AM »
I have fought with this since VS 2005.  Basically my problem with it is that the IDE is almost more complicated than the code.  I know it is just because I don't know how to use it, but I really need a "how to use Visual Studio" course.  Unfortunately everything is how to program C# or VB.  I don't care about how to program yet another video player.  I need to know how to accomplish certain tasks within the IDE.  I used TextPad for Java and that was just about right as far as complexity, but as Renegade pointed out, it is horrendous if you have to program a UI.  We used NetBeans for that, but even that was clunky at best.  I have had a project in mind for probably 5 years or more now, and even have the "engine" written in Java (It would be a simple task to change it to C# instead).  It is the UI and display that I really need to work with, but just can't find the starting point.

Use the standard VS layout.  Get rid of most of the windows, other than the output window, error window, solution window, toolbox window, and properties window.  Dock them where ever you wish.  Profit. 

That's my point... there isn't much you *need* to use.  The basic layout has a couple more windows than I said (find and one more, I think), but they aren't necessary to program.  I came from Delphi 6/7 to VS 2005, and was up and running in no time... it's just a matter of focus, IMO.  You can get distracted by all the bells and whistles, but there's still stuff that I'm learning after being in it for 5 years or so.  I just pick it up as needed/wanted.

Renegade

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 13,291
  • Tell me something you don't know...
    • View Profile
    • Renegade Minds
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #43 on: October 31, 2010, 09:39 AM »
I just pick it up as needed/wanted.

+1! :)
Slow Down Music - Where I commit thought crimes...

Freedom is the right to be wrong, not the right to do wrong. - John Diefenbaker

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #44 on: October 31, 2010, 02:09 PM »
For a first programming language I think simpler is better. For Python,
print "Hello, World!"

Hello World program is as simple as it gets.
The environment should let you enter stuff like that as well as define classes etc. without a whole bunch of manual intervention. The main decision in Python editor I remember is Tab handling as it effects how sample code from online sites is imported.  The rest of it should be ok out of the box for starting out.  Focus on the programming language rather than the doo-dads.


MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #45 on: October 31, 2010, 02:38 PM »
btw as long as we are discussing first programming languages, there's nothing wrong with FreeBASIC. It runs on Dos, Linux and Windows. It can create stand-alone compiled win32 programs. Like Python, you can start with a simple print statement as a first program.

Has classes, but not inheritance. Does have user defined types.
Since it uses gas assembler you can compile very small stand-alone Win32 apps.  If you don't include a custom icon I'm talking less than 20 KB.

http://www.freebasic.net/index.php

Forum for guidance here:

http://www.freebasic.net/forum/

On Windows the default installer sets you up with FBIDE. It's really an editor with help set up so you can put the cursor on the first letter of a language keyword and press F1 to get help on Basic. It doesn't have any wizards or resource editors. Just some macros that let you set the compile command line etc..  You can run programs directly out of the editor.  A simple way to start.

The source code files are set up similar to C language in this incarnation of Basic in that you have .bas files for the code files and .bi files for header files. It comes with a whole bunch of Win32 headers so that you can make most of the needed WinAPI calls without having to manually LoadLibrary and get the function pointer etc.  Very nicely done.

« Last Edit: October 31, 2010, 02:43 PM by MilesAhead »

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 9,768
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #46 on: October 31, 2010, 02:47 PM »
I'm thinking about learning how to program.

Stop thinking about it and just do it.

steeladept

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,061
    • View Profile
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #47 on: October 31, 2010, 07:53 PM »
Use the standard VS layout.  Get rid of most of the windows, other than the output window, error window, solution window, toolbox window, and properties window.  Dock them where ever you wish.  Profit. 

That's my point... there isn't much you *need* to use.  The basic layout has a couple more windows than I said (find and one more, I think), but they aren't necessary to program.  I came from Delphi 6/7 to VS 2005, and was up and running in no time... it's just a matter of focus, IMO.  You can get distracted by all the bells and whistles, but there's still stuff that I'm learning after being in it for 5 years or so.  I just pick it up as needed/wanted.
I guess 4AM is not the best time to try and explain yourself  :P :-\  I meant more of the difference between options, for example.  It isn't like a typical text editor w/ some IDE-like facilities (nor should it be).  You don't just start it and start typing.  You have to set up a project, you have to define what kind of project it is (windows service, MVC, MVC2, etc.), you need to choose the language you will program in (VB vs. C#, etc), all before you even begin to think about typing code.  Once that is all set (which I don't even know the difference between most of these option or when and why to choose one over another), you then have a huge structure of folders and files that, though empty, exist for who knows what purpose(s).  Once everything is set up, or when editing previous code where these options are already set, I find VS a dream to work with (mostly - still have trouble wrapping my head around the code-behind paradigm), especially for refactoring, intellisense, and code completion; but getting to that point for new projects always stumps me.  Moreover, I don't know what I don't know, so using a tool "when I need to learn it" means I need to know it exists in the first place, which just isn't true.  That said, I do a LOT of web page design and updates using Visual Studio at work, so I do know a little about the interface, just not how to use most of it, or - as I already said - many (read most) of the potential functionality.  In the end, I always feel I am just "doing it the hard way" because I don't know of anything else.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,913
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #48 on: October 31, 2010, 07:58 PM »
C# is actually pretty good too -- it's been a while since i played around with it and having recently played with it some more i must say it would also be a good language to start with, and perhaps better than python if you are less interested in quick coding, and more interested in developing good Object Oriented Programming habits for larger projects.
« Last Edit: October 31, 2010, 08:10 PM by mouser »

superboyac

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 6,347
    • View Profile
    • Donate to Member
Re: I'm thinking about learning how to program.
« Reply #49 on: October 31, 2010, 08:06 PM »
C# is actually pretty good too -- it's been a while since i played around with it and i must say it would also be a good language, and perhaps better than python if you are less interested in quick coding, and more interested in developing good Object Oriented Programming habits for larger projects.
I think so.  I'm not in any rush.  i'm not even committed to the idea of becoming a legit programmer.  It's just that so many of my ideas are hindered by the fact that I'm not a programmer...both at work and personally.  So I figure if I get slowly started, maybe by the time I'm 40 or something, I'll have another really great tool under my belt.  It's really a long term plan I'm after.  I'm definitely NOT interested in just learning as an academic excercise or anything like that.  I'm at a point in my career and life that I need to focus on what it is I HAVE to do, and what I can pay others to do for me.  I'm in a sort of skills housekeeping phase right now.  i've amassed plenty of skills kind of indiscriminately over my life, and I'm now at a point where I have to just DO a lot of things.

This is kind of a weird little secret for me:  I want to get to a point in my life where I can have a programmer on-hire for myself or my company.  Someone I pay either a salary or some kind of on-going subscription kind of thing.  I'd go to that individual with my ideas and cartoons, sketches, etc. to turn into programs.  I know I'm good at that part, but the programming is really the meat of it and the thing I can't do yet.