2013年4月10日水曜日

Beginner Question - What is SSCCE?

For beginner programmer, you will found out this words comes out very often on java software developing forum such as stackOverflow. What does SSCCE mean?

If you have looks at the SSCCE link. 5 big words is highlighted on the top of the page.

sscce1

And the following things is the content that filled with dozens of words to explain what does it means and why do we need to do it.

I know many programming beginner is short of patient and want their answer comes out immediately instead of reading a long long article to understand the content. SO,

What is SSCCE? It is

  • Make your question as short as possible
  • Make your question easy to be understand
  • Post compilable code instead of parts of your work ( Simple code applying your problems. exp. public static void main )

Usually, people say “please post sscce”. It means post a runnable code that show the problems you are having and can be copy and paste and straight to be compiled on IDE (IDE means the software that used of developing application, exp. eclipse IDE, visual studio)

Why do we needs to do so?

No matter how well your English is, the best way to tell people what wrong on your code always is allow others compile you works and find the actual error.

For example,

Pretend that you are developing Java Swing application and you are having problems of label is not showing on windows. Here’s the code provided.

  1: public class createLabel extends JLabel {
  2:      
  3:      public createLabel() {
  4:           super();
  5:           setText("HELLO WORLD");          
  6:           setLayout(null);
  7:      }
  8: 
  9: }
 10: 

And the problems look like following.


eeccs2


Maybe you might think that label is not showing because there is an error on your label code so you only post the part of the label. However, you wouldn’t be able to solve it if you only post label code. Let’s me show you why. Take a look at following whole code.


 

  1: import javax.swing.JFrame;
  2: import javax.swing.JLabel;
  3: 
  4: public class createLabel extends JLabel {
  5: 
  6:      public static void main(String[] args) {
  7:           JFrame frame = new JFrame("Title");          
  8:           JLabel label = new createLabel();
  9:                     
 10:           frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 11:           frame.setLocation(300,200);
 12:           frame.setSize(200, 130);          
 13:           frame.setVisible(true);
 14:      }
 15:      
 16:      public createLabel() {
 17:           super();
 18:           setText("HELLO WORLD");          
 19:           setLayout(null);
 20:      }
 21: 
 22: }
 23: 

If you tried to provide the compilable code instead of part of the code. We are able to help you find out what exactly you are having.


From the source above, we can understand that the reason why label is not showing on windows is due to frame.add(label) is not added. There is no problems on label code. So if you are provided a part of the code, you wouldn’t be able to found out what exactly problems you are having.

0 件のコメント:

コメントを投稿