Page 2 of 5 FirstFirst 1234 ... LastLast
Results 11 to 20 of 49

Thread: Software Projects for Beginners

  1. Top | #11
    Veteran Member
    Join Date
    Jan 2006
    Location
    USA, California
    Posts
    3,959
    Archived
    5,710
    Total Posts
    9,669
    Rep Power
    61
    Quote Originally Posted by lpetrich View Post
    It's easy (Python version):
    Code:
    for k in range(1,100+1):
      dv3 = "Fizz" if (k % 3) == 0 else ""
      dv5 = "Buzz" if (k % 5) == 0 else ""
      # Makes "FizzBuzz" for both
      dv35 = dv3 + dv5
    
      if len(dv35) > 0:
        print(dv35)
      else:
        print(k)

    Related to this is which programming language to learn first.

    Ideally, one would want a language where one can do simple things without having to learn a lot, but one which can be used for professional-quality work. That is, not a toy language.

    I recommend Python. It satisfies both criteria.

    The main problem with Python, however, is its suboptimal performance. That is due to its dynamic typing, finding the data type of each variable before working with it. One gets much better performance with a static-typing language like Java or especially C++.

    For high-performance code, I recommend C++. It is backward-compatible with plain C, but it has *lots* of convenience and safety features. Both C and C++ have static typing, for instance, meaning that one must specify the types of most variables at compile time. Some supporters of C point out that it is a small language, with not many features. But one of them is its preprocessor. That feature works by simple substitution, and that makes it VERY bug-prone. In addition to the bugs that pointers can have, that makes C very vulnerable.
    Eh, the performance criteria is not so straight-forward. The vast majority of the time, unless you are directly writing low-level numerical algorithms, gaming engines, etc, then CPython is fine. And with Python, specifically, you can use libraries like `numpy` to leverage the performance of highly tuned, compiled code.

    And modern Python has added type annotations, and you can use libraries like `mypy` for static analysis of your code to give you the bug-catching advantages of statically typed languages.

  2. Top | #12
    Veteran Member
    Join Date
    Jan 2006
    Location
    USA, California
    Posts
    3,959
    Archived
    5,710
    Total Posts
    9,669
    Rep Power
    61
    Quote Originally Posted by bigfield View Post
    C++ seems like a really difficult language. I've written a little bit of C and C++ and even that was hard work.

    Is C++ just popular because it's the standard, go-to low-level programming language, the everyone learns, every big tech company hires for, and has a huge ecosystem?

    There must be better choices for writing high-performance code that is also nice to write and nice to look at.
    The new kid on the block is Rust, but that also has a learning curve. But it is much safer than C / C++.

  3. Top | #13
    Administrator lpetrich's Avatar
    Join Date
    Jul 2000
    Location
    Eugene, OR
    Posts
    15,264
    Archived
    16,829
    Total Posts
    32,093
    Rep Power
    95
    C++ is basically an effort to graft improved language features onto plain C while keeping high performance. In fact, it was originally "C with classes", and some people mainly use it in that fashion.

    I've seen C++ called the COBOL of the 90's, but I think that it's more like PL/1 (or PL/I). I've also seen that C++ is to C what lung cancer is to lung. I tend to think the opposite - I like how its container objects hide new/delete (or malloc/free) pairs, making programming with arrays much less of a headache.


    As to alternatives to C++ for high performance, Rust is an up-and-coming one. It has complexities of its own, however, like its borrowing system for transmitting data to other functions.


    I'll simplify my fizzbuzz Python version further with another ternary operator:
    Code:
    for k in range(1,100+1):
      dv3 = "Fizz" if (k % 3) == 0 else ""
      dv5 = "Buzz" if (k % 5) == 0 else ""
    
      # Makes "FizzBuzz" for both
      # the number for neither
      dv35 = dv3 + dv5
      outln = dv35 for len(dv35) > 0 else str(k)
    
      print(outln)

  4. Top | #14
    Deus Meumque Jus
    Join Date
    Jun 2010
    Location
    Canada's London
    Posts
    11,424
    Archived
    9,514
    Total Posts
    20,938
    Rep Power
    55
    When I went to college for programming we were introduced with Java and simple command utilities. This seemed like a good approach, conceptually simpler than C++ but widely prevalent in the industry, and strongly typed.

    In our second term we started using C++ so the college could knock out people who didn't have a chance of making it through the program. In our third term we started building real software.

    I never really got a handle on C++ in my early days of programming, at least in terms of memory management, but I gather that 9 years later I'd enjoy using it again and wouldn't have much issue with it.

  5. Top | #15
    Veteran Member
    Join Date
    Jan 2006
    Location
    USA, California
    Posts
    3,959
    Archived
    5,710
    Total Posts
    9,669
    Rep Power
    61
    Quote Originally Posted by rousseau View Post
    When I went to college for programming we were introduced with Java and simple command utilities. This seemed like a good approach, conceptually simpler than C++ but widely prevalent in the industry, and strongly typed.

    In our second term we started using C++ so the college could knock out people who didn't have a chance of making it through the program. In our third term we started building real software.

    I never really got a handle on C++ in my early days of programming, at least in terms of memory management, but I gather that 9 years later I'd enjoy using it again and wouldn't have much issue with it.
    Nitpick: you mean statically typed. C is actually weakly typed. Python and C++ are both strongly typed (i.e. every object has a fixed, known type). Dynamic typing doesn't imply weak typing, insofar as "strong" and "weak" typing are well-defined (so not really).

  6. Top | #16
    Deus Meumque Jus
    Join Date
    Jun 2010
    Location
    Canada's London
    Posts
    11,424
    Archived
    9,514
    Total Posts
    20,938
    Rep Power
    55
    Quote Originally Posted by J842P View Post
    Quote Originally Posted by rousseau View Post
    When I went to college for programming we were introduced with Java and simple command utilities. This seemed like a good approach, conceptually simpler than C++ but widely prevalent in the industry, and strongly typed.

    In our second term we started using C++ so the college could knock out people who didn't have a chance of making it through the program. In our third term we started building real software.

    I never really got a handle on C++ in my early days of programming, at least in terms of memory management, but I gather that 9 years later I'd enjoy using it again and wouldn't have much issue with it.
    Nitpick: you mean statically typed. C is actually weakly typed. Python and C++ are both strongly typed (i.e. every object has a fixed, known type). Dynamic typing doesn't imply weak typing, insofar as "strong" and "weak" typing are well-defined (so not really).
    Fair enough. I'm definitely one of the doesn't think about this type of thing too hard programmers, as long as someone is still paying me.

    It's funny, I've never really dwelled on semantics or technical debates but somehow I can also solve programming problems pretty efficiently.

  7. Top | #17
    Contributor
    Join Date
    Nov 2017
    Location
    seattle
    Posts
    6,876
    Rep Power
    21
    Quote Originally Posted by bigfield View Post
    C++ seems like a really difficult language. I've written a little bit of C and C++ and even that was hard work.

    Is C++ just popular because it's the standard, go-to low-level programming language, the everyone learns, every big tech company hires for, and has a huge ecosystem?

    There must be better choices for writing high-performance code that is also nice to write and nice to look at.
    C and C++ are standards, there are formal definitions.

    Back in the 70s the idea was we would all learn C which would be portable across platforms. You can still do hat if you code properly . C allowed direct access to addresses in memory which could speed up execution. It is also like a shorthand. When you are proficient you can write code faster and use less lines than languages like Pasdcal and Basic.

    Code size and complexity grew in proportion to speed and memory size. First there was spaghetti code. Unstructured code written off the top of the head with jumping all over the place.'Then came Structured Programming. Top down sequential execution, and self documenting code, variables and functions with descriptive names and comments.

    AS code grew that was insufficient. On a group project you cold compile code abd link te roject, but code coud still jump around. C allows a pointer to be placed anywhere. Data one one section could e clobbered by another section. Pointers.

    Along came OOP. In a C++ object private code and data can not be seen or hacked by other code. You create an object to do something with a public interface . If you have to change code in the object it is transparent to anyone using the object. It minimizes the chance of unforeseen side effects. On large programs a big problem when someone makes a change and causes a problem elsewhere.

    If you are writing a few lines of code you would not see it. For 10s of thousands of lines or mire then you would.

    Back in te 70s when a programmer left a company a company could be held hostage because nobody else could maintain the code.h

    In the 80s when I lived in Portland Or the Beaverton telephone company downloaded an update. When they rebooted it crashed. Someone at the manufacturer took out a seemingly useless code snippet. Put it back in and it worked. Not uncommon back then.

    With random bug fixes code became impossible to maintain.

    C++ was an answer. You can still write bad code, but it makes it easier to write good maintainable code.


    For routine apps MS has Visual Basic. You can download the free community version of Visual Studio.

    You can search for a Pascal compiler if they are still around..

  8. Top | #18
    Deus Meumque Jus
    Join Date
    Jun 2010
    Location
    Canada's London
    Posts
    11,424
    Archived
    9,514
    Total Posts
    20,938
    Rep Power
    55
    Quote Originally Posted by steve_bank View Post
    Quote Originally Posted by bigfield View Post
    C++ seems like a really difficult language. I've written a little bit of C and C++ and even that was hard work.

    Is C++ just popular because it's the standard, go-to low-level programming language, the everyone learns, every big tech company hires for, and has a huge ecosystem?

    There must be better choices for writing high-performance code that is also nice to write and nice to look at.
    C and C++ are standards, there are formal definitions.

    Back in the 70s the idea was we would all learn C which would be portable across platforms. You can still do hat if you code properly . C allowed direct access to addresses in memory which could speed up execution. It is also like a shorthand. When you are proficient you can write code faster and use less lines than languages like Pasdcal and Basic.

    Code size and complexity grew in proportion to speed and memory size. First there was spaghetti code. Unstructured code written off the top of the head with jumping all over the place.'Then came Structured Programming. Top down sequential execution, and self documenting code, variables and functions with descriptive names and comments.

    AS code grew that was insufficient. On a group project you cold compile code abd link te roject, but code coud still jump around. C allows a pointer to be placed anywhere. Data one one section could e clobbered by another section. Pointers.

    Along came OOP. In a C++ object private code and data can not be seen or hacked by other code. You create an object to do something with a public interface . If you have to change code in the object it is transparent to anyone using the object. It minimizes the chance of unforeseen side effects. On large programs a big problem when someone makes a change and causes a problem elsewhere.

    If you are writing a few lines of code you would not see it. For 10s of thousands of lines or mire then you would.

    Back in te 70s when a programmer left a company a company could be held hostage because nobody else could maintain the code.h

    In the 80s when I lived in Portland Or the Beaverton telephone company downloaded an update. When they rebooted it crashed. Someone at the manufacturer took out a seemingly useless code snippet. Put it back in and it worked. Not uncommon back then.

    With random bug fixes code became impossible to maintain.

    C++ was an answer. You can still write bad code, but it makes it easier to write good maintainable code.


    For routine apps MS has Visual Basic. You can download the free community version of Visual Studio.

    You can search for a Pascal compiler if they are still around..
    I definitely feel spoiled having entered the industry in the 10's. There was a steep learning curve to get where I am now, but truth be told I don't find my work that challenging anymore. If I don't know something the answer is on Google. If there is a bug I can use a debugger.

    It's actually quite beautiful in that people can't just walk in off the street and do it (job security), but for me programming feels like breathing, effortless.

  9. Top | #19
    Veteran Member excreationist's Avatar
    Join Date
    Aug 2000
    Location
    Australia
    Posts
    1,204
    Archived
    4,886
    Total Posts
    6,090
    Rep Power
    77
    Quote Originally Posted by lpetrich View Post
    ....For high-performance code, I recommend C++. It is backward-compatible with plain C...
    BTW there's also Objective-C....
    https://developer.apple.com/library/...roduction.html
    "It’s a superset of the C programming language and provides object-oriented capabilities and a dynamic runtime. Objective-C inherits the syntax, primitive types, and flow control statements of C and adds syntax for defining classes and methods"

    That used to be for iOS/MacOS programming but now there's Swift.

  10. Top | #20
    Contributor
    Join Date
    Nov 2017
    Location
    seattle
    Posts
    6,876
    Rep Power
    21
    Quote Originally Posted by rousseau View Post
    Quote Originally Posted by steve_bank View Post
    Quote Originally Posted by bigfield View Post
    C++ seems like a really difficult language. I've written a little bit of C and C++ and even that was hard work.

    Is C++ just popular because it's the standard, go-to low-level programming language, the everyone learns, every big tech company hires for, and has a huge ecosystem?

    There must be better choices for writing high-performance code that is also nice to write and nice to look at.
    C and C++ are standards, there are formal definitions.

    Back in the 70s the idea was we would all learn C which would be portable across platforms. You can still do hat if you code properly . C allowed direct access to addresses in memory which could speed up execution. It is also like a shorthand. When you are proficient you can write code faster and use less lines than languages like Pasdcal and Basic.

    Code size and complexity grew in proportion to speed and memory size. First there was spaghetti code. Unstructured code written off the top of the head with jumping all over the place.'Then came Structured Programming. Top down sequential execution, and self documenting code, variables and functions with descriptive names and comments.

    AS code grew that was insufficient. On a group project you cold compile code abd link te roject, but code coud still jump around. C allows a pointer to be placed anywhere. Data one one section could e clobbered by another section. Pointers.

    Along came OOP. In a C++ object private code and data can not be seen or hacked by other code. You create an object to do something with a public interface . If you have to change code in the object it is transparent to anyone using the object. It minimizes the chance of unforeseen side effects. On large programs a big problem when someone makes a change and causes a problem elsewhere.

    If you are writing a few lines of code you would not see it. For 10s of thousands of lines or mire then you would.

    Back in te 70s when a programmer left a company a company could be held hostage because nobody else could maintain the code.h

    In the 80s when I lived in Portland Or the Beaverton telephone company downloaded an update. When they rebooted it crashed. Someone at the manufacturer took out a seemingly useless code snippet. Put it back in and it worked. Not uncommon back then.

    With random bug fixes code became impossible to maintain.

    C++ was an answer. You can still write bad code, but it makes it easier to write good maintainable code.


    For routine apps MS has Visual Basic. You can download the free community version of Visual Studio.

    You can search for a Pascal compiler if they are still around..
    I definitely feel spoiled having entered the industry in the 10's. There was a steep learning curve to get where I am now, but truth be told I don't find my work that challenging anymore. If I don't know something the answer is on Google. If there is a bug I can use a debugger.

    It's actually quite beautiful in that people can't just walk in off the street and do it (job security), but for me programming feels like breathing, effortless.
    It is about efficiency and cost. There are tools that take scripted pseudo code and generate C code for different platforms. A guy I knew who sold financial SW paid around $0k for the package and $5k per seat. It enabled him to have one sw engineer instead of 3 or 4.

    Knuths Seni Numdrical Algorithms covers the usual stuff like sorting, searching, random number generators. The general algorithms are well know. The book does not include current AI algorithms, Knuths Semi Numerical Algorithms covere just about all of the regular topics.

    Places like Google and Amazon developed new AI, search, storage, and data base techniques that are proprietary. They are where the action is, so to speak.

    MS VS provides low level functions for web apps and GUI creation. The challenge is not in the code, it is learning VS.

Posting Permissions

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