ChiefsPlanet

ChiefsPlanet (https://www.chiefsplanet.com/BB/index.php)
-   Nzoner's Game Room (https://www.chiefsplanet.com/BB/forumdisplay.php?f=1)
-   -   Computers Nerd homework (https://www.chiefsplanet.com/BB/showthread.php?t=340277)

ptlyon 10-14-2021 11:18 AM

Quote:

Originally Posted by stanleychief (Post 15893412)
I just hope this kid renames the variables before turning in the code. If I were grading the assignment, I'd be raising an eyebrow if the variables were French. ROFL

I once worked on some client's code, which was apparently written by a guy named Eric. Every variable in his code was prefixed with 'eric'. So the SQL DB connection was 'ericDbConn', and the result set was 'ericDbResult', the datarow object was 'ericDbRow', etc.

I thought that was pretty damned hilarious!

What was this piece of code written for, if I may ask?

Otter 10-14-2021 11:21 AM

Curly brackets?

Apparently it's been awhile since I dipped my toe in C world so I'll just say make the code more linear and unless he's coding for a French person use the English Language for comments.

stanleychief 10-14-2021 11:32 AM

Quote:

Originally Posted by ptlyon (Post 15893420)
What was this piece of code written for, if I may ask?

It was a long time ago, but I believe that particular code was embedded in a classic ASP page. He was fetching options from the database to populate a select tag on a form.

I recall that the guy left a lot of comments too, which is usually a good thing, but his comments were unnecessary, as they didn't explain anything helpful. Example:

Code:

// This is the database connection
Dim ericDbConn = Server.CreateObject("ADODB.Connection")

Pretty obvious, given the naming, and straight-forward variable assignment. Struck me as if they were written by someone just out of school. The client was a large regional grocery store chain.

ptlyon 10-14-2021 11:38 AM

Quote:

Originally Posted by stanleychief (Post 15893450)
It was a long time ago, but I believe that particular code was embedded in a classic ASP page. He was fetching options from the database to populate a select tag on a form.

I recall that the guy left a lot of comments too, which is usually a good thing, but his comments were unnecessary, as they didn't explain anything helpful. Example:

Code:

// This is the database connection
Dim ericDbConn = Server.CreateObject("ADODB.Connection")

Pretty obvious, given the naming, and straight-forward variable assignment. Struck me as if they were written by someone just out of school. The client was a large regional grocery store chain.

That was my first thought as well. Naming conventions have always been my downfall. I've learned some, but still sometimes go back to what makes sense to me at the time.

stanleychief 10-14-2021 11:44 AM

Quote:

Originally Posted by ptlyon (Post 15893465)
That was my first thought as well. Naming conventions have always been my downfall. I've learned some, but still sometimes go back to what makes sense to me at the time.

There are only two hard things in Computer Science: cache invalidation and naming things.
-- Phil Karlton

https://martinfowler.com/bliki/TwoHardThings.html

Monticore 10-14-2021 11:53 AM

Quote:

Originally Posted by Otter (Post 15893430)
Curly brackets?

Apparently it's been awhile since I dipped my toe in C world so I'll just say make the code more linear and unless he's coding for a French person use the English Language for comments.

French Highschool so the French is mandatory , it sucks lol.

Monticore 10-14-2021 11:56 AM

Quote:

Originally Posted by stanleychief (Post 15893485)
There are only two hard things in Computer Science: cache invalidation and naming things.
-- Phil Karlton

https://martinfowler.com/bliki/TwoHardThings.html

Well he managed to figure it out , he says it worked like it was supposed to but he said he didn't code it like the teacher did , he said the tips in here were helpful.

thanks fellas .

stanleychief 10-14-2021 12:03 PM

Quote:

Originally Posted by Monticore (Post 15893504)
French Highschool so the French is mandatory , it sucks lol.

Oh, completely missed that! I assumed that he found an example of the code in French and was trying to use it in an English computer science class. He should probably keep those variable names in French then. :)

Glad to hear that this helped. Is your son looking to pursue a career in computer science, or is this just one of his classes? Programming can be intimidating at first, but if he sticks with it, things will become easier. All that gibberish starts to make sense at some point.

Monticore 10-14-2021 12:20 PM

Quote:

Originally Posted by stanleychief (Post 15893527)
Oh, completely missed that! I assumed that he found an example of the code in French and was trying to use it in an English computer science class. He should probably keep those variable names in French then. :)

Glad to hear that this helped. Is your son looking to pursue a career in computer science, or is this just one of his classes? Programming can be intimidating at first, but if he sticks with it, things will become easier. All that gibberish starts to make sense at some point.

I recommended he try it out since he always liked the idea of maybe getting into robotics , he is very strong in math, physics and chemistry and likes problem solving ,unfortunately it is a subject my wife or I can't help much with , he just procrastinated a bit and was getting flustered and was hoping a tip or two might get him back on the right track which it did.

ptlyon 10-14-2021 12:41 PM

Not sure how many more labs he will have, but here's a piece of advice our instructors gave us.

When you're trying to work out a problem with your code, step away. Do something else, get your mind off of it. Sometimes clearing your mind will bring you the answer.

Also when you go to bed, put a pad and pen next to your bed. You would be surprised how many times that worked for me, waking up with either an answer to a problem or an idea of how to write a program in the middle of the night.

Good luck.

Monticore 10-14-2021 12:55 PM

Quote:

Originally Posted by ptlyon (Post 15893643)
Not sure how many more labs he will have, but here's a piece of advice our instructors gave us.

When you're trying to work out a problem with your code, step away. Do something else, get your mind off of it. Sometimes clearing your mind will bring you the answer.

Also when you go to bed, put a pad and pen next to your bed. You would be surprised how many times that worked for me, waking up with either an answer to a problem or an idea of how to write a program in the middle of the night.

Good luck.

Exactly what I was trying to explain to him last night , he is still young and stubborn he will learn.


All times are GMT -6. The time now is 09:09 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2024, vBulletin Solutions, Inc.