Learning jsoftware will help you better understanding kdb/Q?
it may well help you rewire your brain a bit if you’re used to OOP and have never seen/used functional programming before. But the best way to learn q is simply to download the play instance and have a go!
On Thu, Jul 7, 2011 at 8:57 PM, kuentang <kuentang@vodafone.de> wrote:
Learning jsoftware will help you better understanding kdb/Q?
–Submitted via Google Groups
This is the very very basic. And everyone who seriously wants to learn
kdb/q already do this.
Let me reformulate my question.
What else can be done after reading q for mortals, First deri****ve
manual, playing around with q, solving mathematical questions with q?
What else can be done to achieve the next level?
Will learning jsoftware help you to write maintainable, stable and
expressive kdb/q code?
Btw. KDB/Q is used in many high performance applications. Can
jsoftware also achieve the same speed and benchmark?
charset=us-ascii
X-Mailer: iPhone Mail (8F190)
In-Reply-To:
Message-Id: <7F54105D-69AC-449B-B2C8-E3E269FFCD1C@gmail.com>
Date: Thu, 7 Jul 2011 17:49:43 -0400
To: “personal-kdbplus@googlegroups.com”
Mime-Version: 1.0 (iPhone Mail 8F190)
I’m not sure about j, but learning new things never hurts and can sometimes h=
elp you think of new ways to solve problems.
As for learning more about q, just read and write more q code. Eventually yo=
u will see some patterns/idioms that will further help you to optimize your c=
ode.
It also helps if you can get a job that requires you to write q code, but it=
sounds like you’ve already done that based on your dealings with fd.
To: personal-kdbplus@googlegroups.com
X-Mailer: Apple Mail (2.1084)
Thanks for the comments.These are really good starting points.On 8 Jul., 05:54, Aaron Davies <aaron.dav…> wrote:> On Jul 7, 2011, at 4:23 PM, kuentang wrote:>> > This is the very very basic. And everyone who seriously wants to learn kdb/q already do this.>> > Let me reformulate my question.>> > What else can be done after reading q for mortals, First deri **** ve manual, playing around with q, solving mathematical questions with q? What else can be done to achieve the next level?>> > Will learning jsoftware help you to write maintainable, stable and expressive kdb/q code?>> > Btw. KDB/Q is used in many high performance applications. Can jsoftware also achieve the same speed and benchmark?>> j will probably (i’ve never worked with it, so i’m guessing here) help you learn to think in terms of first-class functions, vector programming, adverbs, etc.–all the places where APL descendants are so drastically different from C descendants. (i have no idea how j is performance wise.)>> like any language, the best way to learn q is first to read it, then to write it–read everything inhttp://kx.com/q/andhttps://code.kx.com/trac/browser/contrib, if you’re a commercial user read all your company’s production q, readhttp://nsl.com/. then come up with something–anything–you haven’t found done yet in q, and try to do it. for instance, i once wrote a tetris game (well, tetris engine–i never did get input working) in q in pure functional style, just as an exercise in functional programming.>> if you want to fiddle with finance-type stuff, you can get low-frequency market data out of yahoo finance via their apihttp://code.google.com/p/yahoo-finance-managed/wiki/YahooFinanceAPIs–iwrote a portfolio tracker based on ithttps://code.kx.com/trac/browser/contrib/adavies/pnl.>> for high-frequency, it’s not that hard to write a simulated network feed sending random trades and quotes, just to get a feel for what market data tables are likely to look like and to start thinking about what queries might be interesting.>> finally, if you really want an in-depth understanding of as much of q as is possible, start poking at it–learn k and read q.k (expect this to take months), then hack it up to add new functionality; invent new adverbs; decode some more serialization patterns to add tohttps://code.kx.com/trac/wiki/Reference/ipcprotocol;work on things involving parse trees; etc. i’ve been working with q for almost five years, and i still discover something new about it almost every week.> –> Aaron Davies> aaron.dav...@gmail.com</aaron.dav…>
On Jul 8, 12:57 am, kuentang <kuent…> wrote:> Learning jsoftware will help you better understanding kdb/Q?hi Kuen, I can only add a bit to what has already been said. Most ofus here have an interest in computers and programming. Is programminga discipline like mathematics? Imagine the history of mathematics,arts, architecture, and music. Students of each such discipline haveto undergo some sort of training. Before creating any great work, theyall learn to critique and admire products of their discipline: whethermathematical papers, sculptures, or painting, or symphonies fromsomeone long dead. Often I realize that q allows you to be a poet andmathematician simultaneously. And to become better at q, as Aaron said"first.. read it, then…write it" (though not always in that order).Then maybe to work with someone who has been doing q for many yearsand is considered by his peers to be an expert. Its all like the Erd?sNumbers here!A co worker of mine few years ago once said that there are many"levels" or “ranks” of q expertise. Arthur’s code, for example, is"ultimate", whereas newbies who are used to C/C++ or Java would justlook for facilities in q which would let them write Java in q! At mycurrent company while reading code written by previous employees, Isometimes yell “Yes I’ve written bad code, but I had no idea it couldbe this bad!” Once you start working on your company’s codebase,you’ll see many examples consistent with this theory.</kuent…>
Am 09.07.2011 22:18, schrieb Rohit Tripathi:> On Jul 8, 12:57 am, kuentang<kuent…> wrote:>> Learning jsoftware will help you better understanding kdb/Q?> hi Kuen, I can only add a bit to what has already been said. Most of> us here have an interest in computers and programming. Is programming> a discipline like mathematics? Imagine the history of mathematics,> arts, architecture, and music. Students of each such discipline have> to undergo some sort of training. Before creating any great work, they> all learn to critique and admire products of their discipline: whether> mathematical papers, sculptures, or painting, or symphonies from> someone long dead. Often I realize that q allows you to be a poet and> mathematician simultaneously. And to become better at q, as Aaron said> “first.. read it, then…write it” (though not always in that order).> Then maybe to work with someone who has been doing q for many years> and is considered by his peers to be an expert. Its all like the Erd?s> Numbers here!>> A co worker of mine few years ago once said that there are many> “levels” or “ranks” of q expertise. Arthur’s code, for example, is> “ultimate”, whereas newbies who are used to C/C++ or Java would just> look for facilities in q which would let them write Java in q! At my> current company while reading code written by previous employees, I> sometimes yell “Yes I’ve written bad code, but I had no idea it could> be this bad!” Once you start working on your company’s codebase,> you’ll see many examples consistent with this theory.>Hi Rohit,thx for your constructive comments.And i totally agree with you that for programming in q one needs to undergo some sort of training.For such kind of training you need learning materials and these are somehow missing or not explicitly shown in q.Let me compare this with learning C++:In C++ you can read the book from Bjarne Stroustrup( the inventor of c++) to get an introduction into C++.After that you can read “Effective C++: 55 Specific Ways to improve Your Programs and Designs” to understand what is bad or good progamming in C++.“Modern C++ Design,Generic Programming and Design Patterns Applied” will bring you to a higher level and"C++ Template Metaprogramming" will show you how to embed a domain specific language in C++.These techniques are then implemented in the c++ library boost.In q there is only the one learning book from Jeffry A. Borror. ( Please correct me if i am wrong)And this is in my opinion not enough.Unfortunately at my current company i dont have the possibility to look into production code. So i cannot yell loud "I have written bad code."Btw the examples that i have found on the web are really from high or ultimate quality, especially the example where the implementation of a backtesting environment is shown.A last question:How can i switch on the command line to k?I know that i can usek) 2+2to execute k command. But can i switch the interpreter permanently to k?</kuent…>
\
2011/7/10 Kim Kuen Tang :
>
>
>
> Am 09.07.2011 22:18, schrieb Rohit Tripathi:
>>
>> On Jul 8, 12:57 am, kuentang<kuent…> =A0wrote:
>>>
>>> Learning jsoftware will help you better understanding kdb/Q?
>>
>> hi Kuen, I can only add a bit to what has already been said. Most of
>> us here have an interest in computers and programming. Is programming
>> a discipline like mathematics? Imagine the history of mathematics,
>> arts, architecture, and music. Students of each such discipline have
>> to undergo some sort of training. Before creating any great work, they
>> all learn to critique and admire products of their discipline: whether
>> mathematical papers, sculptures, or painting, or symphonies from
>> someone long dead. Often I realize that q allows you to be a poet and
>> mathematician simultaneously. And to become better at q, as Aaron said
>> “first.. read it, then…write it” (though not always in that order).
>> Then maybe to work with someone who has been doing q for many years
>> and is considered by his peers to be an expert. Its all like the Erd=F5s
>> Numbers here!
>>
>> A co worker of mine few years ago once said that there are many
>> “levels” or “ranks” of q expertise. Arthur’s code, for example, is
>> “ultimate”, whereas newbies who are used to C/C++ or Java would just
>> look for facilities in q which would let them write Java in q! At my
>> current company while reading code written by previous employees, I
>> sometimes yell “Yes I’ve written bad code, but I had no idea it could
>> be this bad!” Once you start working on your company’s codebase,
>> you’ll see many examples consistent with this theory.
>>
>
>
> Hi Rohit,
>
> thx for your constructive comments.
>
> And i totally agree with you that for programming in q one needs to under=
go
> some sort of training.
> For such kind of training you need learning materials and these are someh=
ow
> missing or not explicitly shown in q.
>
> Let me compare this with learning C++:
> In C++ =A0you can read the book from Bjarne Stroustrup( the inventor of c=
++)
> to get an introduction into C++.
> After that you can read “Effective C++: 55 Specific Ways to improve Your
> Programs and Designs” to understand what is bad or good =A0progamming in =
C++.
>
> “Modern C++ Design,Generic Programming and Design Patterns Applied” will
> bring you to a higher level and
> “C++ Template Metaprogramming” will show you how to embed a domain specif=
ic
> language in C++.
> These techniques are then implemented in the c++ library boost.
>
> In q there is only the one learning book from Jeffry A. Borror. ( Please
> correct me if i am wrong)
> And this is in my opinion not enough.
>
> Unfortunately at my current company i dont have the possibility to look i=
nto
> production code. So i cannot yell loud “I have written bad code.”
>
> Btw the examples that i have found on the web are really from high or
> ultimate quality, especially the example where the implementation of a
> backtesting environment is shown.
>
> A last question:
>
> How can i switch on the command line to k?
> I know that i can use
>
> k) 2+2
>
> to execute k command. But can i switch the interpreter permanently to k?
>
> –
>
Submitted via Google Groups</kuent…>
i would say it is the other way around. i found some things in jdifficult to wrap my hand around, like forks, while k is relativelysimple language to grasp. also, j syntax is a bit weird (verbose),starting with .NB comments and := assignments. k/q is so much easierto write code in. you can implement your own adverbs in j andgenerally it has more features, but i am not sure this features haveimmediate practical value. j seems more “theoretical”, while k is apractical language.AOn Jul 7, 3:57?pm, kuentang <kuent…> wrote:> Learning jsoftware will help you better understanding kdb/Q?</kuent…>
Also note that you *can* switch into k mode from a q-mode error shell,
but you have to type "\ ", not just "", which exits the error shell.
Am 10.07.2011 18:56, schrieb Aaron Davies:
> Also note that you *can* switch into k mode from a q-mode error shell,
> but you have to type "\ ", not just "", which exits the error shell.
Aaron, thanks for clarifying this.
I even didnt notice that felix’s message was an answer to my question. ;-)
> On Sunday, July 10, 2011, Felix LUNGU<felix.lungu> wrote:
>> <br>>>
>>
>> 2011/7/10 Kim Kuen Tang:
>>>
>>>
>>> Am 09.07.2011 22:18, schrieb Rohit Tripathi:
>>>> On Jul 8, 12:57 am, kuentang<kuent…> wrote:
>>>>> Learning jsoftware will help you better understanding kdb/Q?
>>>> hi Kuen, I can only add a bit to what has already been said. Most of
>>>> us here have an interest in computers and programming. Is programming
>>>> a discipline like mathematics? Imagine the history of mathematics,
>>>> arts, architecture, and music. Students of each such discipline have
>>>> to undergo some sort of training. Before creating any great work, they
>>>> all learn to critique and admire products of their discipline: whether
>>>> mathematical papers, sculptures, or painting, or symphonies from
>>>> someone long dead. Often I realize that q allows you to be a poet and
>>>> mathematician simultaneously. And to become better at q, as Aaron said
>>>> “first.. read it, then…write it” (though not always in that order).
>>>> Then maybe to work with someone who has been doing q for many years
>>>> and is considered by his peers to be an expert. Its all like the Erd?s
>>>> Numbers here!
>>>>
>>>> A co worker of mine few years ago once said that there are many
>>>> “levels” or “ranks” of q expertise. Arthur’s code, for example, is
>>>> “ultimate”, whereas newbies who are used to C/C++ or Java would just
>>>> look for facilities in q which would let them write Java in q! At my
>>>> current company while reading code written by previous employees, I
>>>> sometimes yell “Yes I’ve written bad code, but I had no idea it could
>>>> be this bad!” Once you start working on your company’s codebase,
>>>> you’ll see many examples consistent with this theory.
>>>>
>>>
>>> Hi Rohit,
>>>
>>> thx for your constructive comments.
>>>
>>> And i totally agree with you that for programming in q one needs to undergo
>>> some sort of training.
>>> For such kind of training you need learning materials and these are somehow
>>> missing or not explicitly shown in q.
>>>
>>> Let me compare this with learning C++:
>>> In C++ you can read the book from Bjarne Stroustrup( the inventor of c++)
>>> to get an introduction into C++.
>>> After that you can read “Effective C++: 55 Specific Ways to improve Your
>>> Programs and Designs” to understand what is bad or good progamming in C++.
>>>
>>> “Modern C++ Design,Generic Programming and Design Patterns Applied” will
>>> bring you to a higher level and
>>> “C++ Template Metaprogramming” will show you how to embed a domain specific
>>> language in C++.
>>> These techniques are then implemented in the c++ library boost.
>>>
>>> In q there is only the one learning book from Jeffry A. Borror. ( Please
>>> correct me if i am wrong)
>>> And this is in my opinion not enough.
>>>
>>> Unfortunately at my current company i dont have the possibility to look into
>>> production code. So i cannot yell loud “I have written bad code.”
>>>
>>> Btw the examples that i have found on the web are really from high or
>>> ultimate quality, especially the example where the implementation of a
>>> backtesting environment is shown.
>>>
>>> A last question:
>>>
>>> How can i switch on the command line to k?
>>> I know that i can use
>>>
>>> k) 2+2
>>>
>>> to execute k command. But can i switch the interpreter permanently to k?
>>>
>>> –
>>>
Submitted via Google Groups</kuent…></felix.lungu>
On Jul 10, 3:09 pm, Kim Kuen Tang <kuent…> wrote:
> For such kind of training you need learning materials and these are
> somehow missing or not explicitly shown in q.
>
> Let me compare this with learning C++:
:)
To begin, there is this gem from Larry Wall called “Three Virtues of a
Programmer” (copy paste from the net)
1. Laziness - The quality that makes you go to great effort to reduce
overall energy expenditure.
2. Impatience - The anger you feel when the computer is being lazy.
3. Hubris - Excessive pride, the sort of thing Zeus zaps you for. Also
the quality that makes you write (and maintain) programs that other
people won’t want to say bad things about.
q has a sly way of enhancing these “virtues”. Before you know it, you
will descend into a feedback loop (because you accomplished the
broader task in just a few lines of code – and ALL of it is visible
at once! In one screenshot, on one page!) So there can be a snippet of
code that just wouldn’t leave you alone until you’ve optimized it into
obscurity. It gets worse when you’re asked to modify/repair someone
else’s work…take something like this for example which makes me
“RAGE!”
One time when first starting with q I thought “Bingo! Found a language
that pays better than c++, and the documentation is just a few pages.
What can go wrong?”
Then I discovered its like chess, the rules don’t get discussed as
often as openings or endgames (going back to the “virtues” mentioned
earlier). With Java/C++, you can easily have a couple of books which
discuss language features. After that you can have something about
libraries. Then you can have some books on do’s and don’ts. There was
a joke floating around about a fake interview with Stroustrup in which
he reveals wondering “.. what would happen, if there were a language
so complicated, so difficult to learn, that nobody would ever be able
to swamp the market with programmers?”
In one of the AW books I read that it took the industry almost a
decade to start churning out good C++ books, maybe because for a long
time the language wasn’t standardized and in the beginning people were
reading up on Quick C, Objective C, Code Warrior, Turbo C, Borland C++
or Visual C++ (6.0, MFC, .NET and variants). Both C and C++ were
intimately tied to the platform their compilers were written for, so
at some point you would get pulled into studying more about the
machine than the language (and never recover!). You will find C/C++
everywhere from video games to operating systems, and hence titles
resembling “C++ for Game Development”, “C++ for Quants”, “Network
Programming in C++”, or “Device Drivers in C++”. There is a lot of
material out there to write about, so more books. Both C an C++
enjoyed successful platforms, unlike Lisp and variations.
> In q there is only the one learning book from Jeffry A. Borror. ( Please
> correct me if i am wrong)
> And this is in my opinion not enough.
>
That might be because despite its pedigree, q is still a young
language. Many old timers were busy reading documentation on k before
q appeared. Before that, they were reading APL or A+. (also, think of
proprietary technologies which are expensive for all but the biggest
businesses, so small user base and I’m guessing less incentive for
independent authors to write about. code.kx.com had a Java (?) q
terminal you could use before the evaulation copy and Q for Mortals
emerged). I’m also thinking Scheme and SICP, sometimes one book is all
you need.
> Unfortunately at my current company i dont have the possibility to look
> into production code. So i cannot yell loud “I have written bad code.”
>
> Btw the examples that i have found on the web are really from high or
> ultimate quality, especially the example where the implementation of a
> backtesting environment is shown.
>
I’m guessing its because the q/k gene pool breeds bad code out of
existence! What are the links?
Kim, whats your opinion on these (some are language-independent bad
practices)
1 if[0h>type ksym; ksym:enlist ksym]; /holy Belgium! why?
2 if[0=count ksym; [/block of code /why Oh Dear Gods of
q, WHY?
] /close block
] /fi
3. Some well meaning person left behind a code which I’m
restructuring and he/she has “assembled” a function by starting with
an empty string and building it bigger by concatenating other
functions or strings and its called using “value”. In the comments,
the guy who wrote it adds a smirk-like smiley. A different kind of
volcanic activity of the “WHY” type follows Must…get… towel
out…time to leave this place!
(Has anyone noticed, how Arthur never comments on these things? He’s
laughing from his throne, at the disciples of his baby who was sent
down to deliver us from loops and OOPs. )
</kuent…>
To: personal-kdbplus@googlegroups.com
X-Mailer: Apple Mail (2.1084)
> A co worker of mine few years ago once said that there are many =
“levels” or “ranks” of q expertise. Arthur’s code, for example, is =
“ultimate”, whereas newbies who are used to C/C++ or Java would just =
look for facilities in q which would let them write Java in q! At my =
current company while reading code written by previous employees, I =
sometimes yell “Yes I’ve written bad code, but I had no idea it could be =
this bad!” Once you start working on your company’s codebase, you’ll see =
many examples consistent with this theory.
paraphrasing a comment i made on a forum recently: i try to divide my =
skills into “familiar with”, “competent at”, and “proficient in”. wrt =
code, these roughly correspond to reading, writing, and debugging–e.g. =
i can read C++, write C, and debug Java (or at least i could have, back =
before i got into q). (i can’t do any of them for a completely foreign =
paradigm, like haskell.)
keep in mind tho a famous quote from kernighan (the “k” in “k&r”): =
“Debugging is twice as hard as writing the code in the first place. =
Therefore, if you write the code as cleverly as possible, you are, by =
definition, not smart enough to debug it.”=
charset=us-ascii
X-Mailer: iPhone Mail (8F190)
In-Reply-To:
Message-Id: <6C2D4430-F6F1-4D38-A468-AB2EF14E7F51@gmail.com>
Date: Sun, 10 Jul 2011 21:27:41 -0400
To: “personal-kdbplus@googlegroups.com”
Mime-Version: 1.0 (iPhone Mail 8F190)
When you are not smart enough to debug your own code you should then proceed=
to perform the art of “random engineering” whereby you change random things=
until it works even though you’re not sure why. I’ve done this once or twic=
e when too exhausted to think anymore and the results were quite spectacular=
.