stefanbund / cis155

3 stars 5 forks source link

Week 2 Discussion: Coding and errors/bugs #5

Open kayvee opened 8 years ago

kayvee commented 8 years ago

Hello everyone! Just wanted to kick us off for this week since no one else has posted yet.

"1. what is it like to code your first few lines? What errors do you get at first?"

I have a background in coding, and I've done many online courses - including on one Java before over a year ago - so I didn't run into any errors. At least, I have not run in to errors as of now! The first few lines of code were still a bit shaky for me as I am still trying to understand Object Oriented Programming (OOP), which is fundamental to using Java.

"2. what is your process for working through an error, or bug? "

As I mentioned, I didn't run into any errors or bugs so far! When I do, as I have in the past, I tend to work through a lot of examples until I can see the problem more clearly and where I mess up. I also love visualizers (available for free online) to actually 'see' what is happening, since I sometimes think my code is returning something it doesn't.

Hope your week has been going well! Good luck everyone!

stefanbund commented 8 years ago

Be sure to post little snippets of code that are creating problems for you! Maybe if you have some experience, when others post their errors, you can jump in with me

From Stefan

On Feb 10, 2016, at 12:54 AM, Kaveh Varjoy notifications@github.com wrote:

Hello everyone! Just wanted to kick us off for this week since no one else has posted yet.

"1. what is it like to code your first few lines? What errors do you get at first?"

I have a background in coding, and I've done many online courses - including on one Java before over a year ago - so I didn't run into any errors. At least, I have not run in to errors as of now! The first few lines of code were still a bit shaky for me as I am still trying to understand Object Oriented Programming (OOP), which is fundamental to using Java.

"2. what is your process for working through an error, or bug? "

As I mentioned, I didn't run into any errors or bugs so far! When I do, as I have in the past, I tend to work through a lot of examples until I can see the problem more clearly and where I mess up. I also love visualizers (available for free online) to actually 'see' what is happening, since I sometimes think my code is returning something it doesn't.

Hope your week has been going well! Good luck everyone!

— Reply to this email directly or view it on GitHub.

cetinaydin commented 8 years ago

Hi everyone,

I started the class late, I would like to know where I can find the videos for the milestone.

Thank you!

Cetin

kayvee commented 8 years ago

Go check out the Milestones Guide document on the GitHub. There is a link to a YouTube channel there, and all of the videos are posted.

I can post the link itself when I get home.

Good luck!

Edit: https://www.youtube.com/channel/UCFGOOfhq5Rhtml53NogOtow/videos

cetinaydin commented 8 years ago

Thank you Kaveh, I really appreciate your help

kayvee commented 8 years ago

So, there are two different Lesson 8 videos available:

https://www.youtube.com/watch?v=XsfNWfFDWjU ("getters and setters")

https://www.youtube.com/watch?v=8NI5t1e3JbM ("on making new classes")

It seemed that they went in this order, but there was a big jump in the code between the two videos. Is this true? Should we be doing both? Lesson 9's video had a big gap after 8, so I just assumed that I should watch both Lesson 8 videos.

Thank you!

cetinaydin commented 8 years ago

That is what I have noticed earlier. I just watched both lesson 8 videos and tried to add additional codes to mine just not to skip anything

cetinaydin commented 8 years ago

Hello everyone, After spending little bit too much of trying to understand how to get coding right on my first tries, I still had issues to make them work. I actually like it as it is challenging for me. One of the first errors I was getting was forgetting either parenthesis, semi-colon, or dots. I was also making figuring out when I see red exclamations. However, they were just self explained and was able to point them out easily. i also made some spelling mistakes. I was double checking my spelling first as most of the time that was my errors. After correcting them I was good to go. For the punctuation mistakes, I was being careful for java's red exclamation points. Even though making such a small mistakes made my coding not working, I am having experiences not to repeat them in the future, Hopefully :)

I wish everyone a great weekend!

Cetin Aydin

kayvee commented 8 years ago

@cetinaydin

Yes, this is what I did too. I was just curious because there was suddenly a Market, etc, without me having seen them before. Maybe it's just the case with online courses sometimes!

Irfan009 commented 8 years ago

Hi everyone,

Q: What is it like to code your first few lines? What errors do you get at first?" A: I was very excited on finally being able to have Eclipse up and running, below are the issues I ran into: 1- In the beginning while trying generate my very first output of “Hello World!” I kept forgetting the semicolon. 2- When defining the data type I learned that lower case “s” for “String” does not work.

screen shot 2016-02-13 at 9 23 00 am

Q: What is your process for working through an error, or bug? A: To determine what possibly went wrong i normally do the following: 1- Read code line by line and check for errors 2- If possible, execute the code in smaller pieces (write 2/3 lines and generate the out) this helps pin point the issue.

Looking forward to reading about everyone’s best practices, ideas on debugging etc. have a great weekend guys ☺

~Irfan Awan

stefanbund commented 8 years ago

Do both

From Stefan

On Feb 12, 2016, at 10:37 PM, Kaveh Varjoy notifications@github.com wrote:

So, there are two different Lesson 8 videos available:

https://www.youtube.com/watch?v=XsfNWfFDWjU ("getters and setters")

https://www.youtube.com/watch?v=8NI5t1e3JbM ("on making new classes")

It seemed that they went in this order, but there was a big jump in the code between the two videos. Is this true? Should we be doing both? Lesson 9's video had a big gap after 8, so I just assumed that I should watch both Lesson 8 videos.

Thank you!

— Reply to this email directly or view it on GitHub.

stefanbund commented 8 years ago

If you get stuck on anything, be sure to post your code to this forum!

From Stefan

On Feb 12, 2016, at 11:52 PM, cetinaydin notifications@github.com wrote:

Hello everyone, After spending little bit too much of trying to understand how to get coding right on my first tries, I still had issues to make them work. I actually like it as it is challenging for me. One of the first errors I was getting was forgetting either parenthesis, semi-colon, or dots. I was also making figuring out when I see red exclamations. However, they were just self explained and was able to point them out easily. i also made some spelling mistakes. I was double checking my spelling first as most of the time that was my errors. After correcting them I was good to go. For the punctuation mistakes, I was being careful for java's red exclamation points. Even though making such a small mistakes made my coding not working, I am having experiences not to repeat them in the future, Hopefully :)

I wish everyone a great weekend!

Cetin Aydin

— Reply to this email directly or view it on GitHub.

stefanbund commented 8 years ago

Great catch with the string variable. This takes a bit of getting used to

From Stefan

On Feb 13, 2016, at 9:39 AM, Irfan009 notifications@github.com wrote:

Hi everyone,

Q: What is it like to code your first few lines? What errors do you get at first?" A: I was very excited on finally being able to have Eclipse up and running, below are the issues I ran into: 1- In the beginning while trying generate my very first output of “Hello World!” I kept forgetting the semicolon. 2- When defining the data type I learned that lower case “s” for “String” does not work.

Q: What is your process for working through an error, or bug? A: To determine what possibly went wrong i normally do the following: 1- Read code line by line and check for errors 2- If possible, execute the code in smaller pieces (write 2/3 lines and generate the out) this helps pin point the issue.

Looking forward to reading about everyone’s best practices, ideas on debugging etc. have a great weekend guys ☺

~Irfan Awan

— Reply to this email directly or view it on GitHub.

calvinln commented 8 years ago

Hi everyone,

Q: What is it like to code your first few lines? What errors do you get at first?" I followed the video tutorials closely and didn't get too much trouble. My Eclipse looks different though, it took some time for me to figure out how to create classes and run the code. I got an error when I tried to use Random, then I realized that it's because I forgot to import it. Also I was trying to return a random number as a string. Java didn't let me do that. Q: What is your process for working through an error, or bug? Check the errors Eclipse reported. Check the videos to see if I did something wrong.

Calvin

forrestbennett commented 8 years ago

Most of my errors stem from bracketing. I am starting to see it as I put lines down now so its not happening as frequently and is becoming second nature.

Forrest Bennett

stefanbund commented 8 years ago

This is very encouraging. You're correct in that eclipse is trying to help you discover fixes. The challenge is that eclipse provides multiple options for the solution.hence the video will likely be helpful.

From Stefan

On Feb 14, 2016, at 6:40 PM, calvinln notifications@github.com wrote:

Hi everyone,

Q: What is it like to code your first few lines? What errors do you get at first?" I followed the video tutorials closely and didn't get too much trouble. My Eclipse looks different though, it took some time for me to figure out how to create classes and run the code. I got an error when I tried to use Random, then I realized that it's because I forgot to import it. Also I was trying to return a random number as a string. Java didn't let me do that. Q: What is your process for working through an error, or bug? Check the errors Eclipse reported. Check the videos to see if I did something wrong.

Calvin

— Reply to this email directly or view it on GitHub.

stefanbund commented 8 years ago

If you move your cursor right in front of the bracket, it should highlight the bracket it is matching.

From Stefan

On Feb 14, 2016, at 6:47 PM, forrestbennett notifications@github.com wrote:

Most of my errors stem from bracketing. I am starting to see it as I put lines down now so its not happening as frequently and is becoming second nature.

— Reply to this email directly or view it on GitHub.

trungphung commented 8 years ago

Hi everyone,

  1. I am still new to coding so it take me sometime to follow. Most if not all of my errors result from typing error.
  2. I re-watch the video multiple times and checking the error indicated code lines to find error
forrestbennett commented 8 years ago

When uploading our first milestone to dropbox are we supposed to just throw in all of the individual java files (brain center, buyer,stock…)?

forrestbennett commented 8 years ago

Thank you Kayvee for posting the links for both lesson 8 videos! I was having a hard time finding the second one.

stefanbund commented 8 years ago

Please copy paste all of the code, and all of your classes into one word document or PDF. Then take a screenshot of your output and place it at the start or end of the document.

From Stefan

On Feb 14, 2016, at 10:09 PM, forrestbennett notifications@github.com wrote:

When uploading our first milestone to dropbox are we supposed to just throw in all of the individual java files (brain center, buyer,stock…)?

— Reply to this email directly or view it on GitHub.

pricedjp commented 8 years ago

Q: What is it like to code your first few lines? What errors do you get at first?"

I keep making small errors. Eclipse is telling me they are syntax or spelling related. But I am also finding myself stuck and my program unable to run.

image

image

Q: What is your process for working through an error, or bug?

I first identify what kind of error I am making by highlighting the error within eclipse. Then I try and use the book and some java cheat sheets I found online to fix the errors and check my formatting.

WesleyTo commented 8 years ago

@pricedjp

In the first screenshot, it looks like you're missing the final two closing } brackets (one to close the class definition, the other to close main). I could be wrong, because I'm not sure if your screenshot cuts off or not.

In the second:

WesleyTo commented 8 years ago
  1. I didn't have any major issues. I've programmed in Java before and am just using this class as a refresher. I did keep using self instead of this though, force of habit from Python and Ruby.
  2. I'll check any errors the IDE shows and look them up if necessary. I'll then use print statements to examine variables at certain places, use breakpoints and step through to find the problem, check IDs for variables when testing equality, and do a manual run-through (whiteboard or paper and pen) with a small example and make sure the algorithm is correct.
khaleb07 commented 8 years ago
  1. what is it like to code your first few lines? What errors do you get at first? It felt good to type and see how the code from different areas of the program inter-linked together. Most of my errors were typos that eclipse generously underlined in red.
  2. what is your process for working through an error, or bug?
    I use Google to search for a guide or try to find a solution in the text book. Alternatively I could post here for help.
pricedjp commented 8 years ago

@WesleyTo I'm still struggling to get the first few lines of code in my braincenter.java and stock.java to function properly. Thanks for any help.

  1. When you say I need to close the "class definition and the main" in the braincenter.java screenshot, where exactly do I place it? I've tried it in several different places and it's not working. image
  2. I made some adjustments in my "stock.java" code but im stilling have some issues with the "public stock" and "public class Stock" lines. Do you know what I am doing wrong in this area? image

image

khaleb07 commented 8 years ago

@pricedjp Your first few lines of comments are not properly commented out. just use /* at the beginning of the comment and then * / at the end. Your first line has //\ which will only comment the first line.

Example:

// only one line of comment

/* multiple lines of comment */

WesleyTo commented 8 years ago

@pricedjp

1) At the very end, after all the code, place two } brackets. These are the two syntax errors mentioned in the third screenshot. You don't need either of the double-quotes after st.industry. You also have an extra bracket in between the class definition header and main. Brackets and parentheses always come in pairs, so you should have an equal number of opening ones { ( [ as closing ones } ) ].

2) I think if you fix the two errors below, it will solve most or all the rest of the errors.

pricedjp commented 8 years ago

Thanks @khaleb07

pricedjp commented 8 years ago

Thanks @WesleyTo its my first programming course and I'm struggling. I appreciate the help.

stefanbund commented 8 years ago

I think here, you want to capitalize the use of stock in your constructor, so it looks like Stock()

From Stefan

On Feb 15, 2016, at 4:34 PM, pricedjp notifications@github.com wrote:

Q: What is it like to code your first few lines? What errors do you get at first?"

I keep making small errors. Eclipse is telling me they are syntax or spelling related. But I am also finding myself stuck and my program unable to run.

Q: What is your process for working through an error, or bug?

I first identify what kind of error I am making by highlighting the error within eclipse. Then I try and use the book and some java cheat sheets I found online to fix the errors and check my formatting.

— Reply to this email directly or view it on GitHub.

stefanbund commented 8 years ago

Good call, go ahead and post here no matter what

From Stefan

On Feb 15, 2016, at 10:17 PM, khaleb07 notifications@github.com wrote:

what is it like to code your first few lines? What errors do you get at first? It felt good to type and see how the code from different areas of the program inter-linked together. Most of my errors were typos that eclipse generously underlined in red.

what is your process for working through an error, or bug?

I use Google to search for a guide or try to find a solution in the text book. Alternatively I could post here for help.

— Reply to this email directly or view it on GitHub.

stefanbund commented 8 years ago

Remove the second bracket after your class definition, then capitalize your use of stock in the constructor

Stock()

From Stefan

On Feb 16, 2016, at 5:21 PM, pricedjp notifications@github.com wrote:

@WesleyTo I'm still struggling to get the first few lines of code in my braincenter.java and stock.java to function properly. Thanks for any help.

When you say I need to close the "class definition and the main" in the braincenter.java screenshot, where exactly do I place it? I've tried it in several different places and it's not working.

I made some adjustments in my "stock.java" code but im stilling have some issues with the "public stock" and "public class Stock" lines. Do you know what I am doing wrong in this area?

— Reply to this email directly or view it on GitHub.

pricedjp commented 8 years ago

My "else if" statements are telling me i'm making a "syntax error on token else" and my elements (i.e. system.out.println) are not attaching to the source above. I played around with copying and pasting existing code and rewriting the code from scratch but I get the same syntax and source issue even though it seems like an easy fix. Does anyone in the forum know what I am doing wrong?

image

WesleyTo commented 8 years ago

@pricedjp You have an extra ; after the if(st.ipoQty < limit) clause. It's prematurely ending the execution of the entire statement, so the else-if is not linked to any preceding if.

kayvee commented 8 years ago

Check this line:

if (st.ipoQty < limit) ; { blahblahblah

If statements do not have semicolons after them. Now, the else if statements cannot 'exist' without the if statement, and you've effectively 'closed' it with the semicolon. Remember, else if must follow if. It is telling you that 'else' is in there when it shouldn't be because else also always needs to follow an if, and to the compiler it looks like you are writing

else

if

See your other [correct] example above:

if (st.industry.equalsIgnoreCase(ind))

On Wed, Feb 17, 2016 at 2:32 PM, pricedjp notifications@github.com wrote:

My "else if" statements are telling me i'm making a "syntax error on token else" and my elements (i.e. system.out.println) are not attaching to the source above. I played around with copying and pasting existing code and rewriting the code from scratch but I get the same syntax and source issue even though it seems like an easy fix. Does anyone in the forum know what I am doing wrong?

[image: image] https://cloud.githubusercontent.com/assets/16979043/13127128/ace193b2-d582-11e5-8cc6-e258bcde77ab.png

— Reply to this email directly or view it on GitHub https://github.com/stefanbund/cis155/issues/5#issuecomment-185438197.

stefanbund commented 8 years ago

I was taking note of the second error that said that there was a missing end bracket, to define the class.

From Stefan

On Feb 17, 2016, at 2:32 PM, pricedjp notifications@github.com wrote:

My "else if" statements are telling me i'm making a "syntax error on token else" and my elements (i.e. system.out.println) are not attaching to the source above. I played around with copying and pasting existing code and rewriting the code from scratch but I get the same syntax and source issue even though it seems like an easy fix. Does anyone in the forum know what I am doing wrong?

— Reply to this email directly or view it on GitHub.

forrestbennett commented 8 years ago

Just want to make sure, is there anything due this weekend? Also, will we get grading/remarks back on our milestone 1? Thanks

Forrest

kayvee commented 8 years ago

@forrestbennett , the way I understand it:

Due this Sunday (2/21): 1) discussion posts for week 3, submitted to Dropbox

Due next Sunday (2/28): 1) discussion posts for week 4, submitted to Dropbox 2) Milestone 2 (specifics not yet released)

Due the Sunday thereafter (3/6): 1) discussion posts for week 5, submitted to Dropbox 2) Phase 1 (specifics not yet released, but should be in the roadmap)

Stefan did also say that he would give us feedback regarding Milestone 1 soon.

On Thu, Feb 18, 2016 at 2:56 PM, forrestbennett notifications@github.com wrote:

Just want to make sure, is there anything due this weekend? Also, will we get grading/remarks back on our milestone 1? Thanks

Forrest

— Reply to this email directly or view it on GitHub https://github.com/stefanbund/cis155/issues/5#issuecomment-185969953.

forrestbennett commented 8 years ago

@kayvee thanks brother!

stefanbund commented 8 years ago

Should be getting this back to you by the end of the weekend

From Stefan

On Feb 18, 2016, at 2:56 PM, forrestbennett notifications@github.com wrote:

Just want to make sure, is there anything due this weekend? Also, will we get grading/remarks back on our milestone 1? Thanks

Forrest

— Reply to this email directly or view it on GitHub.

stefanbund commented 8 years ago

This is accurate. Every two weeks a milestone is due, with help from the YouTubes. In between those milestones you should post weekly discussion summaries to our Seaport dropbox. Hope this helps

From Stefan

On Feb 18, 2016, at 2:59 PM, Kaveh Varjoy notifications@github.com wrote:

@forrestbennett , the way I understand it:

Due this Sunday (2/21): 1) discussion posts for week 3, submitted to Dropbox

Due next Sunday (2/28): 1) discussion posts for week 4, submitted to Dropbox 2) Milestone 2 (specifics not yet released)

Due the Sunday thereafter (3/6): 1) discussion posts for week 5, submitted to Dropbox 2) Phase 1 (specifics not yet released, but should be in the roadmap)

Stefan did also say that he would give us feedback regarding Milestone 1 soon.

On Thu, Feb 18, 2016 at 2:56 PM, forrestbennett notifications@github.com wrote:

Just want to make sure, is there anything due this weekend? Also, will we get grading/remarks back on our milestone 1? Thanks

Forrest

— Reply to this email directly or view it on GitHub https://github.com/stefanbund/cis155/issues/5#issuecomment-185969953.

— Reply to this email directly or view it on GitHub.

Sweeter-man commented 8 years ago

I know im a little behind, but this is the issue im having. its from lesson 7

***RESOLVED*

I did not have import java.util.Random; in my code I had eclipse import Random library and the code worked again. :)

error

WesleyTo commented 8 years ago

@Sweeter-man The screenshot is cut off at the top, so I could be wrong, but I'm guessing that you didn't import Random. Random is a library. You have to import it before using it. Add this line import java.util.Random; at the very top of your file.

Also, if you hover your mouse over the underlined error, a popup should appear that will suggest a fix. One of those fixes will be to add the import statement.

Sweeter-man commented 8 years ago

Thanks! @WesleyTo

stefanbund commented 8 years ago

It looks like random may not be imported at the top of the file. Perhaps click on the red box then choose to import the random class. This may unlock that error

From Stefan

On Feb 25, 2016, at 11:43 PM, Sweeter-man notifications@github.com wrote:

I know im a little behind, but this is the issue im having.

— Reply to this email directly or view it on GitHub.