Jump to content

First Year Computer Science Student can't code


dazzahatty

Recommended Posts

Hi, I'm new to the forum and just seeking advice with programming in general. I've studied computer science for one year and I don't feel I understand enough about coding/programming. I'm really concerned about this as I have a programming assignment that's due the start of August and I've made very little progress with it.

The other modules that don't involve as much coding and programming I've been absolutely fine with. It's just the programming assignments. I cannot build programs, I really don't know why. My brain just cannot understand it and as a computer science student, that's a massive problem.

Can anybody please help?

Thank you.

Link to comment
Share on other sites

Quote

Can anybody please help?

I usually watch Udemy/YouTube videos. There is a general rule of thumb to do well (in college)

  1. Invest in a fast computer and internet connection. It should have be able to boot Windows, Mac, and Linux at least (3TB hard drive)
  2. Comment every function. Try to follow standards like JavaDoc.
  3. Use design patterns. (download cheatsheets)
  4. Use private variables with getters/setters everywhere. 
  5. StackOverflow is your friend. When asked to code a function it will generally be one the lecturer copied from a website somewhere.
  6. Use a good IDE,  some examples are Intellij idea.

This guy makes a joke about it but it "should" get a good mark.

 

Link to comment
Share on other sites

What is the most sophisticated program you have created? Show source code (icon <> in the toolbox allows you to insert a formatted code in the reply).

I guess so you made "hello world" etc. right?

Then you had to make other basic assignments like loops, arrays, classes, sorting data, parsing arguments from command-line, creating UI, right? What kind you made?

 

Have you been taught about class diagrams?

https://en.wikipedia.org/wiki/Class_diagram

Flowcharts?

https://en.wikipedia.org/wiki/Flowchart

Try splitting task to flowchart and draw it on piece of paper what you have to do in each step. Step-by-step. Eventually use flowchart software like Flowgorithm.

Any task can be divided into every line of code in the most extreme variant.

 

 

Beginners should use debugger a lot. Have you been taught how to use it? Use step-in every line of code. Display content of variables, constants, globals, arrays, private members (local variables) of classes, observe how they change after every line. This may be a mind-opening experience in the programming teaching process if you really are a beginner.

 

 

Link to comment
Share on other sites

8 hours ago, Sensei said:

What is the most sophisticated program you have created? Show source code (icon <> in the toolbox allows you to insert a formatted code in the reply).

I guess so you made "hello world" etc. right?

Then you had to make other basic assignments like loops, arrays, classes, sorting data, parsing arguments from command-line, creating UI, right? What kind you made?

 

Have you been taught about class diagrams?

https://en.wikipedia.org/wiki/Class_diagram

Flowcharts?

https://en.wikipedia.org/wiki/Flowchart

Try splitting task to flowchart and draw it on piece of paper what you have to do in each step. Step-by-step. Eventually use flowchart software like Flowgorithm.

Any task can be divided into every line of code in the most extreme variant.

 

 

Beginners should use debugger a lot. Have you been taught how to use it? Use step-in every line of code. Display content of variables, constants, globals, arrays, private members (local variables) of classes, observe how they change after every line. This may be a mind-opening experience in the programming teaching process if you really are a beginner.

 

Hi Friend, Thank you for your response this wordsearch application is my most sophisticated program I have built so far. Im now tasked to move away from this area of programming and use lists, classes, polymorphism, encapsulation and other things to build a working uno game. Ive reached the point of having a deck, now i need to work out how to shuffle the deck and deal out cards to each player. It's really confusing for me.

using System;
using System.IO;


namespace WordsearchACW
{
    class Program
    {
        //hardCode is the name of the board. This method is using hardCode to display the board and produce the numbers at the sides of the columns and rows.
        //This block of code is also used to change the colour of the rows and column numbers to yellow.
        static void ShowBoard(string[,] hardCode)
        {
            Console.Write(" ");
            for (int column = 0; column < hardCode.GetLength(0); column++)
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.Write(" " + column);
                Console.ResetColor();
            }

            Console.WriteLine("");
            for (int rows = 0; rows < hardCode.GetLength(1); rows++)
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.Write(rows);
                Console.ResetColor();

                for (int column = 0; column < hardCode.GetLength(0); column++)
                {

                    Console.Write(" " + hardCode[column, rows]);

                }
                Console.WriteLine("");
            }

        }
        public struct WordsCoords
        {
            public int startRow;
            public int endRow;
            public int startColumn;
            public int endColumn;
        }
        // This method sends a prompt to the user which then returns a value within a range from the given prompt
        static int GetNumber(string Message, int Min, int Max)
        {
            int result;

            do
            {
                Console.WriteLine(Message + Min + " and " + Max + " inclusive.");

                result = int.Parse(Console.ReadLine());
            } while (result < Min || result > Max);

            return result;
        }

        static void Main(string[] args)
        {
            string[,] hardCode = new string[0, 0];

            //Creating a menu to choose the variois different options, produce a hardcoded wordsearch from File01 and read in the other 6 files.

            Console.WriteLine("Wordsearch ACW");
            Console.WriteLine();

            Console.WriteLine("Select an option: \n1. Use default wordsearch \n2. Load wordsearch from file");
            Console.WriteLine();

            Console.WriteLine("Enter a number from 1 to 2 inclusive");

            int input = int.Parse(Console.ReadLine());

            Console.Clear();

            if (input == 1)
            {
                hardCode = new string[9, 5];

                // Using the random generator to generate a random letter in an 8x4 grid
                Random rlg = new Random();

                for (int letter = 0; letter < hardCode.GetLength(1); letter++)
                {
                    for (int nextLetter = 0; nextLetter < hardCode.GetLength(0); nextLetter++)
                    {

                        hardCode[nextLetter, letter] = Convert.ToString((char)rlg.Next('a', 'z'));
                    }

                }
                // This code is treating the strings algorithm and virus as first ints and then chars and manipulating those specific co-ordinates on the grid to produce the words.
                string wordOne = "algorithm";
                for (int i = 0; i < 9; i++)
                {
                    hardCode[i, 1] = wordOne[i].ToString();
                }
                string wordTwo = "virus";
                for (int j = 1; j < 6; j++)
                {
                    hardCode[j, 4] = wordTwo[5 - j].ToString();
                }

                ShowBoard(hardCode);

                Console.WriteLine("\nWords To Find\nalgorithm\nvirus\n");

                do
                {
                    int startColumn = GetNumber("Please enter start column\nEnter a number between ", 0, 8);
                    int startRow = GetNumber("Please enter start row\nEnter a number between ", 0, 4);
                    int endColumn = GetNumber("Please enter end column\nEnter a number between ", 0, 8);
                    int endRow = GetNumber("Please enter end row\nEnter a number between ", 0, 4);

                    // Make start column, start row, end column, end row = the values on the board to find algorithm and virus

                    if (startColumn == 0 && startRow == 1 && endColumn == 8 && endRow == 1)
                    {
                        Console.WriteLine("Congratulations you found algorithm!!!!");
                    }
                    else if (startColumn == 5 && startRow == 4 && endColumn == 1 && endRow == 4)
                    {
                        Console.WriteLine("Congratulations you found virus!!!!");
                        break;
                    }
                }
                while (true);

                Console.Clear();
                Console.WriteLine("Congratulations you have found all of the words\n");
            }
            else if (input == 2)
            // This code is reading in the files
            {
                string[] files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.wrd");
                for (int i = 0; i < files.Length; i++)
                {
                    Console.WriteLine((i + 1) + ". " + files[i]);
                }
                int fileNumber = GetNumber("Please enter a number between ", 1, 7);
            }

            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }

        

    }
}

 

17 hours ago, fiveworlds said:

I usually watch Udemy/YouTube videos. There is a general rule of thumb to do well (in college)

  1. Invest in a fast computer and internet connection. It should have be able to boot Windows, Mac, and Linux at least (3TB hard drive)
  2. Comment every function. Try to follow standards like JavaDoc.
  3. Use design patterns. (download cheatsheets)
  4. Use private variables with getters/setters everywhere. 
  5. StackOverflow is your friend. When asked to code a function it will generally be one the lecturer copied from a website somewhere.
  6. Use a good IDE,  some examples are Intellij idea.

This guy makes a joke about it but it "should" get a good mark.

 

Thank you for your response friend. I'll be sure to check out udemy. I really appreciate this. Thank you so very much.

Link to comment
Share on other sites

On 7/13/2020 at 1:09 PM, dazzahatty said:

I cannot build programs, I really don't know why. My brain just cannot understand it and as a computer science student, that's a massive problem.

Which aspect is it that causes the problem, do you think?

Is it the concept of telling the machine what to do? Or is it the specifics of programming languages?

 

Link to comment
Share on other sites

7 hours ago, dazzahatty said:

Hi Friend, Thank you for your response this wordsearch application is my most sophisticated program I have built so far. Im now tasked to move away from this area of programming and use lists, classes, polymorphism, encapsulation and other things to build a working uno game. Ive reached the point of having a deck, now i need to work out how to shuffle the deck and deal out cards to each player. It's really confusing for me.

So, you have e.g. Card class with private members,

and Deck class where it is subclass of ArrayList, List<Card>, or manually implemented list?

I see you're accustomed with randomization in your previous project that you showed above.

Shuffling can be done by getting a random number in the range of 0... number of cards in the deck-1, which will be index to card in the list, getting this card object, repeating a 2nd time, and swapping them together (get/set or remove/insert, the first will be faster for CPU). Repeat this process multiple (hundred?) times in a loop.

 

Edited by Sensei
Link to comment
Share on other sites

  • 5 weeks later...

Zed Shaws book." Learn Python the Hard Way".  Was very helpful to me.  I think that writing some sort of text adventure is an excellent way to learn the basics of most any language.  That's why I liked that book so much because it taught Python concepts through making the game

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.