Questions about re-introduction to programming
Results 1 to 10 of 10

Thread: Questions about re-introduction to programming

  1. #1
    Registered User Niclo Iste's Avatar
    Join Date
    Oct 2007
    Location
    Pgh, PA
    Posts
    2,051

    Question Questions about re-introduction to programming

    Ok so I took a class on the fundamentals of programming back in the days of 56k modems, so clearly, it's been a while. I'm contemplating java, and c or c++. I don't have time for taking a class and to be honest I'll be starting myself off with very simple programs and learning about other programs by deconstructing them and seeing how they were made or even tweaking them. What would be the best tools for the job? I was looking at open source and if need be I'll learn how to program off of my ubuntu machine. Basically what I want to know is what do I need for decompiling simple .exe files (if there is such a type of exe), compilers that are the most user friendly, and a good place to get information and examples of code. The end goal is to learn how to program and make my own or on demand basic software.

    P.S.
    Is it advisable to learn how to make GUIs? If so what do I need for that as well?
    One Script to rule them all.
    One Script to find them.
    One Script to bring them all,
    and clean up after itself.

  2. #2
    Driver Terrier NooNoo's Avatar
    Join Date
    Dec 2000
    Location
    UK
    Posts
    31,843
    Decompiling other people's code to learn is the wrong way to go about it. Everyone has a style and you need to develop your own first otherwise you are just learning how someone else codes.

    Eclipse is an opensource IDE which I found easy to use - I used it for my java assignments at uni. It comes in all flavours here just change the drop down for your OS

    PS GUIs are the hard part of any program - it's usually straight forward work out the algorithm and the rules the program must follow... but making it "user friendly" is the holy grail of any programmer. Just because it makes sense to you, doesn't mean it makes sense to someone else!
    Last edited by NooNoo; March 20th, 2012 at 02:47 PM.
    Never, ever approach a computer saying or even thinking "I will just do this quickly."

  3. #3
    Registered User Niclo Iste's Avatar
    Join Date
    Oct 2007
    Location
    Pgh, PA
    Posts
    2,051
    Thanks for the input NooNoo I get your point on the learning how someone else codes. However the conventional way of learning I don't do too well with. I tend to do better looking at a working setup and seeing how it was done. Naturally if there were a book/pdf that had that I'd be happy to look at it. I miss the way my old html book was set up. It had examples and a glossary of every command and what it did. I don't believe I've seen that in any books I've looked at in the past.

    I will check out the IDE tool you suggested and I did find a few links to open source compilers which I will try to get installed tonight so I can start tinkering.
    One Script to rule them all.
    One Script to find them.
    One Script to bring them all,
    and clean up after itself.

  4. #4
    Registered User CeeBee's Avatar
    Join Date
    Nov 2002
    Location
    USA
    Posts
    2,478
    I will disagree with NooNoo. Decompiling isn't the wrong way to learn, it's pretty much the impossible way. You're not even learning one programmer's style, you're observing how a compiler optimized the code.
    What you get back (if no obfuscator was used) isn't many times nearly close to the source code. Instead of any meaningful variable names you get some labels. You see the code flow as it was optimized by the compiler, not as it was written by the programmer to be readable.
    Simple example...
    Original code:
    PHP Code:
    switch(tran.BuySellIndicator)
            {
              case 
    Swift.TransactionType.BUY:
                    
    mySwift.MessageTypeCode Swift.MessageType.ReceiveAgainstPayment;

                    if (
    tran.Country == "AT"sw.Write(mySwift.GenerateTransaction_BL_AT(tran));
                    else if (
    tran.Country == "BE"sw.Write(mySwift.GenerateTransaction_BL_BE(tran));
                    else if (
    tran.Country == "DE"sw.Write(mySwift.GenerateTransaction_BL_DE(tran));
                    else if (
    tran.Country == "ES"sw.Write(mySwift.GenerateTransaction_BL_ES(tran));
                    else if (
    tran.Country == "FI"sw.Write(mySwift.GenerateTransaction_BL_FI(tran));
                    else if (
    tran.Country == "FR"sw.Write(mySwift.GenerateTransaction_BL_FR(tran));
                    else if (
    tran.Country == "GB"sw.Write(mySwift.GenerateTransaction_BL_UK(tran));
                    else if (
    tran.Country == "GR"sw.Write(mySwift.GenerateTransaction_BL_GR(tran));
                    else if (
    tran.Country == "IE"sw.Write(mySwift.GenerateTransaction_BL_IE(tran));
                    else if (
    tran.Country == "IT"sw.Write(mySwift.GenerateTransaction_BL_IT(tran));
                    else if (
    tran.Country == "JP"sw.Write(mySwift.GenerateTransaction_BL_JP(tran));
                    else if (
    tran.Country == "NL"sw.Write(mySwift.GenerateTransaction_BL_NL(tran));
                    else if (
    tran.Country == "PT"sw.Write(mySwift.GenerateTransaction_BL_PT(tran));
                    else if (
    tran.Country == "US"sw.Write(mySwift.GenerateTransaction_BL_US(tran));
                    else throw new 
    Exception("Unhandled country specified in BUY transaction");
                    break; 
    And the decompiled code:
    PHP Code:
    string CS$4$0002 tran.BuySellIndicator;
            if (
    CS$4$0002 != null)
            {
                if (
    CS$4$0002 == "BUY")
                {
                    
    this.mySwift.MessageTypeCode "541";
                    if (
    tran.Country != "AT")
                    {
                        if (
    tran.Country != "BE")
                        {
                            if (
    tran.Country != "DE")
                            {
                                if (
    tran.Country != "ES")
                                {
                                    if (
    tran.Country != "FI")
                                    {
                                        if (
    tran.Country != "FR")
                                        {
                                            if (
    tran.Country != "GB")
                                            {
                                                if (
    tran.Country != "GR")
                                                {
                                                    if (
    tran.Country != "IE")
                                                    {
                                                        if (
    tran.Country != "IT")
                                                        {
                                                            if (
    tran.Country != "JP")
                                                            {
                                                                if (
    tran.Country != "NL")
                                                                {
                                                                    if (
    tran.Country != "PT")
                                                                    {
                                                                        if (
    tran.Country != "US")
                                                                        {
                                                                            throw new 
    Exception("Unhandled country specified in BUY transaction");
                                                                        }
                                                                        
    sw.Write(this.mySwift.GenerateTransaction_BL_US(tran));
                                                                    }
                                                                    else
                                                                    {
                                                                        
    sw.Write(this.mySwift.GenerateTransaction_BL_PT(tran));
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    
    sw.Write(this.mySwift.GenerateTransaction_BL_NL(tran));
                                                                }
                                                            }
                                                            else
                                                            {
                                                                
    sw.Write(this.mySwift.GenerateTransaction_BL_JP(tran));
                                                            }
                                                        }
                                                        else
                                                        {
                                                            
    sw.Write(this.mySwift.GenerateTransaction_BL_IT(tran));
                                                        }
                                                    }
                                                    else
                                                    {
                                                        
    sw.Write(this.mySwift.GenerateTransaction_BL_IE(tran));
                                                    }
                                                }
                                                else
                                                {
                                                    
    sw.Write(this.mySwift.GenerateTransaction_BL_GR(tran));
                                                }
                                            }
                                            else
                                            {
                                                
    sw.Write(this.mySwift.GenerateTransaction_BL_UK(tran));
                                            }
                                        }
                                        else
                                        {
                                            
    sw.Write(this.mySwift.GenerateTransaction_BL_FR(tran));
                                        }
                                    }
                                    else
                                    {
                                        
    sw.Write(this.mySwift.GenerateTransaction_BL_FI(tran));
                                    }
                                }
                                else
                                {
                                    
    sw.Write(this.mySwift.GenerateTransaction_BL_ES(tran));
                                }
                            }
                            else
                            {
                                
    sw.Write(this.mySwift.GenerateTransaction_BL_DE(tran));
                            }
                        }
                        else
                        {
                            
    sw.Write(this.mySwift.GenerateTransaction_BL_BE(tran));
                        }
                    }
                    else
                    {
                        
    sw.Write(this.mySwift.GenerateTransaction_BL_AT(tran));
                    }
                    goto 
    Label_0A9D;
                } 
    And this is a *very simple* logic selection example...
    Protected by Glock. Don't mess with me!

  5. #5
    Registered User Niclo Iste's Avatar
    Join Date
    Oct 2007
    Location
    Pgh, PA
    Posts
    2,051
    Well that just sucks. On a side note, set up xubuntu and installing some C++ compilers. I'll see what I can figure out. BTW what's the difference functionally between C and C++?
    One Script to rule them all.
    One Script to find them.
    One Script to bring them all,
    and clean up after itself.

  6. #6
    Registered User CeeBee's Avatar
    Join Date
    Nov 2002
    Location
    USA
    Posts
    2,478
    Quote Originally Posted by Niclo Iste View Post
    BTW what's the difference functionally between C and C++?
    Differences are subtle for a beginner. c++ is an "extension" of c - so most c code will compile in c++.
    c++ is more object-orientated.
    In c it is extremely likely that you will have to use pointers heavily for any efficient data manipulation. Unfortunately pointers are a concept that is *very* hard to grasp for many beginners.
    Last edited by CeeBee; March 21st, 2012 at 12:25 PM.
    Protected by Glock. Don't mess with me!

  7. #7
    Driver Terrier NooNoo's Avatar
    Join Date
    Dec 2000
    Location
    UK
    Posts
    31,843
    [headache]pointers[/headache]
    Never, ever approach a computer saying or even thinking "I will just do this quickly."

  8. #8
    Registered User CeeBee's Avatar
    Join Date
    Nov 2002
    Location
    USA
    Posts
    2,478
    Quote Originally Posted by NooNoo View Post
    [headache]pointers[/headache]
    In all honesty, understanding them as "theory" in the absence of good examples is a headache that makes no sense, but when you start using them it all becomes clear...

    Come on, what's not to love in such a code (part of an embedded webserver where saving memory and efficient use of the 12.5MHz clock is important)
    PHP Code:
    if(pSocket->step==1)
      {
        
    maxBytes=sizeof(pSocket->outBuffer) - (pSocket->pData pSocket->outBuffer) - pSocket->nDataLeft 1;
        if(
    maxBytes>1000)
        {
          
    maxBytes=1000;
        }
        
    fileBytes=fat_read_file(pSocket->filePtr, (unsigned char*)(pSocket->outBuffer pSocket->nDataLeft), maxBytes);
        if(
    fileBytes>0)
        {
          *(
    pSocket->outBuffer pSocket->nDataLeft fileBytes)='\0';
          
    pSocket->step pSocket->step 1//to stay at the same step if more data exists
        
    }
        else
        {
          
    fileBytes=0//avoid issues when returned an error case
          
    fat_close_file(pSocket->filePtr);
          *
    pSocket->pData '\0';  //null terminate output data
          
    pSocket->pageReady 1;
        }
        
    newBytes fileBytes;
      } 
    Protected by Glock. Don't mess with me!

  9. #9
    Driver Terrier NooNoo's Avatar
    Join Date
    Dec 2000
    Location
    UK
    Posts
    31,843
    Quote Originally Posted by CeeBee View Post
    In all honesty, understanding them as "theory" in the absence of good examples is a headache that makes no sense, but when you start using them it all becomes clear...
    Push, pointer, pop, stack overflow.... and yet the towers of hanoi are sooo simple.
    Never, ever approach a computer saying or even thinking "I will just do this quickly."

  10. #10
    Registered User Niclo Iste's Avatar
    Join Date
    Oct 2007
    Location
    Pgh, PA
    Posts
    2,051
    OK I'm bringing this back again. I never got to mess with the ubuntu compilers mostly because when I got around to it I found out the OS was corrupted somehow. Regardless I also learned that it may be more beneficial to learn Visual C++. I recall having a long time ago a book on how to learn Visual C++ that came with a standard compiler/editor. Since I have no clue what book that was do either of you have a suggestion on what book that comes with a CD to acquire?
    One Script to rule them all.
    One Script to find them.
    One Script to bring them all,
    and clean up after itself.

Similar Threads

  1. 2 Word XP questions
    By jfreeman in forum Microsoft Office
    Replies: 3
    Last Post: September 30th, 2008, 01:24 PM
  2. voting machine programming
    By geeksRus in forum Tech Lounge & Tales
    Replies: 15
    Last Post: October 16th, 2004, 10:34 AM
  3. Need some questions please
    By Gazzza in forum Networking
    Replies: 1
    Last Post: March 26th, 2002, 06:22 AM
  4. Questions, questions questions
    By JungleMan1 in forum Tech-To-Tech
    Replies: 15
    Last Post: July 22nd, 2001, 02:05 PM
  5. Just beginning with batch programming
    By Quiet Thunder in forum Programming And Web Design
    Replies: 7
    Last Post: June 6th, 2001, 10:32 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •