![]() |
Quotes from the Chief Engineer and I
(warning: the following story is about matrices.)
Today in AP Computer Science my teacher was lecturing us about how when creating a matrix, for example Matrix[3][3], the first set of brackets is rows and the second is columns. While this is usually convention, it is not actually how a matrix will work as the way we draw arrays, like the one above: [0,0][0,1][0,2] [1,0][1,1][1,2] [2,0][2,1][2,2] Is just a way for us to visualize, and not how they are actually created in the computer, as my teacher so believes. That is why I could draw the above like this: [0,0][1,0][2,0][0,1][1,1][2,1][0,2][1,2][2,2] or even this: [0,0][0,1][0,2] /////////////////[1,0][1,1][1,2] //////////////////////////////////[2,0][2,1][2,2] or even if I so choose I could draw it like this: [0,0][1,0][2,2] [0,1][1,1][2,1] [0,2][1,2][2,2] After a heated debate with my teacher over whether or not a computer actually builds out an array in the ordered fashion like this: [0,0][0,1][0,2] [1,0][1,1][1,2] [2,0][2,1][2,2] We decided to just dropped it. But now to the point of the post. My Chief Engineer and I were discussing the above designs and how all of them will work because you're drawing an imaginary things and it doesn't matter if you draw the cells as gummi bears it will work when I turn to him and say "People don't care about convention so long as you comment it enough!" (-Lord Supreme Programmer Isaac and Chief Enginerr Robert, 2/25/15) So if there is a lesson to be learned it is comment your code, kids. Even though good code should speak for itself. |
Re: Quotes from the Chief Engineer and I
How members of an array are stored and accessed is a function of the programming language. It is not something one should worry or argue about since the language will reference and de-reference everything for you. "Row" and "Column" mean nothing to the compiler. Notation has nothing to do with the physical location since memory is laid out so one accesses word-sized elements in sequence. In C and C++ matrices and arrays are really done with pointer arithmetic - google it.
|
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
I think you mean "Pascal". And C/C++ (counted together) is far and away the most popular programming language.
|
Re: Quotes from the Chief Engineer and I
Paskell sounds like an odd mix of Pascal and Haskell. That could be interesting...
|
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
I remember winning a 64mb drive in college for a CAD competition about 9 years ago. THAT was a big deal. |
Re: Quotes from the Chief Engineer and I
Quote:
1. He asks if they still make firesticks 2. I explain to the class what a firestick is 3. He asks if they would be useful or if we would prefer storing them in the "Lightning Cloud" 4. He says that we will buy 4mb firesticks from Circuit City. 5. He shows up with 4gb jumpdrives he bought for $25 a piece. 25 dollars. Where did he find them so expensive????? 6. We explain to my teacher how a gigabyte and megabyte are different. |
Re: Quotes from the Chief Engineer and I
Quote:
OP, it's crazy how quickly people can fall behind the times without even knowing it. Pick your battles in this kind of situation as some will never be won with either knowledge or wisdom. Might as well offer a coffee and talk about the weather instead. |
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
I believe you were looking at some form of serial or parallel port. Probably a many-pin one. VGA, if I'm not mistaken, is another form of serial port. You use serial ports on a near-daily basis if I'm not mistaken--on the Universal Serial Bus (USB). (Incidentally, I had to boot up a Windows 2000 computer last night. Why, you ask? Because it can run program X. Program X serves a key function in this application. Old technology? Yep. Does it JUST WORK? Yep, unless someone turns it off...) |
Re: Quotes from the Chief Engineer and I
Quote:
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
Say you have a matrix that you are representing as a 2D array: |a b c | |d e f | |g h i | C/C++ structures this in row-major order. This means that the elements are physically arranged sequentially in memory in this order: a, b, c, d, e, f, g, h, i Fortran structures this in column-major order. Physically, they are represented as: a, d, g, b, e, h, c, f, i Each element is at a particular "address" in memory, which is usually expressed as a hexadecimal number. The elements of the array will be stored sequentially. This means that if element 'a' is stored at 0x1AFF3114, then (in C/C++) element 'b' will be stored at 0x1AFF3115, 'c' at 0x1AFF3116, and so on. In Fortran, 'd' would be at 0x1AFF3115, 'g' at 0x1AFF3116, 'b' at '0x1AFF3117' and so on. Why does this matter? It is much faster to access elements sequentially than nonsequentially for most physical storage media, sometimes even orders of magnitudes faster. It won't make much of a difference for simple problems with 3x3 or other small matrices, but when dealing with very large matrices with thousands or even millions of elements (which appear in many real engineering problems, for example, the matrices created by FEA software-) it becomes very important. As a result, it is useful to know what order your programming language lays out its multidimensional arrays in memory, and to write your algorithms to access them in sequential order when possible. |
Re: Quotes from the Chief Engineer and I
Quote:
The other day I had to go find an IEEE-1200 to preferably USB or VGA or anything that would work with an old printer. Just imagine the look on the guy at RadioShack's face when I asked for one. He asked me what VGA was! |
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
And commenting isn't really an option, it's more of a requirement, for anything! Think of it like homework that is assigned, but not collected. Sure, you MIGHT be okay not doing it every now and then, but really, you have to do it. |
Re: Quotes from the Chief Engineer and I
Quote:
Turns out it ended an if statement. Boy was I tired. |
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
Quote:
Quote:
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Since I guess no one else has mentioned it, the only reason OP is "correct" is because in Java "2d" arrays neither row-major nor column-major. Java arrays aren't truly multidimensional (all data contiguously stored in rm or cm order) they're just arrays of arrays.
|
Re: Quotes from the Chief Engineer and I
Quote:
[][][] [][][] [][][] Because while it may be all nice and cool to look at it's not how I've always understood them to be. |
Re: Quotes from the Chief Engineer and I
One thing to remember is that conventions exist for a reason. It is for some purposes important to know whether a computer stores:
a b c d e f g h i as: a b c d e f g h i or: a d g b e h c f i It is also sometimes important to know if your language interprets a two dimensional array as an array of arrays or as one array. (This usually determines where the data are actually stored.) As has been said, it can be important to know how your language, or more properly how your compiler, does storage to make certain processes faster. But in most cases if you are trying to understand a two dimensional matrix as a linear thing you are missing the point. If you had data that was appropriately thought of as linear you should use a one dimensional array. The convention exists in order to make it easier conceptually to understand the relationship between the pieces of data. I have an old boss who would probably say something like "Yes, you can conceptualize this as column, row and comment it and the code will work. But you won't. At least here." You should use a matrix when you have data that is being referenced according to two different indices or categories. Consider an example. Imagine you are storing data for one of three different starting orientations for your robot and five different initial positions. This is a case where there is no obvious reason to make one the row and one the column. When you are designing the program, if you create a 3 row by 5 column table your coding standards should absolutely dictate how that will be coded. It should not be up the whim of one individual programmer. The row major convention was most likely chosen because a majority of the people who developed the programming languages we now use read and write in a left to right, top down (in other words row major) language like English. |
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
http://zone.ni.com/reference/en-XX/h...sing_matrices/
Matrices a la LabView. http://www.mathworks.com/help/matlab...nd-arrays.html Matrices a la MatLab. Sometimes arguing about the visual representation of data is basically a course in UI and graphics arts. You can spend literally your entire life arguing which view is the best one. Like any communications - the 'right' one is that one that manages to deliver the right messsage as fast as possible to the audience to which it was intended. |
Re: Quotes from the Chief Engineer and I
Quote:
I'll try to be clearer: My post had nothing to do with "arguing which view is the best one". It was simply pointing out that there are domains in which a knowledge of how your programming language stores matrix elements is important. |
Re: Quotes from the Chief Engineer and I
Quote:
I intended to address the topic in general. However to go back to your point, if you consider the computers 'view' of the data you are absolutely correct. Just as it wouldn't make sense to fight little-endian / big-endian it doesn't make any sense to fight the way your language works. http://en.wikipedia.org/wiki/Endianness Quote:
|
Re: Quotes from the Chief Engineer and I
Don't forget that OP is in a AP CS course. Java is a tool to teach basic concepts in CS, not just programming, not just a specific language.
It's basically beginning course, in which you are learning the basic building blocks, vocabulary, and conventions. This is how people in the trade communicate with each other. |
Re: Quotes from the Chief Engineer and I
I mean it does not matter, but the JVM does attempt to store one-dimensional arrays contiguously, especially for primitives. Though there is, of course, no guarantee.
It is just much easier to imagine a matrix with 0,0 at the top left since this is how so many things in Java are represented. The only time I was able to use a non-standard matrix was in LibGDX where it represents it's display with 0,0 at the bottom (though you can flip it). Of course you are right though, I can represent a Matrix as a NxM length single-dimensional array if I wanted to. |
Re: Quotes from the Chief Engineer and I
Quote:
Take this as training for dealing with a boss that annoys you, or motivation to start your own company so that you can be that annoying boss.;) |
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
While "int" and "char" ARE primitives in Java, there are also "Integer" and "Character" objects in Java, that have one field, either a int or char, respectively. While that probably isn't the case, just thought I would check. I'd also like to point out something else: AP Computer Science is a GREAT course. It was my favorite course when I was in high school. However, I also had a GREAT teacher (Shoutout to my former teacher, Mr. Mike Reilly). The teacher can really make or break the class. If you feel so strongly that your current teacher is wrong on multiple accounts, I suggest you do the following: 1) Document these instances. Write down what he said/assigned on the quiz, and what your answer was, and what the teacher said the correct answer was. 2) For every instance of incorrect teaching, RESEARCH and be able to prove that these instances are incorrect. This means doing lots of research, such as reading the Java documentations, and maybe create example programs to show the difference between what the correct answer is vs what your teacher says the correct answer is. 3): After doing this research, write everything into a Word document, with both the inaccurate information and the correct information, including your source. Respectfully talk to your teacher, and ask him about all these points. If that doesn't change anything, you might consider talking to your school's administration. I would first write another paper, but a bit more formally, with a list of things that were taught or graded inaccurately, perhaps like this: Code:
Discrepancy One: Mr. TeacherName gave a quiz with the following question: "The moon is a square, True or False". Mr. TeacherName graded the quizzes, with the correct answer being "True". Include an introduction, with a brief history of what is going on with the class. After you have written the paper, see if one of your English teachers will help you proofread it, and ask for their opinion on the formatting. Once the paper is finalized, ask to talk to your principal about the matter. Bring a copy of the paper with you. When talking to your principal, it is EXTREMELY important that you remain respectful, but also bring up the fact that your teacher is not adequately preparing the student for the AP exams, and is potentially teaching incorrect information. (Also remember this: APCS is not a subject many will be familiar with, so try to not get TOO technical when explaining any incorrect information.) Remember, your goal is to create a better class for future students, which in turn will raise the average AP scores for the class, which in turn makes the school look better. It should also be noted that talking to any administration should be your last resort, it is almost akin to the "nuclear option". And also, do remember that during this whole process, it is important to not be combative, but rather try and be seen as a student who deeply cares about the subject and is trying to learn more. Hopefully just talking to your teacher, with the correct information documented, will be enough. Most teachers genuinely care and want to help you succeed. While it may be too late for this year's class, maybe next year will be better for your fellow students. Edit: This is coming from what I would do, and is similar to what I did when I had a very bad experience with a teacher my senior year. Before doing anything, I would first: Talk to your parents about this, and second: Talk to a trusted teacher you have about what the best protocol would be in this situation, (But please make 100% sure you are correct and can prove it, before talking to another teacher about this.) |
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
I'm surprised that students were simply "placed" into a AP course, much less a CS course. When I was in high school it was an elective, with a decent amount of prerequisites. As for what text book to use? No idea. I don't remember what book we used when I took the test, that was in 2010. Does your school not provide any textbook at all for the course? |
Re: Quotes from the Chief Engineer and I
Quote:
The kids were placed in because we needed more kids for it to be a class, they get math credit, and the school gets money for each kid that takes AP Computer Science. |
Re: Quotes from the Chief Engineer and I
While this is now going off-topic:
Have you learned anything specific to the AP test? I know when I took the test, something like 40% of the questions involved Gridworld. You will need to know more than just syntax for the test. |
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
While students can't access the practice exams, your teacher can sign-in and access them. Those might be a good indicator of how much more you should be doing. |
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Alright, here's a question for you guys: Would you rather have a teacher who has some past experience in Computer Science but teaches it badly and sometimes incorrectly, or a teacher who has very little CS experience, but is willing to learn how to teach the class and would accept student input?
|
Re: Quotes from the Chief Engineer and I
Quote:
Particularly I find being extremely critical either way is often counter to the goal. Sometimes one can get more from the act of discussion than the act of critique. Especially if it crosses into the confrontational. Once it becomes confrontational the opportunity for either participant to learn is lost in playing defense. |
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
|
Re: Quotes from the Chief Engineer and I
Quote:
I think if we did this format it would probably only last one year. After that year the teacher would probably have learned enough to make a curriculum to teach, but even then I think most of the research would be student led. Also, would you happen to know a Laurie Buchanan? She was one of my favorite teachers last year, and I noticed you guys have the same last name. Just wondering. |
| All times are GMT -5. The time now is 21:04. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi