|
tef posted:Lisp dialects have been used in industry many times. Lisps seeming lack of popularity is often down to more social factors. I could use some more laughs about a language developed by a Lisp pioneer millionaire who has repeatedly mentioned that he'll work on char encoding when its convenient. Furthermore, having to implement my own language is more like "getting" to implement my own language. When I start a project, I think about what my program needs at the conceptual level, and I build tools to help me develop the next level of the program. Bottoms up development is a wonderful paradigm, and maybe it's not suited for C/C++ IT employees.
|
# ? Oct 21, 2012 16:28 |
|
|
# ? May 14, 2024 03:18 |
|
luxxx posted:Bottoms up development is a wonderful paradigm, and maybe it's not suited for C/C++ IT employees. I can feel the smugness radiating from this sentence. Also jesus christ how do you release a language that doesn't support Unicode? Opinion Haver fucked around with this message at 17:32 on Oct 21, 2012 |
# ? Oct 21, 2012 17:29 |
|
yaoi prophet posted:I can feel the smugness radiating from this sentence. Simple - especially when the actual language (mzscheme) supports unicode. You just strip it out! code:
|
# ? Oct 21, 2012 17:45 |
|
.
maskenfreiheit fucked around with this message at 21:29 on Apr 28, 2019 |
# ? Oct 21, 2012 17:51 |
|
luxxx posted:I could use some more laughs about a language developed by a Lisp pioneer millionaire Paul graham isn't a lisp pioneer. Sussman, Steele, et al, they pioneered lisp. Graham wrote a (good, so i'm told) book on lisp. The hero worship you have is nice, but misplaced. Besides, Guy Steele is dreamy But really, it isn't really developing a language when you throw out three revisions of your scheme macros. I'm not trying to say that the bar is higher, but when you announce 'the hundred year language', expectations are slightly higher. (ps, you do know they couldn't find anyone who could maintain yahoo stores in lisp, so they rewrote it in perl for maintainability) luxxx posted:who has repeatedly mentioned that he'll work on char encoding when its convenient. Yep. It's not like there are plenty of examples of why the approaches of 'let developers get unicode right', 'we'll make it a library', or 'we'll fix it later', cause pain, suffering and chaos. (Hint: I'm being sarcastic, pretty much every language stands an example of problems with not getting strings right) Making arc support unicode is actually not as hard as you'd think, as the underlying language (racket/mzscheme) has reasonable support for it already. He went out of his way to remove support for unicode, and with a bit of handwaving suggested that 7 bits should be enough for anyone. When you start with the adventurous goal of a hundred year language, not being casually racist against grubby non ascii pure foreigners is a good start.
|
# ? Oct 21, 2012 17:56 |
|
yaoi prophet posted:I can feel the smugness radiating from this sentence. I agree, it was a bit smug, but probably not the smugness you're thinking. Everyone knows that certain languages just aren't good at certain things. I use Lisp for a lot, but I know that it's no Excalibur. What I meant by that remark was that people from different coding backgrounds might see Lisp as silly or inefficient merely because they have not been exposed to bottom up or they don't know how to visualize a problem "the Lisp way". It was retaliatory, not instigative.
|
# ? Oct 21, 2012 17:57 |
|
luxxx posted:I've always hated the JVM. I really don't like working with Java methods, and I like the ideas that Clojure is putting into action, but using macros alongside long Java methods kinda hurts me. Lisp and Java are two completely different paradigms. You can do a great deal in Clojure without ever needing to touch Java directly, which is one of the things I like about it - deployment is easy (lein uberjar, upload, done) and I get all of the advantages of targeting the JVM without ever needing to actually use Java. In cases where you do need to call Java methods directly, it's easy to wrap in a small library that gives you a more pleasant interface (and in many cases someone else has already done so).
|
# ? Oct 21, 2012 18:31 |
|
Would it be useful for me to learn COBOL? I remember reading about how there's a shortage of COBOL programmers who can maintain the legacy systems in companies, which are written in COBOL.
|
# ? Oct 21, 2012 22:08 |
|
If you want a really terrible job that isn't any easier to get or better paying than a decent job then learning COBOL is a good idea.
|
# ? Oct 21, 2012 22:29 |
|
Programming is a hobby to me but I'm hoping to make it a career someday. I'm always looking to improve my self as a programmer and yesterday I ran across something that made me wonder something. I wrote this piece of code which is part of a routine to build an SQL request dynamically based on check boxes. Abstracted out since unicode doesn't work well in a code block Python code:
Which is better in programming, readability or elegance? I think the above is easily readable, though a bit unsightly. Where as a lambda tertiary if function would be compact but not so much readable unless you knew how it worked.
|
# ? Oct 22, 2012 02:03 |
|
Kenishi posted:Part of Python allows for minimalism either through tertiary if's or lambda functions. I feel like there might be a more elegant way to implement this sort of thing, but I can't see it. But it led me to a question. Readability and elegance sometimes (often? always?) go hand in hand. Elaborate syntax or language tricks aren't necessarily a part of that, though. That code you wrote is neither maintainable nor particularly readable. Rather, mapping over a list of flags to turn them into "s=?" then joining a list of them with (in python): " OR ".join(flaglist) would be more elegant, as a one-member list would be joined by nothing, whereas a list of flags would be joined by " OR ". and would be of the form "s=?", i.e. "s=H OR s=N". Your code also does s=H OR s='N' - why the difference in quoting? Bug? EDIT: here's some code which, if you understand Python, is slightly more straightforward, and much more concise: Python code:
Also, careful when making SQL statements. If available, use prepared statements, and mold your queries to use them. If not, then be very careful and use whatever SQL escaping provisions are available, and be wary of any of your own code that deals with that. Doctor w-rw-rw- fucked around with this message at 02:32 on Oct 22, 2012 |
# ? Oct 22, 2012 02:24 |
|
Yeah, readability, elegance (whatever that means), and conciseness are only loosely coupled.
|
# ? Oct 22, 2012 02:58 |
|
Not speaking directly on the code, the modelling of "human" or "none" is confusing to me.
|
# ? Oct 22, 2012 03:26 |
|
Kenishi posted:Which is better in programming, readability or elegance? Just addressing this part, but I don't really like the notion of "elegant" code. I mean, there is nothing inherently wrong with writing code that can be described as elegant, but often, when people say "elegant" they mean using fancy tricks that are often neither good for readability nor performance. Code should be correct, readable, and fast (enough). Mostly in that order. Elegant isn't really part of that at all, unless it serves one of those other things.
|
# ? Oct 22, 2012 03:59 |
|
Everybody likes their own elegant code when they write it, but very few people like it as much when they come back in six months and have to make a change. Readability and maintainability trump almost everything else.
|
# ? Oct 22, 2012 04:01 |
|
Kenishi posted:Which is better in programming, readability or elegance? Elegant programs are generally readable. You want to focus on clarity, simplicity and generality. You seem to have confused elegance with 'writing clever code that's a few lines shorter'. Most programs are going to look boring, and that's ok. It makes them a bajillion times easier to debug. If you want to ask if your code is elegant, really you should be asking "have I written enough code to make what i'm doing clear and obvious". quote:I think the above is easily readable, though a bit unsightly. Where as a lambda tertiary if function would be compact but not so much readable unless you knew how it worked. Trying to cram everything into a line is fun, but it's often just showboating. As for the use of bitfields... If you only have a few options, I'd use named arguments instead of bitfield flags. i.e build_query(...,human=True, none=False), with sensible default values. Another alternative is to use a set/list of strings - i.e build_query(...., set("human")). Another alternative is a namedtuple, i.e code:
|
# ? Oct 22, 2012 04:16 |
|
ultrafilter posted:Everybody likes their own elegant code when they write it, but very few people like it as much when they come back in six months and have to make a change. Readability and maintainability trump almost everything else. Ronald Raiden posted:Code should be correct, readable, and fast (enough). Mostly in that order. Elegant isn't really part of that at all, unless it serves one of those other things. To me, code must be correct, readable, and maintainable for me to consider it elegant at all. Using the latest language trick or technique adds complexity and it only really makes sense to do so in service of one of the other factors, like Raiden says.
|
# ? Oct 22, 2012 04:57 |
|
Doctor w-rw-rw- posted:EDIT: here's some code which, if you understand Python, is slightly more straightforward, and much more concise: Suspicious Dish posted:Not speaking directly on the code, the modelling of "human" or "none" is confusing to me. tef posted:If you want to ask if your code is elegant, really you should be asking "have I written enough code to make what i'm doing clear and obvious". ---- Thanks for the input everyone.
|
# ? Oct 22, 2012 05:47 |
|
Generally, if you need a comment explaining how some code works, that code is way too clever and you should simplify it. And then write a comment explaining it, because chances are it'll still too clever for you once you come back to it in a month.
|
# ? Oct 22, 2012 06:34 |
|
GregNorc posted:Hi... There actually is an R thread but it's in a place you probably didn't look.
|
# ? Oct 22, 2012 07:05 |
|
Kenishi posted:Must the code be clear in the absence of documentation/commenting? Yes. The Introduction of SICP posted:Programs must be written for people to read, and only incidentally for machines to execute. Comments should explain the intent of code, rather than the workings. Sometimes, you have to explain the workings, because you're invoking deep magic, awkward work arounds, or very very low level code. Then you write it as clean as you can, and then comment things too. If you're writing in assembly, you should be writing more comments than code (by size). Most of the time though, the code should explain how and what your are doing, comments should generally be why you are doing it, or why the code has to be terrible. (Aside: The code base I am working on has a few categories of comments - swearwords, apologies, and explanations of unfortunate schenanigans to get things to work. (including my favourite, "take that! third party components. try and poo poo over stdout now!")) The Elements of Programming Style posted: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. Commenting to explain what code does is usually a sign you're trying to showboat, or confuse people. They are a code smell. The Linux Coding Standard posted:Comments are good, but there is also a danger of over-commenting. NEVER A major problem with comments is that they frequently outlast the code they were written for. Code gets changed, and comments lag behind. Comments in the wild are often misleading, rather than helpful. If you're looking for a good, short book written by well tempered programmers, I would highly recommend reading "The Practice Of Programming" by Kernighan and Pike. tef fucked around with this message at 08:10 on Oct 22, 2012 |
# ? Oct 22, 2012 08:07 |
|
Kenishi posted:Thanks for the input everyone. SQL also has an IN operator, so if you have many items, it might be more elegant to do like this: SELECT ... WHERE column IN (a, b, c); Works like Python's "in" with lists.
|
# ? Oct 22, 2012 08:39 |
|
Also, if you are using python to generate SQL, it might be worth looking at sqlalchemy. It has a sql expression language that is all python, and you can't use it without the ORM. I can't really speak to it's performance vs prepared statements though, other than it probably isn't as good. e: that was supposed to be "can" use without the ORM coaxmetal fucked around with this message at 16:24 on Oct 22, 2012 |
# ? Oct 22, 2012 16:12 |
|
Ronald Raiden posted:Also, if you are using python to generate SQL, it might be worth looking at sqlalchemy. It has a sql expression language that is all python, and you can't use it without the ORM. I can't really speak to it's performance vs prepared statements though, other than it probably isn't as good. You can use it without the ORM.
|
# ? Oct 22, 2012 16:15 |
|
Ronald Raiden posted:Also, if you are using python to generate SQL, it might be worth looking at sqlalchemy. It has a sql expression language that is all python, and you can't use it without the ORM. I can't really speak to it's performance vs prepared statements though, other than it probably isn't as good. SQLSoup, originally part of SQLAlchemy, is a less 'heavy' ORM with a psuedo Python DSL: Python code:
|
# ? Oct 22, 2012 16:16 |
|
Suspicious Dish posted:You can use it without the ORM. oh, yeah. THat's what I meant to say. But apparently I said "can't" instead of "can".
|
# ? Oct 22, 2012 16:23 |
|
.
maskenfreiheit fucked around with this message at 21:29 on Apr 28, 2019 |
# ? Oct 22, 2012 19:42 |
|
Carthag posted:SQL also has an IN operator, so if you have many items, it might be more elegant to do like this: Ronald Raiden posted:Also, if you are using python to generate SQL, it might be worth looking at sqlalchemy. It has a sql expression language that is all python, and you can't use it without the ORM. I can't really speak to it's performance vs prepared statements though, other than it probably isn't as good.
|
# ? Oct 23, 2012 00:29 |
|
Hey Goons, I'm trying to decide which book to pickup that will be code independent, and help me learn core programming concepts. Here are two books I'm down to, can anyone recommend one? Pragmatic Programmer: http://www.amazon.com/Pragmatic-Pro...s=code+complete or Code Complete 2nd Edition: http://www.amazon.com/Code-Complete...ete+3rd+edition
|
# ? Oct 24, 2012 04:00 |
|
Knyteguy posted:Hey Goons, Pragmatic Programmer is more concise and to the point.
|
# ? Oct 24, 2012 04:23 |
|
What if someone pays me to program a bot to basically log into a website and do bot things - things ranging from kind of tame things like responding to private messages automatically to blatently abusive stuff like spawning a army of facebook users to like things all at once or whatever. Automation like this seems to be against the terms of service of basically every website these days. Is it true that this isn't clearly illegal, I just have to worry about being sued? And in either case, do I, as the programmer have to worry or just the person paying me? Do these websites generally send a cease and desist or at least make some attempt to stop me (ie block my ip address) before sueing me into oblivion, or would it be dumb to count on this. Do companies like Facebook regularly sue small time abusers of their TOS and you just don't hear about it? I just did a small web-bot project for someone and found it really fun... I'm just checking if I should right away give up ever hoping to work on stuff like that before I get in trouble, or if I'm worrying too much. a cat fucked around with this message at 05:54 on Oct 24, 2012 |
# ? Oct 24, 2012 05:43 |
|
^Thank you I'll be ordering Pragmatic Programmer.jjttjj posted:What if someone pays me to program a bot to basically log into a website and do bot things - things ranging from kind of tame things like responding to private messages automatically to blatently abusive stuff like spawning a army of facebook users to like things all at once or whatever. I'm not a lawyer but if you label it proof of concept I'd imagine you'd be OK as long as you're not the one performing abusive actions. Makers of DDOS software generally aren't the ones targeted, but the people DDOSing are. Throwing a warning in there somewhere that your software is only to be used as proof of concept may help There are cases where this isn't true (WoW Glider) however but in that particular case he was selling his software for real money. Higher courts never ruled on it either; he gave up because legal fees probably got crazy over the few years he was fighting it.
|
# ? Oct 24, 2012 06:17 |
|
Knyteguy posted:Hey Goons, I'd recommend the practice of programming, over both of these.
|
# ? Oct 24, 2012 06:40 |
|
tef posted:A major problem with comments is that they frequently outlast the code they were written for. Code gets changed, and comments lag behind. Comments in the wild are often misleading, rather than helpful. Furthermore, deleting comments when they're outdated shouldn't be considered a faux pas when you're using version control - you can always get it back. Dead code and dead documentation should be pruned and weeded like your garden and lawn. It's healthy.
|
# ? Oct 24, 2012 14:41 |
|
If you change some code, and that makes a comment outdated, just delete the loving comment. If it's still important to have a comment there, the person reviewing your code (you are doing code reviews, right?) can just ask you to write one.
|
# ? Oct 25, 2012 00:29 |
|
This is half a programming question but mostly a hardware question, but I figured somebody has done this before. Has anybody ever tried to poll or be asynchronously notified of a wire signal change for something connected to a PC? We test some stuff here and in some scenarios the best we can get for notification are strobing some signal pins. I'm thinking of getting a cheap-rear end microcontroller with old-school I/O ports and an RS-232 port, and just writing a program to poll the ports and send the pin changes over the RS-232 port. However, I'd prefer to get something off-the-shelf for this if possible. I don't necessarily want to maintain and deploy all these things.
|
# ? Oct 25, 2012 16:26 |
|
Rocko Bonaparte posted:This is half a programming question but mostly a hardware question, but I figured somebody has done this before. Has anybody ever tried to poll or be asynchronously notified of a wire signal change for something connected to a PC? We test some stuff here and in some scenarios the best we can get for notification are strobing some signal pins. You can do better than this, pretty much any uC will have some pins that you can configure to trigger an interrupt on a rising or falling edge. If you haven't done anything embedded before, and Arduino will work splendidly for this and you can write something up that will work in about twenty minutes. If you have an idea what you're doing with a microcontroller, there are much cheaper options, like the excellent MSP430 from TI. If you're comfortable making a simple LDO circuit on a breadboard and whatnot, you have a billion choices.
|
# ? Oct 25, 2012 17:07 |
|
Otto Skorzeny posted:You can do better than this, pretty much any uC will have some pins that you can configure to trigger an interrupt on a rising or falling edge. If you haven't done anything embedded before, and Arduino will work splendidly for this and you can write something up that will work in about twenty minutes. If you have an idea what you're doing with a microcontroller, there are much cheaper options, like the excellent MSP430 from TI. If you're comfortable making a simple LDO circuit on a breadboard and whatnot, you have a billion choices.
|
# ? Oct 25, 2012 17:37 |
|
RE: Goons who have taken a course in Algorithms... I'm registered for a 300-level Algorithms course next quarter, but I haven't taken one of the prerequisites (300-level Discreet Mathematics). My college will probably allow me to take the course, but I don't want to screw myself later. Is there any way I could give myself a crash course in Discreet Math using text/online resources. I have 3 whole weeks during winter break, and I'm pretty sure I will only need a few days to rest/prepare for other classes. All the sections for required/elective CS courses that I still need have filled up, leaving Algorithms my only option (unless more opens later). For reference, I've taken 2 quarters of calc, 1 quarter of linnear algebra, and 2 quarters of statistics. Edit: There is also a potential option to take discreet math concurrently with algorithms, would this be preferable? Hot Yellow KoolAid fucked around with this message at 18:38 on Oct 25, 2012 |
# ? Oct 25, 2012 18:31 |
|
|
# ? May 14, 2024 03:18 |
|
Hot Yellow KoolAid posted:RE: Goons who have taken a course in Algorithms... Never integrate while your partner is looking, it's rude. And frankly, disgusting. The correct spelling is discrete. Taking them concurrently would certainly be fine, it's terribly easy to be frank, and you could probably even just skip it altogether and pick it up during algorithms. But in the long term it's probably worth the time to take it.
|
# ? Oct 25, 2012 18:46 |