susanBuck / e15-spring22

0 stars 0 forks source link

Project not working as expected - undefined variable warnings #15

Closed YvaGithub closed 2 years ago

YvaGithub commented 2 years ago

Hello Everyone, My first method worked very well but when I moved to the third method, everything went south as the variables replacement confused me. I am attaching some screenshots for your convenience. Now, it does not even work. proj1 proj2 proj3 proj4JPG

Thanks in advance.

archerdave commented 2 years ago

So, first question, what is the first image a screenshot of?

And which methods are you calling "first method" and "third method"?

pllealfunes commented 2 years ago

Have you tried setting the "for" in your label tag to be the same as the "name" attribute in your input tag? Screen Shot 2022-02-15 at 8 32 37 PM

YvaGithub commented 2 years ago

Sorry, I should have said design 3. The first image is index-view.php.

archerdave commented 2 years ago

In index.php, I'm not sure that line 10 is doing what you think it's doing.

YvaGithub commented 2 years ago

Thanks!

archerdave commented 2 years ago

In your Palindromecheck function, be very careful about what values you are returning, and what values you are looking for.

archerdave commented 2 years ago

Also, see Part 4: Code style and design (13:03) around the eight minute mark.

susanBuck commented 2 years ago

Hi @YvaGithub -

You've got some good leads to follow from your classmates above. I'll continue to watch this thread if you have follow-up questions as you dig into their suggestions.

YvaGithub commented 2 years ago

I am following the tips. Thank you

patrickgarsow-harvard commented 2 years ago

Sorry @YvaGithub for responding so late. I think it is important to try and post these questions as early as possible.

I think the most important thing you can do is sit back and walk through the steps to complete the ask. The best hint I can give you is order of operations. If you go to your page for the first time, what is the value of $isPalindrome? If by me asking that question you look at anything other than index-view.php you have gone to far.

Onto another suggestion, I don't believe (or don't remember at this point) if the instructor's videos and/or documentation gave a good overview of the true difference between local and global variables (I do know they are discussed) but that will also provide a decent amount of guidance as to why if you address what I said in my first paragraph you will still be frustrated when things still don't work. Push forward...

Also, to get past the frustration I would highly recommend looking at what model, view, controller (MVC) frameworks aim to do and why following that process will lead to better outcomes.

Finally, in learning to code the best way is to look and review what other people have done with similar situations. All of our github repositories are public so I know at the very least a handful of others have been working on this issue. You are more than welcome to take a look at my repository to see if you can compare my code with your code and follow it. I am concerned that you are posting this question 4 hours before the deadline but suggest that if you haven't completed the assignment that you do the review of differences between my coding examples and your code and ask specific questions as to why things are done a certain way. https://github.com/patrickgarsow-harvard/e15/p1

susanBuck commented 2 years ago

Some useful tips from @patrickgarsow-harvard, thank you for sharing!

I want to share some follow-up notes:

Adding on to all of this, I do have some tips/reminders for everyone about how we're asking questions, pulling from the "about" page for the course forum:

  • Write clear, to-the-point, informative post titles.
  • When relevant, include your Github repository URL (with the latest changes pushed) and tell us the specific files you’re asking your question about.
  • Do not share screenshots of code - they can be hard to read and it’s not possible to copy/paste from them. Whenever possible, it’s better to include code snippets that are properly formatted with Markdown, or direct links to relevant code in Github.

Also, be sure to review the example that shows some things to keep in mind when posting.

I think @YvaGithub's initial post was too broad. What was presented was all the code and information that it was not working. In this situation, I think it'd be more helpful to start by focussing on one specific issue (e.g. the warning about $isPalindrome not being set) and breaking it down into these three parts:

  1. What are you expecting to happen?
  2. What have you done to try and make that happen?
  3. How is the outcome different than you're expecting?

You'd be amazed at how sometimes if you take the time to articulate a question like this, you'll actually end up solving your own problem in the process! : )

For anyone who is feeling unsure about how to ask questions, I'd be happy to meet and help "workshop" this. We can look at a problem you're having and talk about how you could effectively post about it.

Thanks @YvaGithub, @patrickgarsow-harvard and everyone else that participated in this thread. I think this is a great discussion that lets us fine-tune our troubleshooting skills.

YvaGithub commented 2 years ago

Thanks to Prof. Susan with whom I had a 1and1 zoom meeting, I got design A to work properly. My issue came when I started to build on design A to produce design C. I totally understand the concept of SoC and the steps to take to accomplish it. However, in moving some snippets of codes around, it stopped working and generated some warnings that were a bit challenging to debug. By sharing all these codes, I was hoping to provide as much information as I could as they seem relevant to any potential fixes to issue. I am gladly taking your advice into consideration and I will check out your code for comparison purposes. Thank you for sharing. Greatly appreciated, Yvaral

On Wed, Feb 16, 2022, 10:38 AM Susan Buck @.***> wrote:

Some useful tips from @patrickgarsow-harvard https://github.com/patrickgarsow-harvard, thank you for sharing!

I want to share some follow-up notes:

  • Local/global variables aren't relevant to @YvaGithub https://github.com/YvaGithub's problem. If he was trying to define a variable in a function and use it outside the function, then it would be relevant.
  • For the problem at hand, I would not worry about studying bigger design patterns like MVC - models aren't relevant yet. There's time to get into that later - P1 is about the fundamentals.
  • Good tips about studying other's code. đź‘Ť A useful exercise might be to look at other examples and talk out loud through each step, making sure you understand what is going on. This similar practice ("rubber duck debugging" https://en.wikipedia.org/wiki/Rubber_duck_debugging) can apply to our own code as well.
  • Let's be cautious about commenting on the timeliness of classmate's questions. I think it's clear that if we can post earlier, it's more beneficial, but we don't know everyone's circumstances. I don't want to get into situations where students don't post, just because they're afraid it's too late, or their question is too simple, etc.

Adding on to all of this, I do have some tips/reminders for everyone about how we're asking questions, pulling from the "about" page for the course forum https://hesweb.dev/e15/forum-about:

  • Write clear, to-the-point, informative post titles.
  • When relevant, include your Github repository URL (with the latest changes pushed) and tell us the specific files you’re asking your question about.
  • Do not share screenshots of code - they can be hard to read and it’s not possible to copy/paste from them. Whenever possible, it’s better to include code snippets that are properly formatted with Markdown, or direct links to relevant code in Github.

Also, be sure to review the example https://hesweb.dev/e15/forum-about#Examples that shows some things to keep in mind when posting.

I think @YvaGithub https://github.com/YvaGithub's initial post was too broad. What was presented was all the code and information that it was not working. In this situation, I think it'd be more helpful to start by focussing on one specific issue (e.g. the warning about $isPalindrome not being set) and breaking it down into these three parts:

  1. What are you expecting to happen?
  2. What have you done to try and make that happen?
  3. How is the outcome different than you're expecting?

You'd be amazed at how sometimes if you take the time to articulate a question like this, you'll actually end up solving your own problem in the process! : )

For anyone who is feeling unsure about how to ask questions, I'd be happy to meet and help "workshop" this. We can look at a problem you're having and talk about how you could effectively post about it.

Thanks @YvaGithub https://github.com/YvaGithub, @patrickgarsow-harvard https://github.com/patrickgarsow-harvard and everyone else that participated in this thread. I think this is a great discussion that lets us fine-tune our troubleshooting skills.

— Reply to this email directly, view it on GitHub https://github.com/susanBuck/e15-spring22/issues/15#issuecomment-1041738707, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKCUDIGGS3O3VYVYEMM4DWLU3PAGLANCNFSM5OQEM2GA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>