Sunday, January 9, 2011

Open thread: Static features & Lab 1

This week we are talking about static features of classes.  Discuss in this thread.

35 comments:

  1. Would it be possible for you to tell us which parts of the book will be covered for each week?

    For example, in the calendar I see that Chapter 4 is there for the next three weeks. Any way we could know which parts of Chapter 4 will be covered each week?

    ReplyDelete
  2. We are going to jump around a bit. Best to match up the topic of the week with the relevant sections of Chapter 4 in the book.

    ReplyDelete
  3. Many of us who have taken CSE1020 used JEdit as the text editor. It would be really helpful if somebody could post a write-up of how to set-up the Eclipse to generate javadocs and API...

    ReplyDelete
  4. In the Circle class which was done during the lectures shouldn't the statement public static double PI = 3.1416; be public static final double PI = 3.1416; since PI is a constant ??

    ReplyDelete
  5. Question about the lab this week, according to the CSE 1030 website under Calendar, there is a programming exercise PEx01. Are we expected to have completed that programming exercise prior to coming to the lab? Or is that exercise what we will be doing during the lab?

    ReplyDelete
  6. You guys can leave your names with your comments, you know.

    Anonymous @4:34: Yes, we'll talk about that next class.

    Anonymous @5:51: PEx01 is what you will be doing in the lab. You can look at it in advance if you want.

    ReplyDelete
  7. Professor Eckford,

    I looked at the Lab exercise, and I will have no problems completing it. I will attend the lab in order to register myself by signing in, but is it necessary to come at 2:30 pm in order to do so? Can I come later on, such as 3:30 pm and sign in then? Essentially, will my attendance at the lab be counted regardless of the time I attend the lab?

    Thank you.

    ReplyDelete
  8. Ryan: You can sign in at any time. But if you want to play games about exactly how you can sign in and be counted for attendance, then you are massively missing the point about why we are doing this. It's not that big of a thing to ask you to go to your labs, sit and listen to the TA, and talk with your friends about how to do the lab. Again, the best and only way to succeed in this course is to PRACTICE. That's what the lab is for.

    ReplyDelete
  9. Professor Eckford,

    Thank you for your reply, I fully understand your reasoning, and could not agree more. I will definitely attend the lab and complete it, but the issue is that I may be not able to attend the entire lab for personal reasons. I therefore want to ensure that I do attend for as long as possible, and understand exactly what is being taught. Thank you for your kind response, I will strive to commit myself to the entire lab, and in all honesty have no intention to "play games".

    ReplyDelete
  10. Professor Eckford,
    I was wondering if we are going to have a practice lab test prior to our actual lab test so that we have an idea of what we can expect on the actual lab test?

    ReplyDelete
  11. Mehsum: Best practice is to do the labs, as the labtest will have the same format. So we won't be providing separate practice tests.

    ReplyDelete
  12. I want to ask for the answer to the question that Anonymous 4:28 posted.. Im used to jedit and I have no idea how to work with eclipse.. are we gonna learn that in the lab??
    Also, Is there a way to set it up at home like on my own laptop??

    ReplyDelete
  13. I setup Eclipse instead of JEdit in 1020 using the instructions found here: http://www.cse.yorku.ca/java/api/type/eclipse.html


    I don't know how to generate API/java docs just yet but I plan on searching for the answer with Google... maybe you could try the same thing. Here's the first link I found: http://www.eclipse-blog.org/eclipse-ide/generating-javadoc-in-eclipse-ide.html

    @Professor Andrew: Will we be using the blog as the primary form of communicating with fellow students about programming questions? or will a forum be setup?

    ReplyDelete
  14. Dennis: This blog will be the primary means of communication.

    ReplyDelete
  15. does the generated API w/javadoc have to look exactly like the API provided?

    ReplyDelete
  16. @Milton: I believe it should look exactly the same. I have had some problems accomplishing that however.
    One thing I figured out:
    Setting up a custom tag (i.e. precondition) in javadoc.
    When in Eclipse, simply go to Project>Generate Javadocs> Next > Next> and under 'Extra Javadoc options' simply enter the following:
    -tag param -tag pre.:a:"Precondition: " -tag return
    Just make sure to use the tag @pre. in your javadoc comment.

    Another simple thing; since the Mass class model API does not show a Mass constructor, just add this to your code:
    private Mass() {}
    It will make the Mass constructor private, thus unavailable on the API.

    Things I am not getting right:
    When generating my Mass.html page, I get:
    java.lang.Object
    '-> Mass

    instead of
    java.lang.Object
    '-> pex01.Mass

    Also, I get:
    public class Mass extends java.lang.Object

    instead of
    public class Mass extends Object (highlighted)

    And finally:
    Object is never highlighted as well as Methods inherited from the class Object.

    If anyone can help me out with these things, let me know.
    Thank you
    - Asim

    ReplyDelete
  17. Ok I did the la and generated an API but I submitted the html file of both classes in stead of the java file.. is there a way to correct it.. before the deadline.. and will I lose marks if I don't??

    ReplyDelete
  18. @honeyslayer... there are no marks awarded for the labs..!!

    ReplyDelete
  19. @honeyslayer...
    I believe "generate the API" means to implement the Mass class.

    Save your file as a "Mass.java" file. You shouldn't have a html file.

    ReplyDelete
  20. @Jonathan that is implementing the API provided, you also hhave to generate an API for the implementation you write.

    (in other words, you need the .java + the html API)

    ReplyDelete
  21. Prof Eckford,
    Just wanted to let you know, The lab was of no use. The TA's didn't help at all in the lab. I couldn't complete the lab in the given time and there were only two TA's and we were divided into 2 labs so we couldn't get enough time. If it keeps going the way it is then I won't learn much sir. Need Help please!

    ReplyDelete
  22. Anonymous@12:24: Sorry to hear about your negative lab experience. I stopped by the lab and thought the TA was working quite hard to talk to everyone. What do you think should change? You can contact me via email or we can talk in person if you like.

    ReplyDelete
  23. @Milton The implementation that I wrote is Mass.java and Mass API is already provided for us. So we have to write a java class for Mass.

    Note that it says "Generate the API" not "Generate an API".

    ReplyDelete
  24. My lab experience was good, I think the TA did a good job, if you practice then the few questions remaining are quickly answered by the TA.

    I used Eclipse for the first time today though, and I submitted like two directories because I was figuring out how packages work... so, I apologize if it causes any extra work.

    ReplyDelete
  25. Prof Eckford,
    I think the number of T.A's should be increased or we should all be in the same lab where both of the TA's are available. Though the T.A's were trying to help alot but it was difficult for them to go back and forth the labs.

    ReplyDelete
  26. @Anonymous : I experienced the same thing, it was difficult for the T.A's to go back and forth and help everyone. I used Eclipse the first time in my life as well and to be honest i'm not satisfied with the way I worked and i'm still not clear on how to use Eclipse clearly so if Professor Eckford you could provide some online Tutorials on how to use Eclipse it would be great or is it better if I drop by your office tomorrow?

    ReplyDelete
  27. Actually, the TA stayed for at least 15 minutes after class when most people left the lab and was still there when I left the lab.
    =P

    ReplyDelete
  28. Mehsum: I won't provide tutorials on how to use Eclipse, on the principle that I don't like Eclipse and don't use it myself.

    Generally, environments like Eclipse are useful for experienced programmers, but for beginners like you guys, they just make things more confusing. See the "feedback" thread for a simpler way to do things.

    ReplyDelete
  29. I too must concur that the TAs were working quite hard, but there simply were not enough of them, or too many of us at once needing assistance. Something must be done to resolve this issue.

    ReplyDelete
  30. Anonymous 5:47: There is not a huge amount of extra TA time available. As usual the problem is $$$. Do you have a rich uncle? :-) In the meanwhile I'll see what I can do.

    ReplyDelete
  31. Thanks Professor for your reply. I fully understand that monetary restraints are significant. I just wanted to bring this to your attention, especially considering others feel the same way. If something can be done, it would greatly be appreciated.

    ReplyDelete
  32. I have some questions:

    -Are fields the same meaning as attributes?

    -If you have a static method, you aren't allow to access any attributes and constants, but you can access static attributes. Is this right?

    ReplyDelete
  33. Woody: Fields and attributes are the same. Static methods cannot access non-static attributes, but can access static attributes.

    ReplyDelete
  34. @Asim: how should we know we need to add
    private Mass() {}
    since the API does not show a Mass constructor???

    ReplyDelete