Learning Programming

charred

Member
i have been wanting to try to learn programming but im not sure where to begin. i am fascinated by it and would like to be able to understand it more. what language should a beginner start with? any other tips?
 

macman104

Member
Re: Leaning Programming

There is a website called learnerstv.com that I recently found. They've got quite a few books available to download, you can browse through their computer science section, see if there's a book you think you'd want to look at. Of course, you probably want to pick a language first. On these forums, it makes sense to me to say Java since mafia is written in java. But there are tons of languages, and they all have their niches. Is there anything specific you have in mind that you want to learn this for? It might help to narrow down your choices...
 

charred

Member
thanks mac. ill check that out. i guess ill start out with java and see if i can learn something. im not exactly sure what my future plans for this would be right now, but i am looking for a start.
 
Everyone should first try Hello World so...

Start up notepad, and type the following:

Code:
print("Hello World!");

Save it as hello.ash, then run it from the scripts menu in kolmafia, and look at the graphical CLI.

There are many other commands you can use besides print. check out http://wiki.kolmafia.us for a list of commands, and even some code samples. Also download some scripts from here, and try to make them do what they do a little differently. There are many here which you can learn a lot from.
 

charred

Member
[quote author=Veracity link=topic=1477.msg6857#msg6857 date=1201388746]
How about ASH?
[/quote]
thats what i was wondering about. should i learn something, then learn ash? or try ash first? what uses ash, just mafia? i was thinking theres probably more info(books, videos,etc) on other languages than ash
 

macman104

Member
Oh sorry, for some reason charrred I thought you had written scripts before. They're right, why not check out ASH...
 

Veracity

Developer
Staff member
[quote author=charred link=topic=1477.msg6859#msg6859 date=1201393587]
thats what i was wondering about. should i learn something, then learn ash? or try ash first? what uses ash, just mafia? i was thinking theres probably more info(books, videos,etc) on other languages than ash
[/quote]
ASH was invented for KoLmafia and is used only there. But, it's a real programming language, and is not bad at all, in my opinion. It has the advantage that it's all interpreted and you can invoke scripts from the gCLI, edit them, and invoke them again, without having to learn extra stuff so you can invoke a compiler, link your program and then finally execute it. And it's got all the control constructs and functions and data types - and even records and maps (which are similar to arrays) - that you find in "real" languages. You don't even have to log in, if you want to experiment with things that don't actually interact with the kingdom; go to the menu bar when the Login Frame is up, choose Graphical CLI, and voila! the gCLI window pops up and you can invoke scripts right there.

Yes, there are books and such about other languages. But if your eventual goal is to be able to program ASH, then I suggest that you just dive in and do it. Look at the documentation that does exist, look at the hundreds of sample scripts that are posted here, try things out, and just do it!

Not all of the posted scripts are great examples - but published books don't automatically provide examples of "good" programs, either. Try things out, post your works-in-progress here and ask for comments, and more experienced programmers will most likely be more than happy to help you out.
 

macman104

Member
[quote author=Veracity link=topic=1477.msg6862#msg6862 date=1201396214]

ASH was invented for KoLmafia and is used only there. But, it's a real programming language, and is not bad at all, in my opinion.[/quote]Agreed. I actually think it's pretty straight-forward. And probably pretty helpful for general programming knowledge and experience. You should be quite proud of it.
 

kain

Member
[quote author=macman104 link=topic=1477.msg6863#msg6863 date=1201407676]
Agreed. I actually think it's pretty straight-forward. And probably pretty helpful for general programming knowledge and experience. You should be quite proud of it.
[/quote]Allow me to second this ... the only other "language" I know half so well is LPC, which is a specific MUD lib ... not so practical in the real world
 

charred

Member
i am looking forward to learning ash, but as of now the only programming i know is html, so 0 experience with OOP. but i have started going through Java - A Beginners Guide Ed. 3, and i am actually getting it. i will dive into ash in the future when i understand a little more java, as it looks very similiar
 

macman104

Member
I'd think being comfortable with ASH will make it easier to understand the constructs of java. But either way should be ok.
 
Ash is beginning to look more like an oop (object oriented programming) language as time goes by, but it really isn't in the true meaning of oop.

from http://en.wikipedia.org/wiki/Object-oriented_programming
Object-oriented programming (OOP) is a programming paradigm that uses "objects" and their interactions to design applications and computer programs. It is based on several techniques, including encapsulation, modularity, polymorphism, and inheritance. It was not commonly used in mainstream software application development until the early 1990s. Many modern programming languages now support OOP.

In ash, there really are no objects or inheritance. Ash does allow you to create the constructs of a data type, and declare variables from that construct. Ash also uses an implied first parameter in dot notation which is really similar to objects, and there "built in" functions.

I don't know what you are wanting to eventually achieve in ash, but I do think that it is better to start with ash than Java because ash is far less complex than java. If you learn ash first, then start learning Java it will you will probably find learning Java easier. As stated before, we all will be glad to help you along the way.

[quote author=macman104 link=topic=1477.msg6863#msg6863 date=1201407676]
Agreed. I actually think it's pretty straight-forward. And probably pretty helpful for general programming knowledge and experience. You should be quite proud of it.
[/quote] and I will third this notion. I am quite impressed by the abilities of a language created by so few developers.
 

zarqon

Well-known member
I'd like to echo the recommendation to start with ASH. I started programming as a kid writing DOS batch files, and then writing math-test-cheating utilities for my TI-82 calculator (shh), and finally moved on to stuff like Pascal (Delphi), Java, and PHP. I'm not a programmer by trade, but I'm fairly competent. I would agree that starting with a relatively simple language is best, and ASH has lots of capability in a relatively small, simple package. In fact, sometimes its simplicity provides you with useful obstacles that force you to create new functions, or different algorithms.

Also, the community here is very helpful and will be glad to point out all the errors in your scripts help you optimize your scripts. My ASH coding ability has grown significantly since placing some scripts before the public eye.

Bonus: you'll also be able to tweak others' scripts to best suit your individual needs.

The only downside is the relative lack of documentation compared to other more widely-used languages. If you're interested in writing for the Web (you mentioned you have experience with HTML) and have hosting somewhere, I'd recommend branching out into PHP. The online documentation is terrific.
 
Top