Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- Readability



  What is the use of empty struct in GoLang

In Go, an empty struct struct{} is a struct with no fields that may appear to be of little use, but in reality, it can be useful in certain situations and become a simple and efficient solution in code. As a semaphore or lock Because the empty struct has no fields, it can be conveniently used to implement some concurrency control functions, such as mutex locks, read-write locks. We can use chan struct{} to implement an unbuffered channel for controlling concurrent access. package main import ( ...

   GOLANG,EMPTY STRUCT     2024-04-05 23:54:03

  Illiterate Programming

Donald Knuth cleverly imprisoned the phrase "Literate Programming" - if you're not documenting your source with his particular methodology then you must be a proponent of "Illiterate Programming," which sounds truly awful. I very much believe in documented code but I think no amount of pontification in English will ever make a piece of code clearer than the code itself (I'm not talking about project or API documentation). I'm also not talking about the super...

   Programming,Illiterate     2012-02-10 06:20:52

  The evolving history of asynchronous operation in JavaScript

JavaScript is single threaded, it means there would be only one task running at any point of time. But this would slow down the overall program execution if there is long running task, hence asynchronous task execution is desired in complex cases. To achieve asynchronous task execution, there are a few options introduced in JavaScript. setTimeout/setInterval Event Promise Async/Await setTimeout/setInterval is one of the first mechanisms introduced in JavaScript to simulate asynchronous operati...

   JAVASCRIPT,ASYNC,PROMISE,AWAIT     2019-11-09 08:21:56

  Programming Language Readability

Lets compare some Python to Haskell for solving the same problem.  The problem we’ll pick is Trie data-structure for auto-completions.  We are interested not so much in the nitty gritty of the algorithm, but in the language style itself.  Auto-complete has been in the programming news a lot recently; both a Python and a Haskell solver have turned up. (I suspect this post got flagged on Hacker News :(  It never got on the front-page despite the rapid upvoting on a n...

   Programming,Readability,Python,Haskell     2012-02-27 04:52:02

  Web Design 101: Get Your Color Contrasts Right

Great web design is hard.  It requires imagination, a keen eye, and the ability to project ideas onto a, generally digital, medium.  In today’s world this calls for a conflation of both artist and technologist.  I am not one of these people. I am a technologist, but I am no artist (thankfully I know some great artists!). Nonetheless, I’ve always had a good eye for things that look good and for sites that look like they were built with an early version of Micro...

   Web design,Structure,UI,Contrast     2012-02-04 21:42:50

  Readability in Programming Languages

I saw a side by side comparison of a bunch of scripting languages online recently. Scripting Languages: PHP, Perl, Python, Ruby My first, and second reaction was yuck! Now I have my biases – biases which may  not be shared by others of course. But I like readable code and for me anytime I see a special character (anything not an alphanumeric) it slows me down. This got me thinking about where we are going in design of programming languages? Are we moving forward (what ever ...

   Programming,Style,Coding style,Readabili     2011-09-22 09:20:03

  Go Lacks Ternary Operators. Here Are Some Equivalents

If you were like me, a pure Java developer before writing Go, you must be wondering why Go doesn’t support the ternary operator like return a > 1 ? 0 : 1. Most mainstream languages like C and Java are supportive of ternary operators; languages like Python and Ruby support the simplified if-else one-liner, such as a = 0 if a > 1. However, Go is not among them. And it is not only about adding operators but also a concept of coding in a more convenient way, such as the ?: expression can...

   GOLANG,TERNARY OPERATOR     2022-12-09 19:51:32

  Learning Python as your first programming language

Python is a widely used general-purpose, high-level programming language Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than would be possible in languages such as C. Python now becomes more and more popular and is now being used the first teaching language in some universities. Why would you like to learn Python as your first programming language? Below are the reasons. Python is a high-level language with dynami...

   Python,Advantage     2014-04-07 05:36:04

  Hey, you may be happy to know these mottos about programming languages

Different programming are similar in helping people build staff work as people want them to. But they all have their own features which differentiate them from other programming languages. The language type may be different, for example Java is OOP, some may have different syntax. A programming motto usually can best describe the characteristic of the programming language. For example, "Write once Run everywhere" for Java. But today we are going to take a look at "unofficial mottos" about some p...

   motto,programming language     2014-04-05 20:02:13

  malloc/free and new/delete in C++

malloc and free are C++/C language standard library functions, while new/delete are operator of C++. They can be used to allocate dynamic memory and free memory in C++ programs malloc/free can not meet the requirements of dynamic objects creation. Object needs to call the constructor to initialize the object when creating, the object needs to call the destructor before it is destroyed  Since malloc() and free() are library functions rather than operators, the compiler has no control permiss...

   C++,memory,malloc,free,new,delete     2012-06-20 06:52:09