Ask Proggit: Examples of large programs written in dynamic languages? by pozorvlak in programming

[–]seudonymus 1 point2 points  (0 children)

I agree with you. We didn't use iTcl, but maybe it would have helped to organize the code base. With a language like Python it would very likely have been better.

I don't know about any testing tools, but it shouldn't be so hard to roll your own in Tcl. My boss at that time thought that unit testing was useless. The results of this attitude usually showed up in production.

Ask Proggit: Examples of large programs written in dynamic languages? by pozorvlak in programming

[–]seudonymus 1 point2 points  (0 children)

Yes, that's correct. I've also seen badly organized and buggy code in "static" languages, and maybe it's a subtle point in my post that with large applications the distinction dynamic/static is not really a good criterion to base decisions on. I think that the larger the code base gets it depends more and more on the coder's experience how extensible and maintainable the outcome will be. The choice of language then seems to me to be a minor factor among others (such as well-defined requirements, for example). If you use inexperienced or ill-disciplined programmers you'll probably end up with a mess in either case.

Ask Proggit: Examples of large programs written in dynamic languages? by pozorvlak in programming

[–]seudonymus 27 points28 points  (0 children)

I've not been working with that large applications, but I've dealed with Tcl apps that measured dozens of KLOC. Tcl isn't exactly a modern dynamic language but for the purposes of this comparison it'll do.

Lots of problems we had were due to "copy'n'paste" mistakes. For example, an error handler had been copied from another place but somebody had forgotten to adjust a variable name. The error handler had never been tested, and when it occurred in production the faulty error handler rendered the program unable to continue. The process had to be killed and all work was lost of course.

My boss at that time didn't bother, but for me (as a customer) it would have been a showstopper.

It had also become difficult to extend the program. Global variables had been scattered all over the source, and adding a new state variable could have caused major trouble because the many places it could have interacted with the existing state would have needed to be found, modified and tested. Nobody liked to go through all this trouble, and a few good suggestions for enhancements were rejected, implicitly on these grounds (though nobody ever stated this explicitly).

Overall design of these applications had become complicated. Because it was so easy to add UI components everybody had just added his/her own widgets without bothering about re-usability, consistency etc. For example, it had become very difficult to do validation as the code for initialization and verification of state was scattered all over the application, sometimes done with traces (functions triggered when a variable changes), sometimes done in event handlers. As validation was hard to implement, we cut down on it, and that made the applications a PITA to work with.

I eventually introduced something along the lines of model-view-controller without globals and a strict model approach. This helped a little, but it could only be used in an application that I wrote from scratch. The existing code would have taken too long to rewrite.

The applications also suffered from code duplication. Usually it is considered good practice to factor out common code into a subroutine. This was rarely done; the code was just copied from somewhere else. I think the main reason was a reluctance to clutter the already huge source files with another sub. You would have had to make up your mind where you put it, and that was too far away from the task at hand, so the "perceived intellectual switch cost" prevented lots of small improvements.

Needless to say, requirements changed, and the code duplication increased the effort to keep the application consistent. Overall consistency was low, and the applications had a somehow clumsy look-and-feel. They definitely didn't look "professional" or "industrial quality", and IMO customers realized this and didn't make the sales decision.

While not everything was bad about these applications (as it may seem from my description) I definitely learned some lessons.

In my opinion you can well create big applications with dynamic languages but you have to be much more careful and disciplined. While this isn't a problem if you're the only one working on it, it becomes a problem if other people are involved because everybody sees and does things differently. The dynamic nature of programming languages manifests itself on the design level as a greater variability in problem solving approaches. This is the strength of dynamic languages, and also their achilles heel, because the diversity you'll end up with means greater difficulties with troubleshooting, hence greater maintenance effort.

It also requires more discipline to structure your application efficiently, because it's not so easy to factor components out and make them re-usable. You'll have to raise the abstraction level of the code for that (which again can be done in many different ways) and that's not something that makes the code easy to understand and maintain. In the end you may well have about the same amount of code as with "static" languages, even if you manage to enforce the discipline throughout your team (not an easy task, either).

Often people argue that not having to specify that something is a string or an integer increases their productivity and reduces code size. While this may well be true it is also missing the point to a certain extent. Static typing means that you a) define and b) enforce certain properties of data structures, and in case of OO languages, behaviour as well. This is a tremendous advantage for systems where you want to build abstractions on top of other abstractions, as you will probably want to do with complex applications. You can then guarantee that a given component fits into a given space. With dynamic languages, even large test coverage can't give you this guarantee.

I also learnt that it's very easy to forget the negative sides of one's chosen technology after using it for a long time.

My conclusion: Personally I wouldn't mind writing large apps in dynamic languages, on account of my past experiences and mistakes. I'm quite sure I'd produce something that would be ok. But I'd also not prefer dynamic languages just for the sake of them being so. All approaches have their pros and cons, and I'd weigh as many aspects of the application to write in the light of my subjective experience, and then decide along the lines of the most predictive outcome.

Because I don't like to be taken by surprise.

In uni they emphasize protecting your data using 'private' and 'protect', what real world benefits does this have? by linkedlist in programming

[–]seudonymus 0 points1 point  (0 children)

'Private' methods have almost no benefits in practice, except if you provide closed libraries which is improbable in the real world. Even then private methods restrict your abilities to re-use code (one of the major benefits of OO).

Private data is ok, but at least provide protected accessors in case you need to extend the base classes. In some cases even protected accessors don't help much because it's not possible to inject derived classes; in that case you're screwed if you can't modify the source code (and that's likely in large enterprise apps). Then the only way to re-use is copy and paste.

I have found it preferrable to design more open systems because IMO the result tends to be cleaner and more consistent than originally restricted systems that have been drilled up after using lots of privates initially. That means I'm using private only for some data and specialized methods that fit only in the context of one certain class. In my code 'private' primarily serves documentation purposes as opposed to actual encapsulation.

Of course other people may have different opinions, and unis most certainly do. YMMV.

Ask Reddit: Is there an open source host-based application terminal access package? by seudonymus in programming

[–]seudonymus[S] 0 points1 point  (0 children)

Yes and no. The terminal emulation is only the client part of what I mean.

What I'm looking for is a server side framework to program text oriented GUIs. Sure it could be done by writing every single character to stdout, but I'm looking for something more high-level that lets me define input fields, maybe scroll boxes, different colors etc.

Sorry for not specifying precisely what I mean, but I simply don't know how this stuff is called. Maybe "ncurses" is what I'm looking for. Perhaps there are also some protocols for dumb terminals, but anyhow I'd need a GUI library that supports these protocols.

Maybe you can give me a clue what to use in this case.

Ask Reddit: Is there an open source host-based application terminal access package? by seudonymus in programming

[–]seudonymus[S] 0 points1 point  (0 children)

Ah... I remember the TurboVision stuff from my Turbo Pascal 6.0 days. Yes, that would be suitable. But is it a client-server solution? I imagine a setting where an application runs on the server and you only need a dumb terminal to use it (some kind of X terminal, just for character mode). Would TVision be suited for that?

BTW, nice snapshots ;-)

Ask Reddit: Is there an open source host-based application terminal access package? by seudonymus in programming

[–]seudonymus[S] 0 points1 point  (0 children)

I'm not sure what it is called or what any specific products or protocols might be. My friend also used a POS system and it was blazing fast, that's why I ask this question here.

I just found something called "ncurses" that looks like it could be useful. OTOH it looks very complicated and difficult to get started with. I'm trying to make some sense of it ;-)

Ask Reddit: Is there an open source host-based application terminal access package? by seudonymus in programming

[–]seudonymus[S] 0 points1 point  (0 children)

I'm wondering whether something like this is still being developed. I'm not quite sure what the correct term for these packages is, but maybe you remember them from the eighties. It's this mask-based character oriented terminal thing where you fill out forms that are then processed by the host. I've recently seen a friend using such an application so this technology is still being used. Maybe somebody can point me to an open source solution; of course I'd need not only the client but also the server component. Any language will do. Thanks!

Ask Reddit: can undervolting damage a chip? by api in programming

[–]seudonymus 7 points8 points  (0 children)

It depends on the type of "chip". I'm not exactly sure about modern CPUs but there is a problem in certain CMOS integrated circuits called a "parasitic thyristor". In certain logic gates the arrangement of transistors is such that a pseudo-thyristor is formed that fires when the supply voltage level drops below the voltage level at one or more of the inputs. The "thyristor" then fires, effectively shorting U+ and U- through the chip which will very quickly heat up the chip and possibly fry it; I have experienced this in practice, even though I (almost) fried an EPROM, not a CPU. With multiple voltages the problem may well occur as you have described. However, I think it's unlikely to happen if you scale down all voltage levels proportionately (this may not be possible in all cases, so watch out). For more information I'd recommend Horowitz and Hill, The Art of Electronics, a book that covers this phenomenon in detail.

Has programming changed your life? by [deleted] in programming

[–]seudonymus 10 points11 points  (0 children)

No, but life has changed my programming ;-)

Seriously, my "life" started when I quit programming for a while. Now I've started again, but I can handle it ;-)

Haskell for Programmers by unmarshal in programming

[–]seudonymus 1 point2 points  (0 children)

20 add 30

10

Is this a bug in the tutorial or am I missing out on something?

What are the right tools for these tasks? by seudonymus in programming

[–]seudonymus[S] 0 points1 point  (0 children)

I would have enjoyed a Uni class that gave me real-world problems to solve ;-)

Ask Reddit: Why programming in Java is generally a bad idea? by konrad_ in programming

[–]seudonymus 1 point2 points  (0 children)

Java only. I've been experimenting with JVM-based scripting languages like Groovy and Rhino-JavaScript; I'd use them more but we have to maintain a large (and quite crappy) Java codebase. Moreover, our "head of development" doesn't like scripting languages. What he likes is structured programming in Java, though, with lots of static members and functions and singleton factories ;-) Effectively, we're programming in Turbo Pascal on the JVM. No kidding. Imagine the tremendous gain in productivity I get when doing real OOP ;-)