Why teach C using scanf without talking about command line arguments?Should I teach modern web development in an introductory programming course? How?Is it okay to teach C++ to my 7 year old brother?Why do educators not set an upper bound for the amount of times we're allowed to compile code?Why and how is it efficient to process sorted arrays than unsorted arrays?Students seem to be unable to use code to express their ideas. Is the teaching methodology improvable?How to teach C++ language to beginners of (BSCS) students who have no any idea about it?How can I improve other programming languages while having command on one languageWhy Computer Science students learn Digital Logic Design?Why do computer science students learn electronics and electric circuit analysis?How to teach so that your student doesn't feel stupid?

Which GPUs to get for Mathematical Optimization (if any)?

What could make large expeditions ineffective for exploring territory full of dangers and valuable resources?

When designing an adventure, how can I ensure a continuous player experience in a setting that's likely to favor TPKs?

Demographic consequences of closed loop reincarnation

Why does a tetrahedral molecule like methane have a dipole moment of zero?

Locked-up DOS computer beeped on keypress. What mechanism caused that?

How can I help our ranger feel special about her beast companion?

An entire function all whose forward orbits are bounded

"Je suis petite, moi?", purpose of the "moi"?

How slow can a car engine run?

Change Opacity of Style

Amira L'Akum not on Shabbat

Do dragons smell of lilacs?

Why is the Intel 8086 CPU called a 16-bit CPU?

How to draw a winding on a toroid of a circular cross section?

What causes a rotating object to rotate forever without external force—inertia, or something else?

Random piece of plastic

How to tell the object type of an Attachment

Software need db owner permission to master database (sql2016)

Difference between c++14 and c++17 using: `*p++ = *p`

How to interpret a promising preprint that was never published?

Is straight-up writing someone's opinions telling?

How would thermophilic fish survive?

Is encryption still applied if you ignore the SSL certificate warning for self signed?



Why teach C using scanf without talking about command line arguments?


Should I teach modern web development in an introductory programming course? How?Is it okay to teach C++ to my 7 year old brother?Why do educators not set an upper bound for the amount of times we're allowed to compile code?Why and how is it efficient to process sorted arrays than unsorted arrays?Students seem to be unable to use code to express their ideas. Is the teaching methodology improvable?How to teach C++ language to beginners of (BSCS) students who have no any idea about it?How can I improve other programming languages while having command on one languageWhy Computer Science students learn Digital Logic Design?Why do computer science students learn electronics and electric circuit analysis?How to teach so that your student doesn't feel stupid?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3












$begingroup$


Most of the books I read give examples using printf and scanf. At some point the students know perfectly how to use these two functions but they don't know about stdin, stdout and argv.



To me and according to many programming principles (e.g. KISS) a program should not interrupt the execution for prompting the user. Instead, and this is a much clever approach, the developer should learn to use the power of pipes and use the options and the arguments.



I think this:



$ whatdaywas 1982 02 16
Monday


Is much better than:



$ whatdaywas
Enter a year: 1982
Enter a month: 2
Enter a day: 16
It was a Monday.


Is there any rationale behind this pedagogical approach?










share|improve this question











$endgroup$


















    3












    $begingroup$


    Most of the books I read give examples using printf and scanf. At some point the students know perfectly how to use these two functions but they don't know about stdin, stdout and argv.



    To me and according to many programming principles (e.g. KISS) a program should not interrupt the execution for prompting the user. Instead, and this is a much clever approach, the developer should learn to use the power of pipes and use the options and the arguments.



    I think this:



    $ whatdaywas 1982 02 16
    Monday


    Is much better than:



    $ whatdaywas
    Enter a year: 1982
    Enter a month: 2
    Enter a day: 16
    It was a Monday.


    Is there any rationale behind this pedagogical approach?










    share|improve this question











    $endgroup$














      3












      3








      3





      $begingroup$


      Most of the books I read give examples using printf and scanf. At some point the students know perfectly how to use these two functions but they don't know about stdin, stdout and argv.



      To me and according to many programming principles (e.g. KISS) a program should not interrupt the execution for prompting the user. Instead, and this is a much clever approach, the developer should learn to use the power of pipes and use the options and the arguments.



      I think this:



      $ whatdaywas 1982 02 16
      Monday


      Is much better than:



      $ whatdaywas
      Enter a year: 1982
      Enter a month: 2
      Enter a day: 16
      It was a Monday.


      Is there any rationale behind this pedagogical approach?










      share|improve this question











      $endgroup$




      Most of the books I read give examples using printf and scanf. At some point the students know perfectly how to use these two functions but they don't know about stdin, stdout and argv.



      To me and according to many programming principles (e.g. KISS) a program should not interrupt the execution for prompting the user. Instead, and this is a much clever approach, the developer should learn to use the power of pipes and use the options and the arguments.



      I think this:



      $ whatdaywas 1982 02 16
      Monday


      Is much better than:



      $ whatdaywas
      Enter a year: 1982
      Enter a month: 2
      Enter a day: 16
      It was a Monday.


      Is there any rationale behind this pedagogical approach?







      programming c






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 3 hours ago









      Buffy

      24.9k9 gold badges42 silver badges86 bronze badges




      24.9k9 gold badges42 silver badges86 bronze badges










      asked 9 hours ago









      nowoxnowox

      1434 bronze badges




      1434 bronze badges




















          3 Answers
          3






          active

          oldest

          votes


















          4












          $begingroup$

          I think that the rationale is so you don't have to introduce arrays and array notation on day 1. Typically, arrays enter into the picture at roughly the same time as loops, which would take place a few weeks or months later, depending on the pacing of your course.



          That said, if you want to start with command line programs, it's not a huge problem to do so. At the very, very beginning of programming, there are always a few magical incantations that students must type, but won't fully explore until later. args[0] could easily be such an incantation.



          As a side benefit to this approach, your students may have an easier time when they come to arrays, since they've already used them a bit.






          share|improve this answer









          $endgroup$








          • 1




            $begingroup$
            I like the incantation term you use.
            $endgroup$
            – nowox
            6 hours ago










          • $begingroup$
            Can't you still talk about stdin/stdout/stderr without using the argv array? I believe that scanf still just reads from stdin, so you can easily store stdin to a variable.
            $endgroup$
            – thesecretmaster
            3 hours ago



















          2












          $begingroup$

          Ultimately they need to understand both ways. Which you do first seems to be a matter of preference - or maybe just following the textbook.



          They need to understand at some point that 'main' in C is an interface with the OS. But, since you can't teach everything at once, you have do pick the order of instruction. But teaching command line params later can give you a way to talk about "elegance" in program design.



          Of course, the program written to accept args needs to behave properly if none (or too few) are presented. Often this defaults to prompting for data in simple programs.






          share|improve this answer









          $endgroup$




















            0












            $begingroup$

            Because, traditionally, programs iterate over data. See JSP.



            Admittedly, prompting the user for data is weird, however we're talking about beginners here, having them try to remember what the different fields of data they have to enter isn't the point of the exercise, and is likely to make them view interacting with computers as needlessly complicated. As a bonus, prompting for the values helps make the beginner programs self documenting - the text of the prompt is an explanation of the variable that is to be read - so this will hopefully help our novice programmers understand the simple program without introducing the complex topic of comments.



            (fun fact: originally in pascal it wasn't legitimate code to output before input, so you couldn't prompt for input. This was quickly abandoned)





            share








            New contributor



            Grump is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.





            $endgroup$















              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "678"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcseducators.stackexchange.com%2fquestions%2f5820%2fwhy-teach-c-using-scanf-without-talking-about-command-line-arguments%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              4












              $begingroup$

              I think that the rationale is so you don't have to introduce arrays and array notation on day 1. Typically, arrays enter into the picture at roughly the same time as loops, which would take place a few weeks or months later, depending on the pacing of your course.



              That said, if you want to start with command line programs, it's not a huge problem to do so. At the very, very beginning of programming, there are always a few magical incantations that students must type, but won't fully explore until later. args[0] could easily be such an incantation.



              As a side benefit to this approach, your students may have an easier time when they come to arrays, since they've already used them a bit.






              share|improve this answer









              $endgroup$








              • 1




                $begingroup$
                I like the incantation term you use.
                $endgroup$
                – nowox
                6 hours ago










              • $begingroup$
                Can't you still talk about stdin/stdout/stderr without using the argv array? I believe that scanf still just reads from stdin, so you can easily store stdin to a variable.
                $endgroup$
                – thesecretmaster
                3 hours ago
















              4












              $begingroup$

              I think that the rationale is so you don't have to introduce arrays and array notation on day 1. Typically, arrays enter into the picture at roughly the same time as loops, which would take place a few weeks or months later, depending on the pacing of your course.



              That said, if you want to start with command line programs, it's not a huge problem to do so. At the very, very beginning of programming, there are always a few magical incantations that students must type, but won't fully explore until later. args[0] could easily be such an incantation.



              As a side benefit to this approach, your students may have an easier time when they come to arrays, since they've already used them a bit.






              share|improve this answer









              $endgroup$








              • 1




                $begingroup$
                I like the incantation term you use.
                $endgroup$
                – nowox
                6 hours ago










              • $begingroup$
                Can't you still talk about stdin/stdout/stderr without using the argv array? I believe that scanf still just reads from stdin, so you can easily store stdin to a variable.
                $endgroup$
                – thesecretmaster
                3 hours ago














              4












              4








              4





              $begingroup$

              I think that the rationale is so you don't have to introduce arrays and array notation on day 1. Typically, arrays enter into the picture at roughly the same time as loops, which would take place a few weeks or months later, depending on the pacing of your course.



              That said, if you want to start with command line programs, it's not a huge problem to do so. At the very, very beginning of programming, there are always a few magical incantations that students must type, but won't fully explore until later. args[0] could easily be such an incantation.



              As a side benefit to this approach, your students may have an easier time when they come to arrays, since they've already used them a bit.






              share|improve this answer









              $endgroup$



              I think that the rationale is so you don't have to introduce arrays and array notation on day 1. Typically, arrays enter into the picture at roughly the same time as loops, which would take place a few weeks or months later, depending on the pacing of your course.



              That said, if you want to start with command line programs, it's not a huge problem to do so. At the very, very beginning of programming, there are always a few magical incantations that students must type, but won't fully explore until later. args[0] could easily be such an incantation.



              As a side benefit to this approach, your students may have an easier time when they come to arrays, since they've already used them a bit.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered 7 hours ago









              Ben I.Ben I.

              18.7k7 gold badges43 silver badges109 bronze badges




              18.7k7 gold badges43 silver badges109 bronze badges







              • 1




                $begingroup$
                I like the incantation term you use.
                $endgroup$
                – nowox
                6 hours ago










              • $begingroup$
                Can't you still talk about stdin/stdout/stderr without using the argv array? I believe that scanf still just reads from stdin, so you can easily store stdin to a variable.
                $endgroup$
                – thesecretmaster
                3 hours ago













              • 1




                $begingroup$
                I like the incantation term you use.
                $endgroup$
                – nowox
                6 hours ago










              • $begingroup$
                Can't you still talk about stdin/stdout/stderr without using the argv array? I believe that scanf still just reads from stdin, so you can easily store stdin to a variable.
                $endgroup$
                – thesecretmaster
                3 hours ago








              1




              1




              $begingroup$
              I like the incantation term you use.
              $endgroup$
              – nowox
              6 hours ago




              $begingroup$
              I like the incantation term you use.
              $endgroup$
              – nowox
              6 hours ago












              $begingroup$
              Can't you still talk about stdin/stdout/stderr without using the argv array? I believe that scanf still just reads from stdin, so you can easily store stdin to a variable.
              $endgroup$
              – thesecretmaster
              3 hours ago





              $begingroup$
              Can't you still talk about stdin/stdout/stderr without using the argv array? I believe that scanf still just reads from stdin, so you can easily store stdin to a variable.
              $endgroup$
              – thesecretmaster
              3 hours ago














              2












              $begingroup$

              Ultimately they need to understand both ways. Which you do first seems to be a matter of preference - or maybe just following the textbook.



              They need to understand at some point that 'main' in C is an interface with the OS. But, since you can't teach everything at once, you have do pick the order of instruction. But teaching command line params later can give you a way to talk about "elegance" in program design.



              Of course, the program written to accept args needs to behave properly if none (or too few) are presented. Often this defaults to prompting for data in simple programs.






              share|improve this answer









              $endgroup$

















                2












                $begingroup$

                Ultimately they need to understand both ways. Which you do first seems to be a matter of preference - or maybe just following the textbook.



                They need to understand at some point that 'main' in C is an interface with the OS. But, since you can't teach everything at once, you have do pick the order of instruction. But teaching command line params later can give you a way to talk about "elegance" in program design.



                Of course, the program written to accept args needs to behave properly if none (or too few) are presented. Often this defaults to prompting for data in simple programs.






                share|improve this answer









                $endgroup$















                  2












                  2








                  2





                  $begingroup$

                  Ultimately they need to understand both ways. Which you do first seems to be a matter of preference - or maybe just following the textbook.



                  They need to understand at some point that 'main' in C is an interface with the OS. But, since you can't teach everything at once, you have do pick the order of instruction. But teaching command line params later can give you a way to talk about "elegance" in program design.



                  Of course, the program written to accept args needs to behave properly if none (or too few) are presented. Often this defaults to prompting for data in simple programs.






                  share|improve this answer









                  $endgroup$



                  Ultimately they need to understand both ways. Which you do first seems to be a matter of preference - or maybe just following the textbook.



                  They need to understand at some point that 'main' in C is an interface with the OS. But, since you can't teach everything at once, you have do pick the order of instruction. But teaching command line params later can give you a way to talk about "elegance" in program design.



                  Of course, the program written to accept args needs to behave properly if none (or too few) are presented. Often this defaults to prompting for data in simple programs.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 8 hours ago









                  BuffyBuffy

                  24.9k9 gold badges42 silver badges86 bronze badges




                  24.9k9 gold badges42 silver badges86 bronze badges





















                      0












                      $begingroup$

                      Because, traditionally, programs iterate over data. See JSP.



                      Admittedly, prompting the user for data is weird, however we're talking about beginners here, having them try to remember what the different fields of data they have to enter isn't the point of the exercise, and is likely to make them view interacting with computers as needlessly complicated. As a bonus, prompting for the values helps make the beginner programs self documenting - the text of the prompt is an explanation of the variable that is to be read - so this will hopefully help our novice programmers understand the simple program without introducing the complex topic of comments.



                      (fun fact: originally in pascal it wasn't legitimate code to output before input, so you couldn't prompt for input. This was quickly abandoned)





                      share








                      New contributor



                      Grump is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.





                      $endgroup$

















                        0












                        $begingroup$

                        Because, traditionally, programs iterate over data. See JSP.



                        Admittedly, prompting the user for data is weird, however we're talking about beginners here, having them try to remember what the different fields of data they have to enter isn't the point of the exercise, and is likely to make them view interacting with computers as needlessly complicated. As a bonus, prompting for the values helps make the beginner programs self documenting - the text of the prompt is an explanation of the variable that is to be read - so this will hopefully help our novice programmers understand the simple program without introducing the complex topic of comments.



                        (fun fact: originally in pascal it wasn't legitimate code to output before input, so you couldn't prompt for input. This was quickly abandoned)





                        share








                        New contributor



                        Grump is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.





                        $endgroup$















                          0












                          0








                          0





                          $begingroup$

                          Because, traditionally, programs iterate over data. See JSP.



                          Admittedly, prompting the user for data is weird, however we're talking about beginners here, having them try to remember what the different fields of data they have to enter isn't the point of the exercise, and is likely to make them view interacting with computers as needlessly complicated. As a bonus, prompting for the values helps make the beginner programs self documenting - the text of the prompt is an explanation of the variable that is to be read - so this will hopefully help our novice programmers understand the simple program without introducing the complex topic of comments.



                          (fun fact: originally in pascal it wasn't legitimate code to output before input, so you couldn't prompt for input. This was quickly abandoned)





                          share








                          New contributor



                          Grump is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.





                          $endgroup$



                          Because, traditionally, programs iterate over data. See JSP.



                          Admittedly, prompting the user for data is weird, however we're talking about beginners here, having them try to remember what the different fields of data they have to enter isn't the point of the exercise, and is likely to make them view interacting with computers as needlessly complicated. As a bonus, prompting for the values helps make the beginner programs self documenting - the text of the prompt is an explanation of the variable that is to be read - so this will hopefully help our novice programmers understand the simple program without introducing the complex topic of comments.



                          (fun fact: originally in pascal it wasn't legitimate code to output before input, so you couldn't prompt for input. This was quickly abandoned)






                          share








                          New contributor



                          Grump is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.







                          share


                          share






                          New contributor



                          Grump is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.








                          answered 5 mins ago









                          GrumpGrump

                          101




                          101




                          New contributor



                          Grump is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.




                          New contributor




                          Grump is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.





























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Computer Science Educators Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              Use MathJax to format equations. MathJax reference.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcseducators.stackexchange.com%2fquestions%2f5820%2fwhy-teach-c-using-scanf-without-talking-about-command-line-arguments%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                              Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                              François Viète Contents Biography Work and thought Bibliography See also Notes Further reading External links Navigation menup. 21Google Bookspp. 75–77Google BooksDe thou (from University of Saint Andrews)ArchivedGoogle BooksGoogle BooksGoogle BooksGoogle booksGoogle Bookscc-parthenay.frL'histoire universelle (fr)Universal History (en)ArchivedAdsabs.harvard.eduPagesperso-orange.frArchive.orgChikara Sasaki. Descartes' mathematical thought p.259Google BooksGoogle BooksGoogle Bookspp. 152 and onwardGoogle BooksGoogle BooksScribd.comGoogle Books1257-7979Google BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGallica.bnf.frGoogle BooksGoogle Books"François Viète"Francois Viète: Father of Modern Algebraic NotationThe Lawyer and the GamblerAbout TarporleySite de Jean-Paul GuichardL'algèbre nouvelle"About the Harmonicon"cb120511976(data)1188044800000 0001 0913 5903n82164680ola2013766880073431702w6vt1sb70287374827140948071409480