Blog Archive » Why Programmers Suck at C If I had a dime for every time I heard a web programmer apologize for the way his/her pages looked before revealing them, I certainly wouldn’t need to work anymore. As with color picking, I think that programmers tend to avoid doing certain things not because they are inherently bad at it, but because they don’t know how to proceed. They find themselves in an uncharted and foggy territory, without a map, no sense of direction, and with a limited ability to know if they’re getting any closer to where they want to be. Also, when they talk to people that don’t share such problems and find it all too natural and obvious, it’s hard for the two to communicate in terms that make sense to a programmer. There is a general tendency to believe that programmers can’t style things because they have no style themselves. Don’t get me wrong: I don’t think anybody can design something truly beautiful, innovative, simple and that can resonate with a big percentage of the population. Em vs.
You must remember 'this' Of all the tech blogs in all the sites in all the worldwide web, you walk into mine... If you hang out in JavaScript-oriented newsgroups like these for any length of time, you will eventually see some variation of this question: Hey, why doesn't this work?function MyWidget(name){ this.name = name; this.element = null;}MyWidget.prototype.showName = function(){ alert('The name is ' + this.name);}MyWidget.prototype.hookElement = function(element){ this.element = element; Event.observe(this.element, 'click', this.showName);}function test(){ var widget; widget = new MyWidget('Test Name'); widget.hookElement(document.getElementById('testDiv'));}"testDiv" is a div in the document, and I know that I'm not calling the test() function before the DOM is loaded, so why is it when I click the div I get the message "The name is undefined"?! (As always, I'm using some convenience syntax in the above for hooking up the event handler.) The OP (original poster) might even follow on with: And that's it!
Pseudocode Standard Pseudocode is a kind of structured english for describing algorithms. It allows the designer to focus on the logic of the algorithm without being distracted by details of language syntax. At the same time, the pseudocode needs to be complete. In general the vocabulary used in the pseudocode should be the vocabulary of the problem domain, not of the implementation domain. Extract the next word from the line (good) set word to get next token (poor) Append the file extension to the name (good) name = name + extension (poor) FOR all the characters in the name (good) FOR character = first to last (ok) Note that the logic must be decomposed to the level of a single loop or decision. Each textbook and each individual designer may have their own personal style of pseudocode. The "structured" part of pseudocode is a notation for representing six specific structured programming constructs: SEQUENCE, WHILE, IF-THEN-ELSE, REPEAT-UNTIL, FOR, and CASE. Example (non-computer) Example sequence 1
35 Designers x 5 Questions Advertisement 35 designers. 5 questions. 5 precise answers. Result: 175 professional suggestions, tips and ideas from some of the best web-developers all around the world. 35 Designers: how did we find them? How do you find the best designers worldwide? We didn’t choose by our intuition, we weren’t looking for any suggestions. We’ve browsed through numerous articles and hundreds of portfolios and in the end we’ve managed to select over 45 out of them. Five Questions Link We’ve asked five questions. 1 aspect of design you give the highest priority to.1 most useful CSS-technique you use very often.1 font you use in your projects very often.1 design-related book you highly recommend to read.1 design magazine you read on a daily/weekly basis (online or offline). In the end we’ve received more answers than we expected. 1 aspect of design you give the highest priority to. The initial part of the design process is probably the most creative and sophisticated part of web-development. 1.2. 1.3.
Static variables John Manoogian III » Blog Archive » (The Only) Ten Things To Kno AKA, “Secrets of the patented JM3 Gasbag Model™” - a getting-started list to make sense of CSS. [2,547 diggs and counting.] The Point of CSS is to use clean, simple HTML in your page, then write CSS “rules” that style the objects on your page. The page stays clean and looks cool, and your HTML page works on both mobile devices and regular browsers. * to style **all** `<h1>` tags, use css rule `**h1 {...**` * to style all tags **in a certain place**, e.g. for `<b>`'s inside `<p>` tags, use css rule `**p b {...**` * to style all `<h1>` headers **of a certain kind**, add `**class="myheader"**` to the `<h1>` tags you want to style, and use css rule `**.myheader {...**` * to style **just one** `<h1>` header, add `**id="myheader"**` to the `**<h1>**` tag you want to style, and use css rule `**#myheader { You can combine the above rules in different ways, too; to style all <h1>tags of type "barleymash" inside of forms of type "magicform", use css rule **form.magicform h1.barleymash {
Public, Privileged, Private Douglas Crockford www.crockford.com JavaScript is the world's most misunderstood programming language. Some believe that it lacks the property of information hiding because objects cannot have private instance variables and methods. Objects JavaScript is fundamentally about objects. If a value is a function, we can consider it a method. Objects can be produced by constructors, which are functions which initialize objects. Public The members of an object are all public members. In the constructor This technique is usually used to initialize public instance variables. function Container(param) { this.member = param; } So, if we construct a new object var myContainer = new Container('abc'); then myContainer.member contains 'abc'. In the prototype This technique is usually used to add public methods. Container.prototype.stamp = function (string) { return this.member + string; } So, we can invoke the method myContainer.stamp('def') which produces 'abcdef'. Private Privileged Closures Patterns Public Private
Javascript Sound Kit Prototypal Inheritance Explained Newcomers to JavaScript often misunderstand its object oriented style. Inheritance, in particular, seems foreign to people coming from other object oriented languages like C++ or Java. When I was new to JavaScript, I tried to manipulate the language to fit the style I already knew. But there's a better way. In this short tutorial I'll explain how JavaScript implements object inheritance and how you can use it to your advantage. A Different Style C++ and Java are class-based languages. JavaScript is a prototypal language. We start with a function. function Person(name, age) { if (Boolean(name)) this.name = name; if (Boolean(age)) this.age = age; } The function above will be called to initialize new objects. Let's add some functions and properties to be shared among every new Person object. Now let's initialize two new Person objects. var jane = new Person("Jane Smith", 35); var noName = new Person(); noName.setAge(29); The object structure we get looks like this: diagram 1. Extending Objects
my favorite discussion of static vs instanciable objects in javascript. i've had to explain this concept an uncountable number of times and have never been able to do it so simply. by snarfel Nov 18