tag:blogger.com,1999:blog-46169866955755113382024-02-20T01:59:43.516-08:00InformaticsIlya Markovhttp://www.blogger.com/profile/04412395864181431902noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-4616986695575511338.post-28871555680195065882011-12-03T19:00:00.000-08:002011-12-13T01:17:59.101-08:00Coderetreat in LuganoOn Saturday, December 3, the first <a href="http://coderetreat.com/">Coderetreat</a> took place in <a href="http://www.juglugano.ch/events/meeting_gdc.html">Lugano</a>. It was leaded by <a href="http://hamletdarcy.blogspot.com/">Hamlet D'Arcy</a> and hosted by <a href="http://www.exmachina.ch/">Ex Machina</a>. <a href="http://www.jetbrains.com/">JetBrains</a> was among the global sponsors of the event (thanks to it I increased the number of my T-shirts by one).<br /><br />Coderetreat is a world-wide event where software developers exercise in writing code. In particular, this Coderetreat was organized in six 1-hour sessions (45 mins for coding, 5 mins for discussion and 10 mins for a break) + 1-hour free lunch. In each session the rules were the following.<br /><ul><li>Developers implement the same task (which was the <a href="http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life">Conway's Game of Life</a>, described below).</li><li>The work is done by groups of two people. The groups change each session.</li><li>In the end of each session all the code is deleted.</li></ul><br />The Conway's Game of Life is a self-developing world of cells that can be either alive or dead. The rules of the world are the following.<br /><ol><li>Any live cell with fewer than two live neighbors dies, as if caused by under-population.</li><li>Any live cell with two or three live neighbors lives on to the next generation.</li><li>Any live cell with more than three live neighbors dies, as if by overcrowding.</li><li> 4. Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.</li></ol>Note that the world can be infinite and/or closed from any side (i.e. a cell going to the left arrives from the right). Also the cells, theoretically, may be of any geometrical shape.<br /><br /><br />The whole idea of the event is that every session a set of suggestions is given encouraging developers to explore different approaches to the task implementation. In particular, the following suggestions were given session by session.<br /><br />1. Developers got familiar with the task and started designing and implementing the solution without any restrictions.<br /><br />2. As a result of the previous session, most of the groups had the concepts of a Board/Grid and a Cell that had a boolean state isAlive. First, it was proposed to get rid of the primitive types like boolean and replace them with abstractions. For example, the class Cell may have subclasses AliveCell and DeadCell. Another suggestion was to use "visual" tests, i.e. the tests that can be visually understood even by non-experts, because the game is actually visual. To summarize, the suggestion were:<br /><ul><li> abstractions;</li><li> visual tests;</li><li> test first.</li></ul>3. Since most of the groups followed the standard approach, where the nouns were used to determine classes, it was suggested to think more about verbs and to build classes around them. For example, the main class may still be the Game class, but we should think primarily of its actions that are calculateNextGeneration() and render(). These methods can by directly tested by visual tests (draw a game before and after one step of evolution and compare these two instances) and then implemented. So the suggestions were:<br /><ul><li> verbs;</li><li> methods <= 5 lines, classes <= 3 methods.</li></ul>4. Ping-pong session: one developer writes a test, another one implements it. After some time developers change the roles. Developer that writes tests usually thinks of the trickiest tests he/she can write.<br /><br />5. After the previous session the code was not deleted but each group summarized the advantages and disadvantages of their code on the paper. Then the groups changed the computers. Thus each group was given a code by another group and a summary of its strengths and weaknesses. The task was to improve the code.<br /><br />6. Each group could choose one of the following restrictions:<br /><ul><li> change a programming language;</li><li> do not use the if construction;</li><li> do not use the inheritance (?).</li></ul><br />To my opinion, the event was extremely useful and it is a pity that it happens only once in a year. I think a week of such training may improve one's programming skills considerably and, in fact, there are many companies offering such courses for a huge amount of money. So all in all I would recommend everybody to participate in this event at least once.Ilya Markovhttp://www.blogger.com/profile/04412395864181431902noreply@blogger.com0tag:blogger.com,1999:blog-4616986695575511338.post-78667761032588801402010-06-22T03:08:00.000-07:002010-06-22T03:26:36.300-07:00SPbSU are the finalists of the SIGMOD 2010 Programming Contest<span style="font-size:85%;">(translated from <a href="http://dbarashev-matmex.blogspot.com/2010/05/sigmod.html">Dmitry Barashev's post</a>)<br /><br />The team of the <a href="http://meta.math.spbu.ru/en/home.shtml">Information Management Research Group</a> of the University of St.Petersburg became the finalists of the<a href="http://dbweb.enst.fr/events/sigmod10contest/results/"> ACM SIGMOD 2010 Programming Contest</a>. The Contest was about the development of a distributed engine for querying relational databases. 29 teams took part in the Contest and 5 reached the final. The first place was won by the Stanford University as its <a href="http://infolab.stanford.edu/">Database Group</a> is one of the strongest in the world. The winners will present their works at the<a href="http://www.sigmod2010.org/index.shtml"> ACM SIGMOD 2010</a>. Congratulations to the SPbSU team!</span>Ilya Markovhttp://www.blogger.com/profile/04412395864181431902noreply@blogger.com0tag:blogger.com,1999:blog-4616986695575511338.post-68760928021920540932009-06-01T03:31:00.000-07:002009-06-06T12:44:01.712-07:00The end of the academic year at USI<div style="text-align: justify;"><span style="font-size:85%;">2008-2009 academic year at the University of Lugano, the <a href="http://www.inf.unisi.ch/">Faculty of Informatics</a>, finished on Friday, May 29, with presentations of students' achievements. The event consisted of several parts dedicated to a separate course each: one part for every year of the bachelor program (3 in total) and one part for the master program. Every part started with a course overview, given by a professor, and continued with students presentations describing their achievements within the course.</span><br /><span style="font-size:130%;"><br /></span><span style="font-weight: bold;font-size:130%;" >Bachelor session</span><br /><span style="font-size:85%;">First year bachelor students go through "Programming Fundamentals" course, which ends up with mini-projects written in Java, one for 2 students. Two projects were presented. One calculates the fastest path for a given map and a given vehicle location with respect to a current traffic (!). The map and moving vehicles are represented graphically. One can generate new maps and manually drive a vehicle. The other project implemented fully functional Arcanoid game up to a level editor (!). Thus the students were able to manage pretty complex algorithms implementations and graphical applications within a first year, which is very impressive for me. During the course and the project students also learned patterns, UML and version control system.</span><br /><br /><span style="font-size:85%;">Second year bachelor students dealt with web-programming. As a result they developed an <a href="http://pickasso.inf.unisi.ch/">on-line web-page editor</a> (like Google sites). The choice of the programming language was a little bit strange for me - they used smaltalk. Moreover, it is not clear how much did they do on their own besides frameworks and libraries used. Unfortunately the result was not as impressive as that of the first year students. The system is only in its initial state now and is not user-friendly, one has to click a lot to work with it.</span><br /><br /><span style="font-size:85%;">Third year bachelor students within the course of "Theory of Computation" invented a boolean formula of sudoku. Based on that formula and one of the <a href="http://en.wikipedia.org/wiki/SAT_solver#Algorithms_for_solving_SAT">SAT solvers</a> they implemented a simple application which generates sudoku of different sizes with some predefined numbers. Although the course is more theoretical and is not as visual impressive as the previous ones, the work done was significant and the presentation itself was very good.</span><br /><br /><span style="font-size:85%;">Bachelor session ended up with 2-minutes bachelor projects presentations. During the bachelor program each student was involved in some research activities within one of the Faculty's research groups. Students accomplished some practical tasks in the scope of the group they worked with. The bachelor projects defense will take place on June, 16.</span><br /><br /><span style="font-weight: bold;font-size:130%;" >Other sessions</span><br /><span style="font-size:85%;">When presenting the master program of the Faculty, Professor Pedone asked, how many third year bachelor students were going to participate. Only 3 out of 10-12 answered in the affirmative. (Here I have to mention that we have only 10-15 students per year, which is less then a little). On the other hand, the Faculty is supposed to attract people from outside Ticino canton (and from outside Switzerland as well) to take the master program in Lugano. The more students come the more funding the Faculty gets.</span><br /><br /><span style="font-size:85%;">The overview of master projects was presented. The defense will take place on June, 18.</span><br /><br /><span style="font-size:85%;">I also have to mention that the Faculty offers summer internship for students. Again students have to work within one of the research groups for 2 month. The achievements of two such interns were presented.</span><br /><br /><span style="font-size:85%;">The event ended up with a small banquet organized by the Faculty.</span><br /><span style="font-size:130%;"><br /></span><span style="font-weight: bold;font-size:130%;" >Overall impression</span><br /><span style="font-size:85%;">Not only the current students achievements impressed me much, but also the possibilities for studying and practicing they have here. Their success is caused not only by their passion to study and work, but also by a quality of professors and courses offered by the Faculty. Several young professors passioned to teach use the latest technologies both in informatics and teaching. Most of the professors try to make their courses as much interesting for students as possible. </span><span style="font-size:85%;">And I am happy to take part in this process.<br /><br /></span><span style="font-size:85%;">Another very good point is that students always present their works, both during a semester and in the end of it.</span><br /><ul><li><span style="font-size:85%;">This gives an impression of educational milestones other than exams.</span></li><li><span style="font-size:85%;">Students practice presenting their work a lot.</span></li><li><span style="font-size:85%;">It makes them fun.</span></li></ul><span style="font-size:85%;">I have to say, that students' presentations on the whole were much better than those one can expect from professors and researchers. Presentations were well-formed and well-presented with a sense of humor almost in each of them.</span><br /><br /><span style="font-size:85%;">Again, my impression is that hard-working students, supervised by good professors (and assistants) can do almost everything.</span><br /><br /><br /><span style="font-weight: bold;font-size:85%;" ><span style="font-size:130%;">Some notes on the curriculum of the Faculty of Informatics, the University of Lugano.</span></span><br /><span style="font-size:85%;">According to <a href="http://en.wikipedia.org/wiki/Bologna_process">Bologna process</a>, informatics curriculum is divided into bachelor (3 years) and master (2 years) programs. On top of that there is a PhD program (ideally 3 years, but actually 4 years), which forms 3-5-8 formula. As soon as students can change their specialization after bachelor program (continuing, for instance, in economics or whatever else) the task of the Faculty is to give "full" informatics education in 3 years. Therefore the curriculum covers only required minimum of disciplines needed by an average IT specialist, although there is at least one theoretical course almost every semester.</span></div>Ilya Markovhttp://www.blogger.com/profile/04412395864181431902noreply@blogger.com2tag:blogger.com,1999:blog-4616986695575511338.post-12900616777429253692009-05-12T11:46:00.000-07:002009-05-14T02:43:33.328-07:00Leslie Lamport at USI<a href="http://lamport.org/">Leslie Lamport</a> visited the <a href="http://www.inf.unisi.ch/index.php">University of Lugano</a> on 11 - 13 of May and gave 3 talks. His main idea is to use math in programming. Before writing a code programmer should try to represent the idea of a program mathematically. This is needed<br /><ul><li>to understand better, what he / she is going to implement;</li><li>to formulate the idea precisely without any natural language;</li><li>to avoid bugs before implementing the code.</li></ul>Lamport did not talk about proving the correctness of programs, but showed on several examples that it is possible to "assign meanings to programs" (see the paper by R.W. Floyd), i.e. mathematical meaning.<br />Obviously, it is impossible to convince everybody from programmers to CEO that it worth spending time on that (for the same reasons which Fowler mentioned in his "Refactoring"). Therefore this "math" idea can be treated as a long-term message to the software engineering community. Lamport proposes to start from university education and make an emphasis more on math than on programming skills. As soon as a new generation with such an education appears, it will not be difficult any more to convince anybody to use math in programming.<br />Lamport talked about <a href="http://research.microsoft.com/en-us/um/people/lamport/tla/tla.html">TLA+</a> language, which is again a formal math (+ couple of temporal logic operators and some others like <span style="font-weight: bold;">'</span>) and about its application for writing specifications. He also presented <a href="http://research.microsoft.com/en-us/um/people/lamport/tla/pluscal.html">PlusCal</a> algorithm language, which is based on TLA+, and encouraged to use it in writing algorithms instead of pseudo-code because of PlusCal preciseness. His book on all this stuff is <a href="http://research.microsoft.com/en-us/um/people/lamport/tla/book.html">available</a>.<br /><br />P.S. This text is my own understanding of what was presented and can be different from Lamport's point of view.Ilya Markovhttp://www.blogger.com/profile/04412395864181431902noreply@blogger.com0tag:blogger.com,1999:blog-4616986695575511338.post-52873883710245198072008-11-21T00:56:00.000-08:002008-11-21T00:57:51.455-08:00JUG LuganoYesterday was a first meeting of <a href="http://juglugano.ch">JUG Lugano</a>.Ilya Markovhttp://www.blogger.com/profile/04412395864181431902noreply@blogger.com2tag:blogger.com,1999:blog-4616986695575511338.post-23491088826380966612008-07-24T04:43:00.000-07:002008-07-24T04:46:18.388-07:00How To Design A Good API and Why it Matters (by Joshua Bloch)<a href="http://video.google.com/videoplay?docid=-3733345136856180693">Video</a><br /><a href="http://lcsd05.cs.tamu.edu/slides/keynote.pdf">PDF</a>Ilya Markovhttp://www.blogger.com/profile/04412395864181431902noreply@blogger.com0tag:blogger.com,1999:blog-4616986695575511338.post-82499332731902884592008-02-01T00:47:00.001-08:002008-02-01T00:47:51.030-08:00Advanced Topics In Programming Languages: Closures For Java<div xmlns='http://www.w3.org/1999/xhtml'><p><object height='350' width='425'><param value='http://youtube.com/v/0zVizaCOhME' name='movie'/><embed height='350' width='425' type='application/x-shockwave-flash' src='http://youtube.com/v/0zVizaCOhME'/></object></p></div>Ilya Markovhttp://www.blogger.com/profile/04412395864181431902noreply@blogger.com1tag:blogger.com,1999:blog-4616986695575511338.post-27756297640300392092008-01-18T05:39:00.000-08:002008-01-18T05:45:13.159-08:00Static method overriddingWhat will the following code print?<br /><br /><pre><tt><br />class SuperClass {<br /> public static void test() {<br /> System.out.println(0);<br /> }<br /><br /> public static void main(String[] args) {<br /> SuperClass test = new SubClass();<br /> test.test(); <br /> }<br />}<br /><br />class SubClass extends SuperClass {<br /> public static void test() {<br /> System.out.println(1);<br /> }<br />}<br /></tt></pre>Ilya Markovhttp://www.blogger.com/profile/04412395864181431902noreply@blogger.com2tag:blogger.com,1999:blog-4616986695575511338.post-55374597645583547192007-12-21T05:19:00.000-08:002007-12-21T05:21:56.895-08:00Java-question on HashSetAssume the following code:<br /><tt><br />Set set = new HashSet();<br />set.add(set);<br />set.add(set);<br /></tt><br />What will be the result of compiling and executing it?Ilya Markovhttp://www.blogger.com/profile/04412395864181431902noreply@blogger.com2tag:blogger.com,1999:blog-4616986695575511338.post-35759664593947048592007-09-04T08:53:00.000-07:002007-09-04T08:55:54.289-07:00How to connect through a proxy in JavaThe problem of such connection is rised quite often.<br /><a href="http://www.rgagnon.com/javadetails/java-0085.html">Here is</a> one of the solutions and it seems to work.Ilya Markovhttp://www.blogger.com/profile/04412395864181431902noreply@blogger.com0tag:blogger.com,1999:blog-4616986695575511338.post-82399271665288684572007-08-23T00:42:00.000-07:002007-08-23T00:44:09.896-07:00Java-questionIs it possible to override method and make it abstract?Ilya Markovhttp://www.blogger.com/profile/04412395864181431902noreply@blogger.com2tag:blogger.com,1999:blog-4616986695575511338.post-5930352666650686832007-06-08T22:58:00.000-07:002007-06-08T23:00:08.696-07:00The "Double-Checked Locking is Broken" Declaration<p> Double-Checked Locking is widely cited and used as an efficient method for implementing lazy initialization in a multithreaded environment. </p><p>Unfortunately, it will not work reliably in a platform independent way when implemented in Java. When implemented in other languages, such as C++, it depends on the memory model of the processor, the reorderings performed by the compiler and the interaction between the compiler and the synchronization library. Since none of these are specified in a language such as C++, little can be said about the situations in which it will work. Explicit memory barriers can be used to make it work in C++, but these barriers are not available in Java. </p>See the full version here:<br /><a href="http://www.cs.umd.edu/%7Epugh/java/memoryModel/DoubleCheckedLocking.html">The "Double-Checked Locking is Broken" Declaration</a>Ilya Markovhttp://www.blogger.com/profile/04412395864181431902noreply@blogger.com0