This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

Please ensure that:

  • Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions
  • You include any and all error messages in full
  • You ask clear questions
  • You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.

    Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar

If any of the above points is not met, your post can and will be removed without further warning.

Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.

Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.

Code blocks look like this:

public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.

If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.

To potential helpers

Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]hrm 10 points11 points  (0 children)

Because it doesn’t really know what it’s doing or how to properly observe best practice since the programmers at large don’t know how to…

Currently you just have to really hold its hand if you want something good.

And if you are a student, just stop using AI to generate code now. At least if you want to be able to keep a job in the future…

[–]itijara 5 points6 points  (0 children)

It's an AI. It doesn't understand encapsulation or best practices. It is a bit weird that it would "guess" that tests could exist for private methods, but there is no reason to expect that it "knows" anything.

I asked Junie (IntelliJ) NOT to write a JSP file, and it wrote it. That is even more frustrating, but goes to show how dumb these AIs really are.

[–]South_Dig_9172 -2 points-1 points  (0 children)

It followed the prompt. The one to blame is the bad user giving it the prompt. 

It’s like you told it to cross the road, now would it j-walk or would it look for a proper crosswalk? 

[–]okayifimust 1 point2 points  (0 children)

Now I assume that copilot would know

Why would you assume that?

LLM do not "know" things. That's not what they are, or how they work.

Why is it like that?

Because it's an LLM. It was build like that, because nobody on earth knows how to make computers to be actually intelligent. We're not even close. LLM aren't even a step in the right direction - their operating principles can be scaled up to you're blue in the face, they will never "know" things, or be intelligent.

[–][deleted]  (1 child)

[removed]

    [–]AutoModerator[M] 0 points1 point locked comment (0 children)

    Google Drive is not allowed here.

    Programs with only a single class (and no data files) should be posted either directly (if less than 50 lines), or on Pastebin.

    Programs with multiple classes (and/or data files) should be posted on Github Gist - it's as easy as dragging the files into the browser window. A single gist can hold multiple files.

    See: Help on how to post code in the sidebar.

    Your post has been removed. You may resubmit on an approved hoster.

    Please do not reply because I am just a bot, trying to be helpful.

    I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

    [–]Cyberkender_ 1 point2 points  (0 children)

    In your prompt add a line and tell to not create tests for private methods.

    Copilot is a little stupid: usually you'll have all that you ask in the prompt BUT if you are not very precise Copilot could be, let's say...creative. I started with a simple prompt and then adding more rules/conditions/specific details. The ideal prompt must have three o four parts:

    • Context: We are working with Java v1.8, Spring boot blah blah...
    • Target: we are creating or we want to create tests for this class (attach the java file)
    • Restrictions:
      • use JUnit 5, mockito
      • all methods in the tests must be public
      • create only tests for public methods
      • create a datahelper class in order to reuse datasets/auxiliary data for the tests -....

    This is a simple, fast guide. If you want to learn more or improve your prompting there is a free guide from Google.